[ 
https://issues.apache.org/jira/browse/HADOOP-16524?focusedWorklogId=521902&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-521902
 ]

ASF GitHub Bot logged work on HADOOP-16524:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Dec/20 22:17
            Start Date: 08/Dec/20 22:17
    Worklog Time Spent: 10m 
      Work Description: 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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 521902)
    Time Spent: 1h 10m  (was: 1h)

> Automatic keystore reloading for HttpServer2
> --------------------------------------------
>
>                 Key: HADOOP-16524
>                 URL: https://issues.apache.org/jira/browse/HADOOP-16524
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Kihwal Lee
>            Assignee: Kihwal Lee
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HADOOP-16524.patch
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Jetty 9 simplified reloading of keystore.   This allows hadoop daemon's SSL 
> cert to be updated in place without having to restart the service.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to