]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3694] addressed review comments
authorRazvan Becheriu <razvan@isc.org>
Mon, 10 Feb 2025 18:59:17 +0000 (20:59 +0200)
committerRazvan Becheriu <razvan@isc.org>
Tue, 11 Feb 2025 09:05:17 +0000 (11:05 +0200)
16 files changed:
ChangeLog
doc/sphinx/arm/agent.rst
doc/sphinx/arm/ddns.rst
doc/sphinx/arm/dhcp4-srv.rst
doc/sphinx/arm/dhcp6-srv.rst
src/bin/agent/ca_messages.cc
src/bin/agent/ca_messages.h
src/bin/agent/ca_messages.mes
src/bin/agent/ca_process.cc
src/bin/agent/tests/ca_controller_unittests.cc
src/lib/config/config_messages.cc
src/lib/config/config_messages.h
src/lib/config/config_messages.mes
src/lib/config/http_command_mgr.cc
src/lib/config/http_command_mgr.h
src/lib/config/unix_command_mgr.h

index 10af667ca5d2489ab004c6a18efec02eb369ad7b..c32d65fad2c17da0eeabef4a2b8c0c7e289287ac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
 2324.  [func]          razvan
        It is not necessary to restart the server to apply changes in the
        TLS configuration. Running the "config-reload" command is
-       sufficient.
+       sufficient. A different address or port must be specified when
+       switching from HTTP to HTTPS or from HTTPS to HTTP.
        (Gitlab #3694)
 
 Kea 2.7.6 (development) released on January 29, 2025
index 231246d0ad168de6a9f0e10d280c327a77977fcb..3ec3484f772b420f67ad16b950979ea2641bb5ce 100644 (file)
@@ -259,8 +259,13 @@ Configuring only one or two string parameters results in an error.
    mutually authenticated, but there is no proof they are the same as
    for the HTTP authentication.
 
+The server will issue an error when changing the socket type from HTTP to HTTPS
+or from HTTPS to HTTP using the same address and port. This action is not
+allowed as it might introduce a security issue accidentally caused by a user
+mistake.
 A different address or port must be specified when using the "config-set"
-command to switch from HTTP to HTTPS or from HTTPS to HTTP.
+command to switch from HTTP to HTTPS or from HTTPS to HTTP. The same applies
+when modyfying the configuration file and then running "config-reload" command.
 
 The :iscman:`kea-shell` tool also supports TLS.
 
index 4b2f141a75b1ede65d482c86d3b5df015ef7b8a6..77dbcecfce3c6ea01c8a96c671c061e484184d62 100644 (file)
@@ -428,8 +428,13 @@ password, these values can be read from files. The syntax is extended by:
 
 Since Kea-2.7.6 Kea supports multiple HTTP/HTTPS connections.
 Both IPv4 and IPv6 addresses can be used.
+The server will issue an error when changing the socket type from HTTP to HTTPS
+or from HTTPS to HTTP using the same address and port. This action is not
+allowed as it might introduce a security issue accidentally caused by a user
+mistake.
 A different address or port must be specified when using the "config-set"
-command to switch from HTTP to HTTPS or from HTTPS to HTTP.
+command to switch from HTTP to HTTPS or from HTTPS to HTTP. The same applies
+when modyfying the configuration file and then running "config-reload" command.
 
 When files are used, they are read when the configuration is loaded,
 to detect configuration errors as soon as possible.
index 9939e366467708fcf0eefe7a68ad016d37de1710..75e6529b3cfec383b2e9d000bd1afea7e1041b99 100644 (file)
@@ -7922,8 +7922,13 @@ password, these values can be read from files. The syntax is extended by:
 
 Since Kea-2.7.6 Kea supports multiple HTTP/HTTPS connections.
 Both IPv4 and IPv6 addresses can be used.
+The server will issue an error when changing the socket type from HTTP to HTTPS
+or from HTTPS to HTTP using the same address and port. This action is not
+allowed as it might introduce a security issue accidentally caused by a user
+mistake.
 A different address or port must be specified when using the "config-set"
-command to switch from HTTP to HTTPS or from HTTPS to HTTP.
+command to switch from HTTP to HTTPS or from HTTPS to HTTP. The same applies
+when modyfying the configuration file and then running "config-reload" command.
 
 When files are used, they are read when the configuration is loaded,
 to detect configuration errors as soon as possible.
index ea7e3b878c197d52e9bf9142a8146cc97767c91f..bf1739649a027a943ec83a4aa4bcd958ebd2bba2 100644 (file)
@@ -7723,8 +7723,13 @@ password, these values can be read from files. The syntax is extended by:
 
 Since Kea-2.7.6 Kea supports multiple HTTP/HTTPS connections.
 Both IPv4 and IPv6 addresses can be used.
+The server will issue an error when changing the socket type from HTTP to HTTPS
+or from HTTPS to HTTP using the same address and port. This action is not
+allowed as it might introduce a security issue accidentally caused by a user
+mistake.
 A different address or port must be specified when using the "config-set"
-command to switch from HTTP to HTTPS or from HTTPS to HTTP.
+command to switch from HTTP to HTTPS or from HTTPS to HTTP. The same applies
+when modyfying the configuration file and then running "config-reload" command.
 
 When files are used, they are read when the configuration is loaded,
 to detect configuration errors as soon as possible.
index d433ee08f9aafcd5e737cf0a63ad712c6d711326..0ef1261c65abe2654f26a3123b74368caa9fae91 100644 (file)
@@ -20,6 +20,7 @@ extern const isc::log::MessageID CTRL_AGENT_HTTPS_SERVICE_STARTED = "CTRL_AGENT_
 extern const isc::log::MessageID CTRL_AGENT_HTTPS_SERVICE_UPDATED = "CTRL_AGENT_HTTPS_SERVICE_UPDATED";
 extern const isc::log::MessageID CTRL_AGENT_HTTP_SERVICE_REUSE_FAILED = "CTRL_AGENT_HTTP_SERVICE_REUSE_FAILED";
 extern const isc::log::MessageID CTRL_AGENT_HTTP_SERVICE_STARTED = "CTRL_AGENT_HTTP_SERVICE_STARTED";
+extern const isc::log::MessageID CTRL_AGENT_HTTP_SERVICE_UPDATED = "CTRL_AGENT_HTTP_SERVICE_UPDATED";
 extern const isc::log::MessageID CTRL_AGENT_RUN_EXIT = "CTRL_AGENT_RUN_EXIT";
 extern const isc::log::MessageID CTRL_AGENT_STARTED = "CTRL_AGENT_STARTED";
 
@@ -37,11 +38,12 @@ const char* values[] = {
     "CTRL_AGENT_CONFIG_FAIL", "Control Agent configuration failed: %1",
     "CTRL_AGENT_CONFIG_SYNTAX_WARNING", "Control Agent configuration syntax warning: %1",
     "CTRL_AGENT_FAILED", "application experienced a fatal error: %1",
-    "CTRL_AGENT_HTTPS_SERVICE_REUSE_FAILED", "failed to reuse HTTPS service bound to address %1:%2",
-    "CTRL_AGENT_HTTPS_SERVICE_STARTED", "HTTPS service bound to address %1:%2",
-    "CTRL_AGENT_HTTPS_SERVICE_UPDATED", "reused HTTPS service bound to address %1:%2 and updated TLS settings",
-    "CTRL_AGENT_HTTP_SERVICE_REUSE_FAILED", "failed to reused HTTP service bound to address %1:%2",
-    "CTRL_AGENT_HTTP_SERVICE_STARTED", "HTTP service bound to address %1:%2",
+    "CTRL_AGENT_HTTPS_SERVICE_REUSE_FAILED", "failed to reuse HTTPS service bound to address: %1 port: %2",
+    "CTRL_AGENT_HTTPS_SERVICE_STARTED", "HTTPS service bound to address: %1 port: %2",
+    "CTRL_AGENT_HTTPS_SERVICE_UPDATED", "reused HTTPS service bound to address: %1 port: %2 and updated TLS settings",
+    "CTRL_AGENT_HTTP_SERVICE_REUSE_FAILED", "failed to reused HTTP service bound to address: %1 port: %2",
+    "CTRL_AGENT_HTTP_SERVICE_STARTED", "HTTP service bound to address: %1 port: %2",
+    "CTRL_AGENT_HTTP_SERVICE_UPDATED", "reused HTTP service bound to address: %1 port: %2",
     "CTRL_AGENT_RUN_EXIT", "application is exiting the event loop",
     "CTRL_AGENT_STARTED", "Kea Control Agent version %1 started",
     NULL
index 898e6187f6350855ad7a1ddd97cd881009e8bbf0..d643e0bbaa059a7b46cf0ace59cbc108ad2f3b3a 100644 (file)
@@ -21,6 +21,7 @@ extern const isc::log::MessageID CTRL_AGENT_HTTPS_SERVICE_STARTED;
 extern const isc::log::MessageID CTRL_AGENT_HTTPS_SERVICE_UPDATED;
 extern const isc::log::MessageID CTRL_AGENT_HTTP_SERVICE_REUSE_FAILED;
 extern const isc::log::MessageID CTRL_AGENT_HTTP_SERVICE_STARTED;
+extern const isc::log::MessageID CTRL_AGENT_HTTP_SERVICE_UPDATED;
 extern const isc::log::MessageID CTRL_AGENT_RUN_EXIT;
 extern const isc::log::MessageID CTRL_AGENT_STARTED;
 
index 9818af2f8d30353db028e8ce0176aacf2aed5df3..6ba78a2a656fde30caa789471ad86ea2c506f776 100644 (file)
@@ -43,31 +43,35 @@ error. The error was displayed and the configuration parsing resumed.
 This is a fatal error message issued when the Control Agent application
 encounters an unrecoverable error from within the event loop.
 
-% CTRL_AGENT_HTTPS_SERVICE_REUSE_FAILED failed to reuse HTTPS service bound to address %1:%2
+% CTRL_AGENT_HTTPS_SERVICE_REUSE_FAILED failed to reuse HTTPS service bound to address: %1 port: %2
 This error message indicates that the server has failed reusing existing
 HTTPS service on the specified address and port. The server can not swith from
 HTTPS to HTTP sockets using the same address and port.
 
-% CTRL_AGENT_HTTPS_SERVICE_STARTED HTTPS service bound to address %1:%2
+% CTRL_AGENT_HTTPS_SERVICE_STARTED HTTPS service bound to address: %1 port: %2
 This informational message indicates that the server has started HTTPS service
 on the specified address and port. All control commands should be sent to this
 address and port over a TLS channel.
 
-% CTRL_AGENT_HTTPS_SERVICE_UPDATED reused HTTPS service bound to address %1:%2 and updated TLS settings
+% CTRL_AGENT_HTTPS_SERVICE_UPDATED reused HTTPS service bound to address: %1 port: %2 and updated TLS settings
 This informational message indicates that the server has reused existing
 HTTPS service on the specified address and port. Note that any change in
 the TLS setup has been applied.
 
-% CTRL_AGENT_HTTP_SERVICE_REUSE_FAILED failed to reused HTTP service bound to address %1:%2
+% CTRL_AGENT_HTTP_SERVICE_REUSE_FAILED failed to reused HTTP service bound to address: %1 port: %2
 This error message indicates that the server has failed reusing existing
 HTTP service on the specified address and port. The server can not swith from
 HTTP to HTTPS sockets using the same address and port.
 
-% CTRL_AGENT_HTTP_SERVICE_STARTED HTTP service bound to address %1:%2
+% CTRL_AGENT_HTTP_SERVICE_STARTED HTTP service bound to address: %1 port: %2
 This informational message indicates that the server has started HTTP service
 on the specified address and port. All control commands should be sent to this
 address and port.
 
+% CTRL_AGENT_HTTP_SERVICE_UPDATED reused HTTP service bound to address: %1 port: %2
+This informational message indicates that the server has reused existing
+HTTP service on the specified address and port.
+
 % CTRL_AGENT_RUN_EXIT application is exiting the event loop
 Logged at debug log level 0.
 This is a debug message issued when the Control Agent exits its
index 0594714a96e961fcfe1ed81086fd66c4cfb915a1..d254d6ddee569888b24488c118e3d5a9becf132e 100644 (file)
@@ -162,18 +162,27 @@ CtrlAgentProcess::configure(isc::data::ConstElementPtr config_set,
                         // Overwrite the authentication setup and the http headers in the response creator config.
                         it->second->config_->setAuthConfig(ctx->getAuthConfig());
                         it->second->config_->setHttpHeaders(ctx->getHttpHeaders());
-                        getIOService()->post([listener, tls_context]() { listener->setTlsContext(tls_context); });
+                        listener->setTlsContext(tls_context);
                         LOG_INFO(agent_logger, CTRL_AGENT_HTTPS_SERVICE_UPDATED)
                             .arg(server_address.toText())
                             .arg(server_port);
                     }
-                } else if (!ctx->getTrustAnchor().empty()) {
-                    // Can not switch from HTTP to HTTPS
-                    LOG_ERROR(agent_logger, CTRL_AGENT_HTTP_SERVICE_REUSE_FAILED)
-                        .arg(server_address.toText())
-                        .arg(server_port);
-                    isc_throw(BadValue,
-                              "Can not switch from HTTP to HTTPS sockets using the same address and port.");
+                } else {
+                    if (!ctx->getTrustAnchor().empty()) {
+                        // Can not switch from HTTP to HTTPS
+                        LOG_ERROR(agent_logger, CTRL_AGENT_HTTP_SERVICE_REUSE_FAILED)
+                            .arg(server_address.toText())
+                            .arg(server_port);
+                        isc_throw(BadValue,
+                                  "Can not switch from HTTP to HTTPS sockets using the same address and port.");
+                    } else {
+                        // Overwrite the authentication setup and the http headers in the response creator config.
+                        it->second->config_->setAuthConfig(ctx->getAuthConfig());
+                        it->second->config_->setHttpHeaders(ctx->getHttpHeaders());
+                        LOG_INFO(agent_logger, CTRL_AGENT_HTTP_SERVICE_UPDATED)
+                            .arg(server_address.toText())
+                            .arg(server_port);
+                    }
                 }
             }
             // If the connection can be reused, mark it as usable.
index c6da2b2488657c2d337c11ec6da63d374eeb4e88..853f6a646a7d6f44cbea97d5815d57586535f6a1 100644 (file)
@@ -421,6 +421,9 @@ TEST_F(CtrlAgentControllerTest, noListenerChangeHttp) {
         "  }"
         "}";
 
+    // Pointer used to store the listener instance. It is set after 50 ms the
+    // process has started (using a timer) and it's value is checked on server
+    // shutdown using the callback.
     const HttpListener* listener_ptr = 0;
 
     // This check callback is called before the shutdown.
@@ -522,6 +525,9 @@ TEST_F(CtrlAgentControllerTest, noListenerChangeHttps) {
              << "  }"
              << "}";
 
+    // Pointer used to store the listener instance. It is set after 50 ms the
+    // process has started (using a timer) and it's value is checked on server
+    // shutdown using the callback.
     const HttpListener* listener_ptr = 0;
     TlsContext* context = 0;
 
@@ -607,6 +613,9 @@ TEST_F(CtrlAgentControllerTest, handleHttpToHttpsSwitch) {
              << "  }"
              << "}";
 
+    // Pointer used to store the listener instance. It is set after 50 ms the
+    // process has started (using a timer) and it's value is checked on server
+    // shutdown using the callback.
     const HttpListener* listener_ptr = 0;
 
     // This check callback is called before the shutdown.
@@ -703,6 +712,9 @@ TEST_F(CtrlAgentControllerTest, handleHttpsToHttpSwitch) {
              << "  }"
              << "}";
 
+    // Pointer used to store the listener instance. It is set after 50 ms the
+    // process has started (using a timer) and it's value is checked on server
+    // shutdown using the callback.
     const HttpListener* listener_ptr = 0;
     TlsContext* context = 0;
 
index 446f742102a5ef12b3f0655bea2d88ad94357022..8e36564403f50a8a5722b73fb23c771cb83c7ca4 100644 (file)
@@ -37,6 +37,7 @@ extern const isc::log::MessageID COMMAND_WATCH_SOCKET_MARK_READY_ERROR = "COMMAN
 extern const isc::log::MessageID HTTP_COMMAND_MGR_HTTPS_SERVICE_REUSE_FAILED = "HTTP_COMMAND_MGR_HTTPS_SERVICE_REUSE_FAILED";
 extern const isc::log::MessageID HTTP_COMMAND_MGR_HTTPS_SERVICE_UPDATED = "HTTP_COMMAND_MGR_HTTPS_SERVICE_UPDATED";
 extern const isc::log::MessageID HTTP_COMMAND_MGR_HTTP_SERVICE_REUSE_FAILED = "HTTP_COMMAND_MGR_HTTP_SERVICE_REUSE_FAILED";
+extern const isc::log::MessageID HTTP_COMMAND_MGR_HTTP_SERVICE_UPDATED = "HTTP_COMMAND_MGR_HTTP_SERVICE_UPDATED";
 extern const isc::log::MessageID HTTP_COMMAND_MGR_SERVICE_STARTED = "HTTP_COMMAND_MGR_SERVICE_STARTED";
 extern const isc::log::MessageID HTTP_COMMAND_MGR_SERVICE_STOPPING = "HTTP_COMMAND_MGR_SERVICE_STOPPING";
 
@@ -50,9 +51,9 @@ const char* values[] = {
     "COMMAND_DEREGISTERED", "Command %1 deregistered",
     "COMMAND_EXTENDED_REGISTERED", "Command %1 registered",
     "COMMAND_HTTP_LISTENER_COMMAND_REJECTED", "Command HTTP listener rejected command '%1' from '%2'",
-    "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_HTTP_LISTENER_STARTED", "Command HTTP listener started with %1 threads, listening on address: %2 port: %3, use TLS: %4",
+    "COMMAND_HTTP_LISTENER_STOPPED", "Command HTTP listener for address: %1 port: %2 stopped.",
+    "COMMAND_HTTP_LISTENER_STOPPING", "Stopping Command HTTP listener for address: %1 port: %2",
     "COMMAND_PROCESS_ERROR1", "Error while processing command: %1",
     "COMMAND_PROCESS_ERROR2", "Error while processing command: %1",
     "COMMAND_RECEIVED", "Received command '%1'",
@@ -73,10 +74,11 @@ const char* values[] = {
     "COMMAND_WATCH_SOCKET_CLEAR_ERROR", "watch socket failed to clear: %1",
     "COMMAND_WATCH_SOCKET_CLOSE_ERROR", "watch socket failed to close: %1",
     "COMMAND_WATCH_SOCKET_MARK_READY_ERROR", "watch socket failed to mark ready: %1",
-    "HTTP_COMMAND_MGR_HTTPS_SERVICE_REUSE_FAILED", "failed to reused HTTPS service bound to address %1:%2",
-    "HTTP_COMMAND_MGR_HTTPS_SERVICE_UPDATED", "reused HTTPS service bound to address %1:%2 and updated TLS settings",
-    "HTTP_COMMAND_MGR_HTTP_SERVICE_REUSE_FAILED", "failed to reused HTTP service bound to address %1:%2",
-    "HTTP_COMMAND_MGR_SERVICE_STARTED", "started %1 service bound to address %2 port %3",
+    "HTTP_COMMAND_MGR_HTTPS_SERVICE_REUSE_FAILED", "failed to reused HTTPS service bound to address: %1 port: %2",
+    "HTTP_COMMAND_MGR_HTTPS_SERVICE_UPDATED", "reused HTTPS service bound to address: %1 port: %2 and updated TLS settings",
+    "HTTP_COMMAND_MGR_HTTP_SERVICE_REUSE_FAILED", "failed to reused HTTP service bound to address: %1 port: %2",
+    "HTTP_COMMAND_MGR_HTTP_SERVICE_UPDATED", "reused HTTP service bound to address: %1 port: %2",
+    "HTTP_COMMAND_MGR_SERVICE_STARTED", "started %1 service bound to address: %2 port: %3",
     "HTTP_COMMAND_MGR_SERVICE_STOPPING", "Server is stopping %1 service %2",
     NULL
 };
index 446bd00add414d3925980dab1ab4deb1ebfd1732..c42b17d0b74247fc1a4120e68be353a165434eb2 100644 (file)
@@ -38,6 +38,7 @@ extern const isc::log::MessageID COMMAND_WATCH_SOCKET_MARK_READY_ERROR;
 extern const isc::log::MessageID HTTP_COMMAND_MGR_HTTPS_SERVICE_REUSE_FAILED;
 extern const isc::log::MessageID HTTP_COMMAND_MGR_HTTPS_SERVICE_UPDATED;
 extern const isc::log::MessageID HTTP_COMMAND_MGR_HTTP_SERVICE_REUSE_FAILED;
+extern const isc::log::MessageID HTTP_COMMAND_MGR_HTTP_SERVICE_UPDATED;
 extern const isc::log::MessageID HTTP_COMMAND_MGR_SERVICE_STARTED;
 extern const isc::log::MessageID HTTP_COMMAND_MGR_SERVICE_STOPPING;
 
index 731b8178d6c3c183829ea95046d2d9874fdf4f07..5868068cdd6fdac68623cbf40e3d483fdd4753c8 100644 (file)
@@ -30,7 +30,7 @@ Logged at debug log level 10.
 This debug messages is issued when a command is rejected. Arguments detail
 the command and the address the request was received from.
 
-% COMMAND_HTTP_LISTENER_STARTED Command HTTP listener started with %1 threads, listening on %2:%3, use TLS: %4
+% COMMAND_HTTP_LISTENER_STARTED Command HTTP listener started with %1 threads, listening on address: %2 port: %3, use TLS: %4
 Logged at debug log level 10.
 This debug messages is issued when an HTTP listener has been started to
 accept connections from Command API clients through which commands can be
@@ -38,12 +38,12 @@ received and responses sent.  Arguments detail the number of threads
 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.
+% COMMAND_HTTP_LISTENER_STOPPED Command HTTP listener for address: %1 port: %2 stopped.
 Logged at debug log level 10.
 This debug messages is issued when the Command HTTP listener, listening
 at the given address and port, has completed shutdown.
 
-% COMMAND_HTTP_LISTENER_STOPPING Stopping Command HTTP listener for %1:%2
+% COMMAND_HTTP_LISTENER_STOPPING Stopping Command HTTP listener for address: %1 port: %2
 Logged at debug log level 10.
 This debug messages is issued when the Command HTTP listener, listening
 at the given address and port, has begun to shutdown.
@@ -153,22 +153,26 @@ ready status after scheduling asynchronous send. This is programmatic error
 that should be reported. The command manager may or may not continue
 to operate correctly.
 
-% HTTP_COMMAND_MGR_HTTPS_SERVICE_REUSE_FAILED failed to reused HTTPS service bound to address %1:%2
+% HTTP_COMMAND_MGR_HTTPS_SERVICE_REUSE_FAILED failed to reused HTTPS service bound to address: %1 port: %2
 This error message indicates that the server has failed reusing existing
 HTTPS service on the specified address and port. The server can not swith from
 HTTPS to HTTP sockets using the same address and port.
 
-% HTTP_COMMAND_MGR_HTTPS_SERVICE_UPDATED reused HTTPS service bound to address %1:%2 and updated TLS settings
+% HTTP_COMMAND_MGR_HTTPS_SERVICE_UPDATED reused HTTPS service bound to address: %1 port: %2 and updated TLS settings
 This informational message indicates that the server has reused existing
 HTTPS service on the specified address and port. Note that any change in
 the TLS setup has been applied.
 
-% HTTP_COMMAND_MGR_HTTP_SERVICE_REUSE_FAILED failed to reused HTTP service bound to address %1:%2
+% HTTP_COMMAND_MGR_HTTP_SERVICE_UPDATED reused HTTP service bound to address: %1 port: %2
+This informational message indicates that the server has reused existing
+HTTP service on the specified address and port.
+
+% HTTP_COMMAND_MGR_HTTP_SERVICE_REUSE_FAILED failed to reused HTTP service bound to address: %1 port: %2
 This error message indicates that the server has failed reusing existing
 HTTP service on the specified address and port. The server can not swith from
 HTTP to HTTPS sockets using the same address and port.
 
-% HTTP_COMMAND_MGR_SERVICE_STARTED started %1 service bound to address %2 port %3
+% HTTP_COMMAND_MGR_SERVICE_STARTED started %1 service bound to address: %2 port: %3
 This informational message indicates that the server has started
 HTTP/HTTPS service on the specified address and port for receiving
 control commands.
index f1271c7d3f6bc8527f9be56a51c4e94643ca0917..f216689916085493e66d97c0b6d2185ff7448e99 100644 (file)
@@ -154,18 +154,29 @@ HttpCommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr config) {
                     it->second->config_->setAuthConfig(cmd_config->getAuthConfig());
                     it->second->config_->setHttpHeaders(cmd_config->getHttpHeaders());
                     it->second->config_->setEmulateAgentResponse(cmd_config->getEmulateAgentResponse());
-                    io_service_->post([listener, tls_context]() { listener->setTlsContext(tls_context); });
+                    listener->setTlsContext(tls_context);
                     LOG_INFO(command_logger, HTTP_COMMAND_MGR_HTTPS_SERVICE_UPDATED)
                         .arg(server_address.toText())
                         .arg(server_port);
                 }
-            } else if (!cmd_config->getTrustAnchor().empty()) {
-                // Can not switch from HTTP to HTTPS
-                LOG_ERROR(command_logger, HTTP_COMMAND_MGR_HTTP_SERVICE_REUSE_FAILED)
-                    .arg(server_address.toText())
-                    .arg(server_port);
-                isc_throw(BadValue,
-                          "Can not switch from HTTP to HTTPS sockets using the same address and port.");
+            } else {
+                if (!cmd_config->getTrustAnchor().empty()) {
+                    // Can not switch from HTTP to HTTPS
+                    LOG_ERROR(command_logger, HTTP_COMMAND_MGR_HTTP_SERVICE_REUSE_FAILED)
+                        .arg(server_address.toText())
+                        .arg(server_port);
+                    isc_throw(BadValue,
+                              "Can not switch from HTTP to HTTPS sockets using the same address and port.");
+                } else {
+                    // Overwrite the authentication setup, the http headers and the emulation flag
+                    // in the response creator config.
+                    it->second->config_->setAuthConfig(cmd_config->getAuthConfig());
+                    it->second->config_->setHttpHeaders(cmd_config->getHttpHeaders());
+                    it->second->config_->setEmulateAgentResponse(cmd_config->getEmulateAgentResponse());
+                    LOG_INFO(command_logger, HTTP_COMMAND_MGR_HTTP_SERVICE_UPDATED)
+                        .arg(server_address.toText())
+                        .arg(server_port);
+                }
             }
         }
         // If the connection can be reused, mark it as usable.
index 2c48c7ab81de42794c595b50686dccad9581facd..4560f22dfe06d391a1a63263c7bc782063d67c23 100644 (file)
@@ -65,7 +65,7 @@ public:
     /// changes.
     ///
     /// @note This function in used internally by @ref openCommandSockets and it
-    /// should not be used directly, except for unittests.
+    /// should not be used directly, except for unit tests.
     ///
     /// @param config Configuration information for the http control socket.
     void openCommandSocket(const isc::data::ConstElementPtr config);
@@ -73,7 +73,7 @@ public:
     /// @brief Close http control socket.
     ///
     /// @note This function in used internally by @ref closeCommandSockets and it
-    /// should not be used directly, except for unittests.
+    /// should not be used directly, except for unit tests.
     ///
     /// @param info Configuration information for the http control socket.
     /// @param remove When true remove the listeners immediately.
index 9a328df8ee9c73670549a5346b0b5aae529a568a..97b5f3681da71f69ea37bff5684c368d98cd4c8f 100644 (file)
@@ -74,7 +74,7 @@ public:
     /// Creates acceptor, or reuses the existing one.
     ///
     /// @note This function in used internally by @ref openCommandSockets and it
-    /// should not be used directly, except for unittests.
+    /// should not be used directly, except for unit tests.
     ///
     /// @throw BadSocketInfo When socket configuration is invalid.
     /// @throw SocketError When socket operation fails.
@@ -85,7 +85,7 @@ public:
     /// @brief Shuts down any open unix control sockets.
     ///
     /// @note This function in used internally by @ref closeCommandSockets and it
-    /// should not be used directly, except for unittests.
+    /// should not be used directly, except for unit tests.
     ///
     /// @param config Configuration information for the unix control socket.
     void closeCommandSocket(UnixSocketInfoPtr info = UnixSocketInfoPtr());