bolerio commented on a change in pull request #2470:
URL: https://github.com/apache/hadoop/pull/2470#discussion_r538848840



##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
##########
@@ -569,12 +577,45 @@ private ServerConnector createHttpsChannelConnector(
       }
 
       setEnabledProtocols(sslContextFactory);
+
+      long storesReloadInterval =
+          
conf.getLong(FileBasedKeyStoresFactory.SSL_STORES_RELOAD_INTERVAL_TPL_KEY,
+              FileBasedKeyStoresFactory.DEFAULT_SSL_STORES_RELOAD_INTERVAL);
+
+      this.configurationChangeMonitor = storesReloadInterval > 0

Review comment:
       Fixed.

##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
##########
@@ -569,12 +577,45 @@ private ServerConnector createHttpsChannelConnector(
       }
 
       setEnabledProtocols(sslContextFactory);
+
+      long storesReloadInterval =
+          
conf.getLong(FileBasedKeyStoresFactory.SSL_STORES_RELOAD_INTERVAL_TPL_KEY,
+              FileBasedKeyStoresFactory.DEFAULT_SSL_STORES_RELOAD_INTERVAL);
+
+      this.configurationChangeMonitor = storesReloadInterval > 0
+          ? 
Optional.of(this.makeConfigurationChangeMonitor(storesReloadInterval, 
sslContextFactory))
+          : Optional.empty();
+
       conn.addFirstConnectionFactory(new 
SslConnectionFactory(sslContextFactory,
           HttpVersion.HTTP_1_1.asString()));
 
       return conn;
     }
 
+    private java.util.Timer makeConfigurationChangeMonitor(long reloadInterval,
+                                                           
SslContextFactory.Server sslContextFactory) {

Review comment:
       Fixed.

##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
##########
@@ -569,12 +577,45 @@ private ServerConnector createHttpsChannelConnector(
       }
 
       setEnabledProtocols(sslContextFactory);
+
+      long storesReloadInterval =
+          
conf.getLong(FileBasedKeyStoresFactory.SSL_STORES_RELOAD_INTERVAL_TPL_KEY,
+              FileBasedKeyStoresFactory.DEFAULT_SSL_STORES_RELOAD_INTERVAL);
+
+      this.configurationChangeMonitor = storesReloadInterval > 0
+          ? 
Optional.of(this.makeConfigurationChangeMonitor(storesReloadInterval, 
sslContextFactory))
+          : Optional.empty();
+
       conn.addFirstConnectionFactory(new 
SslConnectionFactory(sslContextFactory,
           HttpVersion.HTTP_1_1.asString()));
 
       return conn;
     }
 
+    private java.util.Timer makeConfigurationChangeMonitor(long reloadInterval,
+                                                           
SslContextFactory.Server sslContextFactory) {
+      java.util.Timer timer = new java.util.Timer("SSL Certificates Store 
Monitor", true);
+      //
+      // The Jetty SSLContextFactory provides a 'reload' method which will 
reload both
+      // truststore and keystore certificates.
+      //
+      timer.schedule(new FileMonitoringTimerTask(
+              Paths.get(keyStore),
+              path -> {
+                LOG.info("Reloading certificates from store keystore " + 
keyStore);
+                try {
+                  sslContextFactory.reload(factory -> { });
+                }
+                catch (Exception ex) {

Review comment:
       Fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to