pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] rdhabalia commented on a change in pull request #3568: Refresh Certs every X minutes
Date Mon, 18 Feb 2019 18:24:05 GMT
rdhabalia commented on a change in pull request #3568: Refresh Certs every X minutes
URL: https://github.com/apache/pulsar/pull/3568#discussion_r257791548
 
 

 ##########
 File path: pulsar-discovery-service/src/main/java/org/apache/pulsar/discovery/service/ServiceChannelInitializer.java
 ##########
 @@ -34,29 +33,30 @@
 public class ServiceChannelInitializer extends ChannelInitializer<SocketChannel> {
 
     public static final String TLS_HANDLER = "tls";
-    private final ServiceConfig serviceConfig;
     private final DiscoveryService discoveryService;
-    private final SslContext sslCtx;
+    private final boolean enableTls;
+    private final ServerSslContextRefresher sslCtxRefresher;
 
-    public ServiceChannelInitializer(DiscoveryService discoveryService, ServiceConfig serviceConfig,
boolean enableTLS)
+    public ServiceChannelInitializer(DiscoveryService discoveryService, ServiceConfig serviceConfig,
boolean e)
             throws Exception {
         super();
-        this.serviceConfig = serviceConfig;
         this.discoveryService = discoveryService;
-        if (enableTLS) {
-            this.sslCtx = SecurityUtility.createNettySslContextForServer(serviceConfig.isTlsAllowInsecureConnection(),
+        this.enableTls = e;
+        if (this.enableTls) {
+            sslCtxRefresher = new ServerSslContextRefresher(serviceConfig.isTlsAllowInsecureConnection(),
                     serviceConfig.getTlsTrustCertsFilePath(), serviceConfig.getTlsCertificateFilePath(),
                     serviceConfig.getTlsKeyFilePath(), serviceConfig.getTlsCiphers(), serviceConfig.getTlsProtocols(),
-                    serviceConfig.getTlsRequireTrustedClientCertOnConnect());
+                    serviceConfig.getTlsRequireTrustedClientCertOnConnect(),
+                    serviceConfig.getCertRefreshCheckDurationInMins());
         } else {
-            this.sslCtx = null;
+            this.sslCtxRefresher = null;
         }
     }
 
     @Override
     protected void initChannel(SocketChannel ch) throws Exception {
-        if (sslCtx != null) {
-            ch.pipeline().addLast(TLS_HANDLER, sslCtx.newHandler(ch.alloc()));
+        if (this.enableTls) {
 
 Review comment:
   same here.. can we add null check for `sslCtxRefresher.get()`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message