-// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2021-2022 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
namespace config {
CmdHttpListener::CmdHttpListener(const IOAddress& address, const uint16_t port,
- const uint16_t thread_pool_size /* = 1 */)
+ const uint16_t thread_pool_size /* = 1 */,
+ TlsContextPtr context /* = () */)
: address_(address), port_(port), thread_io_service_(), http_listener_(),
- thread_pool_size_(thread_pool_size), thread_pool_() {
+ thread_pool_size_(thread_pool_size), thread_pool_(),
+ tls_context_(context) {
}
CmdHttpListener::~CmdHttpListener() {
// Create the HTTP listener. It will open up a TCP socket and be
// prepared to accept incoming connections.
- TlsContextPtr tls_context;
- http_listener_.reset(new HttpListener(*thread_io_service_, address_, port_, tls_context, rcf,
+ http_listener_.reset(new HttpListener(*thread_io_service_, address_,
+ port_, tls_context_, rcf,
HttpListener::RequestTimeout(TIMEOUT_AGENT_RECEIVE_COMMAND),
HttpListener::IdleTimeout(TIMEOUT_AGENT_IDLE_CONNECTION_TIMEOUT)));
// OK, seems like we're good to go.
LOG_DEBUG(command_logger, DBG_COMMAND, COMMAND_HTTP_LISTENER_STARTED)
- .arg(thread_pool_size_)
- .arg(address_)
- .arg(port_);
+ .arg(thread_pool_size_)
+ .arg(address_)
+ .arg(port_)
+ .arg(!!tls_context_);
} catch (const std::exception& ex) {
isc_throw(Unexpected, "CmdHttpListener::run failed:" << ex.what());
}
-// Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2021-2022 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
public:
/// @brief Constructor
CmdHttpListener(const asiolink::IOAddress& address, const uint16_t port,
- const uint16_t thread_pool_size = 1);
+ const uint16_t thread_pool_size = 1,
+ asiolink::TlsContextPtr context = asiolink::TlsContextPtr());
/// @brief Destructor
virtual ~CmdHttpListener();
return (thread_pool_size_);
}
+ /// @brief Fetches the TLS context.
+ ///
+ /// @return TLS context.
+ asiolink::TlsContextPtr getTlsContext() const {
+ return (tls_context_);
+ }
+
/// @brief Fetches the number of threads in the pool.
///
/// @return uint16_t containing the number of running threads.
/// @brief The pool of threads that do IO work.
http::HttpThreadPoolPtr thread_pool_;
+
+ /// @brief The TLS context.
+ asiolink::TlsContextPtr tls_context_;
};
/// @brief Defines a shared pointer to CmdHttpListener.
"COMMAND_ACCEPTOR_START", "Starting to accept connections via unix domain socket bound to %1",
"COMMAND_DEREGISTERED", "Command %1 deregistered",
"COMMAND_EXTENDED_REGISTERED", "Command %1 registered",
- "COMMAND_HTTP_LISTENER_STARTED", "Command HTTP listener started with %1 threads, listening on %2:%3",
+ "COMMAND_HTTP_LISTENER_STARTED", "Command HTTP listener started with %1 threads, listening on %2:%3, use TLS: %4",
"COMMAND_HTTP_LISTENER_STOPPED", "Command HTTP listener for %1:%2 stopped.",
"COMMAND_HTTP_LISTENER_STOPPING", "Stopping Command HTTP listener for %1:%2",
"COMMAND_PROCESS_ERROR1", "Error while processing command: %1",
command. The handler for the registered command includes a parameter holding
entire command to be processed.
-% COMMAND_HTTP_LISTENER_STARTED Command HTTP listener started with %1 threads, listening on %2:%3
+% COMMAND_HTTP_LISTENER_STARTED Command HTTP listener started with %1 threads, listening on %2:%3, use TLS: %4
This debug messages is issued when an HTTP listener has been started to
accept connections from Command API clients through which commands can be
received and responses sent. Arguments detail the number of threads
-that the listener is using, and the address and port at which it
-is listening.
+that the listener is using, the address and port at which it is listening,
+and if HTTPS/TLS is used or not.
% COMMAND_HTTP_LISTENER_STOPPED Command HTTP listener for %1:%2 stopped.
This debug messages is issued when the Command HTTP listener, listening