You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ff...@apache.org on 2020/01/13 18:49:00 UTC

[karaf] branch karaf-4.2.x updated: [KARAF-6594]introduce new property enabledCipherSuites for org.apache.karaf.management.cfg

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch karaf-4.2.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.2.x by this push:
     new 533b274  [KARAF-6594]introduce new property enabledCipherSuites for org.apache.karaf.management.cfg
533b274 is described below

commit 533b2742673b2e3f293a9a97014978a34d91cb9f
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Mon Jan 13 13:48:14 2020 -0500

    [KARAF-6594]introduce new property enabledCipherSuites for org.apache.karaf.management.cfg
    
    (cherry picked from commit 15fabb930ae390be099ff8a6b522ca85dd041224)
---
 .../karaf/management/ConnectorServerFactory.java   | 24 ++++++++++++++++++++--
 .../karaf/management/internal/Activator.java       |  2 ++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/management/server/src/main/java/org/apache/karaf/management/ConnectorServerFactory.java b/management/server/src/main/java/org/apache/karaf/management/ConnectorServerFactory.java
index 204c3b5..ed8e248 100644
--- a/management/server/src/main/java/org/apache/karaf/management/ConnectorServerFactory.java
+++ b/management/server/src/main/java/org/apache/karaf/management/ConnectorServerFactory.java
@@ -75,6 +75,7 @@ public class ConnectorServerFactory {
     private String algorithm;
     private String secureProtocol;
     private String[] enabledProtocols;
+    private String[] enabledCipherSuites;
     private String keyStore;
     private String trustStore;
     private String keyAlias;
@@ -381,7 +382,8 @@ public class ConnectorServerFactory {
 
     private void setupSsl() throws GeneralSecurityException {
         SSLServerSocketFactory sssf = keystoreManager.createSSLServerFactory(null, secureProtocol, algorithm, keyStore, keyAlias, trustStore,keyStoreAvailabilityTimeout);
-        RMIServerSocketFactory rssf = new KarafSslRMIServerSocketFactory(sssf, isClientAuth(), getRmiServerHost(), getEnabledProtocols());
+        RMIServerSocketFactory rssf = new KarafSslRMIServerSocketFactory(sssf, isClientAuth(), getRmiServerHost(), getEnabledProtocols(),
+                                                                         getEnabledCipherSuites());
         RMIClientSocketFactory rcsf = new SslRMIClientSocketFactory();
         environment.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, rssf);
         environment.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, rcsf);
@@ -399,12 +401,16 @@ public class ConnectorServerFactory {
         private boolean clientAuth;
         private String rmiServerHost;
         private String[] enabledProtocols;
+        private String[] enabledCipherSuites;
 
-        public KarafSslRMIServerSocketFactory(SSLServerSocketFactory sssf, boolean clientAuth, String rmiServerHost, String[] enabledProtocols) {
+        public KarafSslRMIServerSocketFactory(SSLServerSocketFactory sssf, boolean clientAuth, String rmiServerHost, 
+                                              String[] enabledProtocols,
+                                              String[] enabledCipherSuites) {
             this.sssf = sssf;
             this.clientAuth = clientAuth;
             this.rmiServerHost = rmiServerHost;
             this.enabledProtocols = enabledProtocols;
+            this.enabledCipherSuites = enabledCipherSuites;
         }
 
         public ServerSocket createServerSocket(int port) throws IOException {
@@ -415,6 +421,9 @@ public class ConnectorServerFactory {
                 if (this.enabledProtocols != null && this.enabledProtocols.length > 0) {
                     ss.setEnabledProtocols(this.enabledProtocols);
                 }
+                if (this.enabledCipherSuites != null && this.enabledCipherSuites.length > 0) {
+                    ss.setEnabledCipherSuites(this.enabledCipherSuites);
+                }
                 return new LocalOnlySSLServerSocket(ss);
             } else {
                 final SSLServerSocket ss = (SSLServerSocket) sssf.createServerSocket(port, 50, InetAddress.getByName(rmiServerHost));
@@ -422,6 +431,9 @@ public class ConnectorServerFactory {
                 if (this.enabledProtocols != null && this.enabledProtocols.length > 0) {
                     ss.setEnabledProtocols(this.enabledProtocols);
                 }
+                if (this.enabledCipherSuites != null && this.enabledCipherSuites.length > 0) {
+                    ss.setEnabledCipherSuites(this.enabledCipherSuites);
+                }
                 return ss;
             }
         }
@@ -746,4 +758,12 @@ public class ConnectorServerFactory {
         this.enabledProtocols = enabledProtocols;
     }
 
+    public String[] getEnabledCipherSuites() {
+        return enabledCipherSuites;
+    }
+
+    public void setEnabledCipherSuites(String[] enabledCipherSuites) {
+        this.enabledCipherSuites = enabledCipherSuites;
+    }
+
 }
diff --git a/management/server/src/main/java/org/apache/karaf/management/internal/Activator.java b/management/server/src/main/java/org/apache/karaf/management/internal/Activator.java
index 586c392..e7ab240 100644
--- a/management/server/src/main/java/org/apache/karaf/management/internal/Activator.java
+++ b/management/server/src/main/java/org/apache/karaf/management/internal/Activator.java
@@ -116,6 +116,7 @@ public class Activator extends BaseActivator implements ManagedService {
         String secureAlgorithm = getString("secureAlgorithm", "default");
         String secureProtocol = getString("secureProtocol", "TLS");
         String[] enabledProtocols = getStringArray("enabledProtocols", null);
+        String[] enabledCipherSuites = getStringArray("enabledCipherSuites", null);
         String keyStore = getString("keyStore", "karaf.ks");
         String keyAlias = getString("keyAlias", "karaf");
         String trustStore = getString("trustStore", "karaf.ts");
@@ -170,6 +171,7 @@ public class Activator extends BaseActivator implements ManagedService {
             connectorServerFactory.setAlgorithm(secureAlgorithm);
             connectorServerFactory.setSecureProtocol(secureProtocol);
             connectorServerFactory.setEnabledProtocols(enabledProtocols);
+            connectorServerFactory.setEnabledCipherSuites(enabledCipherSuites);
             connectorServerFactory.setKeyStore(keyStore);
             connectorServerFactory.setKeyAlias(keyAlias);
             connectorServerFactory.setTrustStore(trustStore);