]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1706] Added TLS server side to HA
authorFrancis Dupont <fdupont@isc.org>
Tue, 31 May 2022 22:26:06 +0000 (00:26 +0200)
committerTomek Mrugalski <tomek@isc.org>
Thu, 23 Jun 2022 15:31:14 +0000 (17:31 +0200)
src/hooks/dhcp/high_availability/ha_config.cc
src/hooks/dhcp/high_availability/ha_service.cc

index e673fddff4a573026a35b610f153638602d92317..c56d9691d5077d578bea29bfffbaa2f99a723805 100644 (file)
@@ -334,8 +334,13 @@ HAConfig::validate() {
                               << " is missing or empty: all or none of"
                               << " TLS parameters must be set");
                 }
+                TlsRole tls_role = TlsRole::CLIENT;
+                // The peer entry for myself will be used for the server side.
+                if (p->second->getName() == getThisServerName()) {
+                    tls_role = TlsRole::SERVER;
+                }
                 TlsContext::configure(p->second->tls_context_,
-                                      TlsRole::CLIENT,
+                                      tls_role,
                                       ca.get(),
                                       cert.get(),
                                       key.get());
index bdb9996650c8f27996ed417e0bc151dc65821662..416bf052f3703229177e22b4e55acf8b1b40e58a 100644 (file)
@@ -108,9 +108,12 @@ HAService::HAService(const IOServicePtr& io_service, const NetworkStatePtr& netw
             // Fetch how many threads the listener will use.
             uint32_t listener_threads = config_->getHttpListenerThreads();
 
+            // Fetch the TLS context.
+            auto tls_context = config_->getThisServerConfig()->getTlsContext();
+
             // Instantiate the listener.
             listener_.reset(new CmdHttpListener(server_address, my_url.getPort(),
-                                                listener_threads));
+                                                listener_threads, tls_context));
         }
     }