http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java index 3f60778..e92d0b6 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java @@ -850,7 +850,7 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeGetter(name = CLUSTER_SSL_PROTOCOLS) - String getClusterSSLProtocols(); + String[] getClusterSSLProtocols(); /** * Sets the value of the {@link ConfigurationProperties#CLUSTER_SSL_PROTOCOLS} @@ -858,7 +858,7 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeSetter(name = CLUSTER_SSL_PROTOCOLS) - void setClusterSSLProtocols(String protocols); + void setClusterSSLProtocols(String[] protocols); /** * The default {@link ConfigurationProperties#CLUSTER_SSL_PROTOCOLS} value. @@ -870,7 +870,7 @@ public interface DistributionConfig extends Config, LogConfig { * The name of the {@link ConfigurationProperties#CLUSTER_SSL_PROTOCOLS} property */ @Deprecated - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String CLUSTER_SSL_PROTOCOLS_NAME = CLUSTER_SSL_PROTOCOLS; /** @@ -879,7 +879,7 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeGetter(name = CLUSTER_SSL_CIPHERS) - String getClusterSSLCiphers(); + String[] getClusterSSLCiphers(); /** * Sets the value of the {@link ConfigurationProperties#CLUSTER_SSL_CIPHERS} @@ -887,7 +887,7 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeSetter(name = CLUSTER_SSL_CIPHERS) - void setClusterSSLCiphers(String ciphers); + void setClusterSSLCiphers(String[] ciphers); /** * The default {@link ConfigurationProperties#CLUSTER_SSL_CIPHERS} value. @@ -899,7 +899,7 @@ public interface DistributionConfig extends Config, LogConfig { * The name of the {@link ConfigurationProperties#CLUSTER_SSL_CIPHERS} property */ @Deprecated - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String CLUSTER_SSL_CIPHERS_NAME = CLUSTER_SSL_CIPHERS; /** @@ -2592,16 +2592,16 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeGetter(name = JMX_MANAGER_SSL_PROTOCOLS) - String getJmxManagerSSLProtocols(); + String[] getJmxManagerSSLProtocols(); /** * Sets the value of the {@link ConfigurationProperties#JMX_MANAGER_SSL_PROTOCOLS} * property. - * @deprecated Geode 1.0 use {@link #setClusterSSLProtocols(String)} + * @deprecated Geode 1.0 use {@link #setClusterSSLProtocols(String[])} */ @Deprecated @ConfigAttributeSetter(name = JMX_MANAGER_SSL_PROTOCOLS) - void setJmxManagerSSLProtocols(String protocols); + void setJmxManagerSSLProtocols(String[] protocols); /** * The default {@link ConfigurationProperties#JMX_MANAGER_SSL_PROTOCOLS} value. @@ -2616,7 +2616,7 @@ public interface DistributionConfig extends Config, LogConfig { * @deprecated Geode 1.0 use {@link com.gemstone.gemfire.distributed.ConfigurationProperties#CLUSTER_SSL_PROTOCOLS} */ @Deprecated - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String JMX_MANAGER_SSL_PROTOCOLS_NAME = JMX_MANAGER_SSL_PROTOCOLS; /** @@ -2626,16 +2626,16 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeGetter(name = JMX_MANAGER_SSL_CIPHERS) - String getJmxManagerSSLCiphers(); + String[] getJmxManagerSSLCiphers(); /** * Sets the value of the {@link ConfigurationProperties#JMX_MANAGER_SSL_CIPHERS} * property. - * @deprecated Geode 1.0 use {@link #setClusterSSLCiphers(String)} + * @deprecated Geode 1.0 use {@link #setClusterSSLCiphers(String[])} */ @Deprecated @ConfigAttributeSetter(name = JMX_MANAGER_SSL_CIPHERS) - void setJmxManagerSSLCiphers(String ciphers); + void setJmxManagerSSLCiphers(String[] ciphers); /** * The default {@link ConfigurationProperties#JMX_MANAGER_SSL_CIPHERS} value. @@ -2650,7 +2650,7 @@ public interface DistributionConfig extends Config, LogConfig { * @deprecated Geode 1.0 use {@link com.gemstone.gemfire.distributed.ConfigurationProperties#CLUSTER_SSL_CIPHERS} */ @Deprecated - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String JMX_MANAGER_SSL_CIPHERS_NAME = JMX_MANAGER_SSL_CIPHERS; /** @@ -3209,16 +3209,16 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeGetter(name = HTTP_SERVICE_SSL_PROTOCOLS) - String getHttpServiceSSLProtocols(); + String[] getHttpServiceSSLProtocols(); /** * Sets the value of the {@link ConfigurationProperties#HTTP_SERVICE_SSL_PROTOCOLS} * property. - * @deprecated Geode 1.0 use {@link #setClusterSSLProtocols(String)} + * @deprecated Geode 1.0 use {@link #setClusterSSLProtocols(String[])} */ @Deprecated @ConfigAttributeSetter(name = HTTP_SERVICE_SSL_PROTOCOLS) - void setHttpServiceSSLProtocols(String protocols); + void setHttpServiceSSLProtocols(String[] protocols); /** * The default {@link ConfigurationProperties#HTTP_SERVICE_SSL_PROTOCOLS} value. @@ -3234,7 +3234,7 @@ public interface DistributionConfig extends Config, LogConfig { * @deprecated Geode 1.0 use {@link com.gemstone.gemfire.distributed.ConfigurationProperties#CLUSTER_SSL_PROTOCOLS} */ @Deprecated - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String HTTP_SERVICE_SSL_PROTOCOLS_NAME = HTTP_SERVICE_SSL_PROTOCOLS; /** @@ -3244,16 +3244,16 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeGetter(name = HTTP_SERVICE_SSL_CIPHERS) - String getHttpServiceSSLCiphers(); + String[] getHttpServiceSSLCiphers(); /** * Sets the value of the {@link ConfigurationProperties#HTTP_SERVICE_SSL_CIPHERS} * property. - * @deprecated Geode 1.0 use {@link #setClusterSSLCiphers(String)} + * @deprecated Geode 1.0 use {@link #setClusterSSLCiphers(String[])} */ @Deprecated @ConfigAttributeSetter(name = HTTP_SERVICE_SSL_CIPHERS) - void setHttpServiceSSLCiphers(String ciphers); + void setHttpServiceSSLCiphers(String[] ciphers); /** * The default {@link ConfigurationProperties#HTTP_SERVICE_SSL_CIPHERS} value. @@ -3269,7 +3269,7 @@ public interface DistributionConfig extends Config, LogConfig { * @deprecated Geode 1.0 use {@link com.gemstone.gemfire.distributed.ConfigurationProperties#CLUSTER_SSL_CIPHERS} */ @Deprecated - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String HTTP_SERVICE_SSL_CIPHERS_NAME = HTTP_SERVICE_SSL_CIPHERS; /** @@ -3565,14 +3565,14 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeGetter(name = SERVER_SSL_PROTOCOLS) - String getServerSSLProtocols(); + String[] getServerSSLProtocols(); /** * Sets the value of the {@link ConfigurationProperties#SERVER_SSL_PROTOCOLS} * property. */ @ConfigAttributeSetter(name = SERVER_SSL_PROTOCOLS) - void setServerSSLProtocols(String protocols); + void setServerSSLProtocols(String[] protocols); /** * The default {@link ConfigurationProperties#SERVER_SSL_PROTOCOLS} value. @@ -3587,7 +3587,7 @@ public interface DistributionConfig extends Config, LogConfig { * @deprecated Geode 1.0 use {@link com.gemstone.gemfire.distributed.ConfigurationProperties#CLUSTER_SSL_PROTOCOLS} */ @Deprecated - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String SERVER_SSL_PROTOCOLS_NAME = SERVER_SSL_PROTOCOLS; /** @@ -3597,16 +3597,16 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeGetter(name = SERVER_SSL_CIPHERS) - String getServerSSLCiphers(); + String[] getServerSSLCiphers(); /** * Sets the value of the {@link ConfigurationProperties#SERVER_SSL_CIPHERS} * property. - * @deprecated Geode 1.0 use {@link #setClusterSSLCiphers(String)}Â + * @deprecated Geode 1.0 use {@link #setClusterSSLCiphers(String[])}Â */ @Deprecated @ConfigAttributeSetter(name = SERVER_SSL_CIPHERS) - void setServerSSLCiphers(String ciphers); + void setServerSSLCiphers(String[] ciphers); /** * The default {@link ConfigurationProperties#SERVER_SSL_CIPHERS} value. @@ -3621,7 +3621,7 @@ public interface DistributionConfig extends Config, LogConfig { * @deprecated Geode 1.0 use {@link com.gemstone.gemfire.distributed.ConfigurationProperties#CLUSTER_SSL_CIPHERS}Â */ @Deprecated - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String SERVER_SSL_CIPHERS_NAME = SERVER_SSL_CIPHERS; /** @@ -3873,7 +3873,7 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeGetter(name = GATEWAY_SSL_PROTOCOLS) - String getGatewaySSLProtocols(); + String[] getGatewaySSLProtocols(); /** * Sets the value of the {@link ConfigurationProperties#GATEWAY_SSL_PROTOCOLS} @@ -3882,7 +3882,7 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeSetter(name = GATEWAY_SSL_PROTOCOLS) - void setGatewaySSLProtocols(String protocols); + void setGatewaySSLProtocols(String[] protocols); /** * The default {@link ConfigurationProperties#GATEWAY_SSL_PROTOCOLS} value. @@ -3896,7 +3896,7 @@ public interface DistributionConfig extends Config, LogConfig { * @deprecated Geode 1.0 use {@link com.gemstone.gemfire.distributed.ConfigurationProperties#CLUSTER_SSL_PROTOCOLS} */ @Deprecated - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String GATEWAY_SSL_PROTOCOLS_NAME = GATEWAY_SSL_PROTOCOLS; /** @@ -3906,16 +3906,16 @@ public interface DistributionConfig extends Config, LogConfig { */ @Deprecated @ConfigAttributeGetter(name = GATEWAY_SSL_CIPHERS) - String getGatewaySSLCiphers(); + String[] getGatewaySSLCiphers(); /** * Sets the value of the {@link ConfigurationProperties#GATEWAY_SSL_CIPHERS} * property. - * @deprecated Geode 1.0 use {@link #setClusterSSLCiphers(String)}Â + * @deprecated Geode 1.0 use {@link #setClusterSSLCiphers(String[])}Â */ @Deprecated @ConfigAttributeSetter(name = GATEWAY_SSL_CIPHERS) - void setGatewaySSLCiphers(String ciphers); + void setGatewaySSLCiphers(String[] ciphers); /** * The default {@link ConfigurationProperties#GATEWAY_SSL_CIPHERS} value. @@ -3929,7 +3929,7 @@ public interface DistributionConfig extends Config, LogConfig { * @deprecated Geode 1.0 use {@link com.gemstone.gemfire.distributed.ConfigurationProperties#CLUSTER_SSL_CIPHERS}Â */ @Deprecated - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String GATEWAY_SSL_CIPHERS_NAME = GATEWAY_SSL_CIPHERS; /** @@ -4365,19 +4365,19 @@ public interface DistributionConfig extends Config, LogConfig { * property. */ @ConfigAttributeGetter(name = SSL_PROTOCOLS) - String getSSLProtocols(); + String[] getSSLProtocols(); /** * Sets the value of the {@link ConfigurationProperties#SSL_PROTOCOLS} * property. */ @ConfigAttributeSetter(name = SSL_PROTOCOLS) - void setSSLProtocols(String protocols); + void setSSLProtocols(String[] protocols); /** * The name of the {@link ConfigurationProperties#SSL_PROTOCOLS} property */ - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String SSL_PROTOCOLS_NAME = SSL_PROTOCOLS; /** @@ -4385,19 +4385,19 @@ public interface DistributionConfig extends Config, LogConfig { * property. */ @ConfigAttributeGetter(name = SSL_CIPHERS) - String getSSLCiphers(); + String[] getSSLCiphers(); /** * Sets the value of the {@link ConfigurationProperties#SSL_CIPHERS} * property. */ @ConfigAttributeSetter(name = SSL_CIPHERS) - void setSSLCiphers(String ciphers); + void setSSLCiphers(String[] ciphers); /** * The name of the {@link ConfigurationProperties#SSL_CIPHERS} property */ - @ConfigAttribute(type = String.class) + @ConfigAttribute(type = String[].class) String SSL_CIPHERS_NAME = SSL_CIPHERS; /**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java index a5a9aa6..942322b 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java @@ -48,6 +48,7 @@ import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import com.gemstone.gemfire.internal.net.SSLEnabledComponent; import com.gemstone.gemfire.internal.net.SocketCreator; import com.gemstone.gemfire.internal.process.ProcessLauncherContext; +import com.gemstone.gemfire.management.internal.SSLUtil; import com.gemstone.gemfire.memcached.GemFireMemcachedServer; /** @@ -183,9 +184,9 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement @Deprecated private boolean clusterSSLEnabled = DEFAULT_SSL_ENABLED; @Deprecated - private String clusterSSLProtocols = DEFAULT_SSL_PROTOCOLS; + private String[] clusterSSLProtocols = new String[] { DEFAULT_SSL_PROTOCOLS }; @Deprecated - private String clusterSSLCiphers = DEFAULT_SSL_CIPHERS; + private String[] clusterSSLCiphers = new String[] { DEFAULT_SSL_CIPHERS }; @Deprecated private boolean clusterSSLRequireAuthentication = DEFAULT_SSL_REQUIRE_AUTHENTICATION; @Deprecated @@ -458,9 +459,9 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement @Deprecated private boolean jmxManagerSslRequireAuthentication = DEFAULT_JMX_MANAGER_SSL_REQUIRE_AUTHENTICATION; @Deprecated - private String jmxManagerSslProtocols = DEFAULT_JMX_MANAGER_SSL_PROTOCOLS; + private String[] jmxManagerSslProtocols = new String[] { DEFAULT_JMX_MANAGER_SSL_PROTOCOLS }; @Deprecated - private String jmxManagerSslCiphers = DEFAULT_JMX_MANAGER_SSL_CIPHERS; + private String[] jmxManagerSslCiphers = new String[] { DEFAULT_JMX_MANAGER_SSL_CIPHERS }; @Deprecated private Properties jmxManagerSslProperties = new Properties(); @Deprecated @@ -481,9 +482,9 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement @Deprecated private boolean serverSslRequireAuthentication = DEFAULT_SERVER_SSL_REQUIRE_AUTHENTICATION; @Deprecated - private String serverSslProtocols = DEFAULT_SERVER_SSL_PROTOCOLS; + private String[] serverSslProtocols = new String[] { DEFAULT_SERVER_SSL_PROTOCOLS }; @Deprecated - private String serverSslCiphers = DEFAULT_SERVER_SSL_CIPHERS; + private String[] serverSslCiphers = new String[] { DEFAULT_SERVER_SSL_CIPHERS }; @Deprecated private Properties serverSslProperties = new Properties(); @Deprecated @@ -504,9 +505,9 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement @Deprecated private boolean gatewaySslRequireAuthentication = DEFAULT_GATEWAY_SSL_REQUIRE_AUTHENTICATION; @Deprecated - private String gatewaySslProtocols = DEFAULT_GATEWAY_SSL_PROTOCOLS; + private String[] gatewaySslProtocols = new String[] { DEFAULT_GATEWAY_SSL_PROTOCOLS }; @Deprecated - private String gatewaySslCiphers = DEFAULT_GATEWAY_SSL_CIPHERS; + private String[] gatewaySslCiphers = new String[] { DEFAULT_GATEWAY_SSL_CIPHERS }; @Deprecated private Properties gatewaySslProperties = new Properties(); @Deprecated @@ -528,9 +529,9 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement @Deprecated private boolean httpServiceSSLRequireAuthentication = DEFAULT_HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION; @Deprecated - private String httpServiceSSLProtocols = DEFAULT_HTTP_SERVICE_SSL_PROTOCOLS; + private String[] httpServiceSSLProtocols = new String[] { DEFAULT_HTTP_SERVICE_SSL_PROTOCOLS }; @Deprecated - private String httpServiceSSLCiphers = DEFAULT_HTTP_SERVICE_SSL_CIPHERS; + private String[] httpServiceSSLCiphers = new String[] { DEFAULT_HTTP_SERVICE_SSL_CIPHERS }; @Deprecated private Properties httpServiceSSLProperties = new Properties(); @Deprecated @@ -548,8 +549,8 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement private SSLEnabledComponent[] sslEnabledComponents = DEFAULT_SSL_ENABLED_COMPONENTS; - private String sslProtocols = DEFAULT_SSL_PROTOCOLS; - private String sslCiphers = DEFAULT_SSL_CIPHERS; + private String[] sslProtocols = new String[] { DEFAULT_SSL_PROTOCOLS }; + private String[] sslCiphers = new String[] { DEFAULT_SSL_CIPHERS }; private boolean sslRequireAuthentication = DEFAULT_SSL_REQUIRE_AUTHENTICATION; private String sslKeyStore = DEFAULT_SSL_KEYSTORE; private String sslKeyStoreType = DEFAULT_CLUSTER_SSL_KEYSTORE_TYPE; @@ -1457,8 +1458,13 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement continue; } Object propVal = me.getValue(); - if (propVal != null && (propVal instanceof String)) { // weed out extraneous non-string properties - this.setAttribute(propName, ((String) propVal).trim(), this.sourceMap.get(propName)); + if (isLegacySSLCipherOrProtocol(propName)) { + propVal = SSLUtil.stringToArray((String) propVal); + setAttributeObject(propName, propVal, this.sourceMap.get(propName)); + } else { + if (propVal != null && (propVal instanceof String)) { // weed out extraneous non-string properties + this.setAttribute(propName, ((String) propVal).trim(), this.sourceMap.get(propName)); + } } } if (props.containsKey(CLUSTER_SSL_ENABLED)) { @@ -1477,6 +1483,15 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement this.modifiable = false; } + private boolean isLegacySSLCipherOrProtocol(final String propName) { + if (propName.contains("-ciphers") || propName.contains("-protocols")) { + if (!ConfigurationProperties.SSL_CIPHERS.equals(propName) && !ConfigurationProperties.SSL_PROTOCOLS.equals(propName)) { + return true; + } + } + return false; + } + public void close() { // Clear the extra stuff from System properties Properties props = System.getProperties(); @@ -1623,11 +1638,11 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement return this.clusterSSLEnabled; } - public String getClusterSSLProtocols() { + public String[] getClusterSSLProtocols() { return this.clusterSSLProtocols; } - public String getClusterSSLCiphers() { + public String[] getClusterSSLCiphers() { return this.clusterSSLCiphers; } @@ -1903,12 +1918,12 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement this.clusterSSLEnabled = (Boolean) value; } - public void setClusterSSLProtocols(String value) { - this.clusterSSLProtocols = (String) value; + public void setClusterSSLProtocols(String[] value) { + this.clusterSSLProtocols = value; } - public void setClusterSSLCiphers(String value) { - this.clusterSSLCiphers = (String) value; + public void setClusterSSLCiphers(String[] value) { + this.clusterSSLCiphers = value; } public void setClusterSSLRequireAuthentication(boolean value) { @@ -2313,22 +2328,22 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement } @Override - public String getJmxManagerSSLProtocols() { + public String[] getJmxManagerSSLProtocols() { return this.jmxManagerSslProtocols; } @Override - public void setJmxManagerSSLProtocols(String protocols) { + public void setJmxManagerSSLProtocols(String[] protocols) { this.jmxManagerSslProtocols = protocols; } @Override - public String getJmxManagerSSLCiphers() { + public String[] getJmxManagerSSLCiphers() { return this.jmxManagerSslCiphers; } @Override - public void setJmxManagerSSLCiphers(String ciphers) { + public void setJmxManagerSSLCiphers(String[] ciphers) { this.jmxManagerSslCiphers = ciphers; } @@ -2555,22 +2570,22 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement } @Override - public String getSSLProtocols() { + public String[] getSSLProtocols() { return sslProtocols; } @Override - public void setSSLProtocols(final String sslProtocols) { + public void setSSLProtocols(final String[] sslProtocols) { this.sslProtocols = sslProtocols; } @Override - public String getSSLCiphers() { + public String[] getSSLCiphers() { return sslCiphers; } @Override - public void setSSLCiphers(final String sslCiphers) { + public void setSSLCiphers(final String[] sslCiphers) { this.sslCiphers = sslCiphers; } @@ -3723,23 +3738,23 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement } @Override - public String getServerSSLProtocols() { + public String[] getServerSSLProtocols() { return this.serverSslProtocols; } @Override - public void setServerSSLProtocols(String protocols) { - this.serverSslProtocols = (String) protocols; + public void setServerSSLProtocols(String[] protocols) { + this.serverSslProtocols = protocols; } @Override - public String getServerSSLCiphers() { + public String[] getServerSSLCiphers() { return this.serverSslCiphers; } @Override - public void setServerSSLCiphers(String ciphers) { - this.serverSslCiphers = (String) ciphers; + public void setServerSSLCiphers(String[] ciphers) { + this.serverSslCiphers = ciphers; } public void setServerSSLKeyStore(String value) { @@ -3814,23 +3829,23 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement } @Override - public String getGatewaySSLProtocols() { + public String[] getGatewaySSLProtocols() { return this.gatewaySslProtocols; } @Override - public void setGatewaySSLProtocols(String protocols) { - this.gatewaySslProtocols = (String) protocols; + public void setGatewaySSLProtocols(String[] protocols) { + this.gatewaySslProtocols = protocols; } @Override - public String getGatewaySSLCiphers() { + public String[] getGatewaySSLCiphers() { return this.gatewaySslCiphers; } @Override - public void setGatewaySSLCiphers(String ciphers) { - this.gatewaySslCiphers = (String) ciphers; + public void setGatewaySSLCiphers(String[] ciphers) { + this.gatewaySslCiphers = ciphers; } public void setGatewaySSLKeyStore(String value) { @@ -3905,22 +3920,22 @@ public class DistributionConfigImpl extends AbstractDistributionConfig implement } @Override - public String getHttpServiceSSLProtocols() { + public String[] getHttpServiceSSLProtocols() { return httpServiceSSLProtocols; } @Override - public void setHttpServiceSSLProtocols(String httpServiceSSLProtocols) { + public void setHttpServiceSSLProtocols(String[] httpServiceSSLProtocols) { this.httpServiceSSLProtocols = httpServiceSSLProtocols; } @Override - public String getHttpServiceSSLCiphers() { + public String[] getHttpServiceSSLCiphers() { return httpServiceSSLCiphers; } @Override - public void setHttpServiceSSLCiphers(String httpServiceSSLCiphers) { + public void setHttpServiceSSLCiphers(String[] httpServiceSSLCiphers) { this.httpServiceSSLCiphers = httpServiceSSLCiphers; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/SSLConfig.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/SSLConfig.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/SSLConfig.java index ebf3a7e..e3032c4 100755 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/SSLConfig.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/SSLConfig.java @@ -31,8 +31,8 @@ import com.gemstone.gemfire.management.internal.SSLUtil; public class SSLConfig { private boolean enabled = DistributionConfig.DEFAULT_SSL_ENABLED; - private String protocols = DistributionConfig.DEFAULT_SSL_PROTOCOLS; - private String ciphers = DistributionConfig.DEFAULT_SSL_CIPHERS; + private String[] protocols = new String[] { DistributionConfig.DEFAULT_SSL_PROTOCOLS }; + private String[] ciphers = new String[] { DistributionConfig.DEFAULT_SSL_CIPHERS }; private boolean requireAuth = DistributionConfig.DEFAULT_SSL_REQUIRE_AUTHENTICATION; private String keystore = DistributionConfig.DEFAULT_SSL_KEYSTORE; private String keystoreType = DistributionConfig.DEFAULT_CLUSTER_SSL_KEYSTORE_TYPE; @@ -108,27 +108,19 @@ public class SSLConfig { this.enabled = enabled; } - public String getProtocols() { + public String[] getProtocols() { return this.protocols; } - public String[] getProtocolsAsStringArray() { - return SSLUtil.readArray(this.protocols); - } - - public void setProtocols(String protocols) { + public void setProtocols(String[] protocols) { this.protocols = protocols; } - public String getCiphers() { + public String[] getCiphers() { return this.ciphers; } - public String[] getCiphersAsStringArray() { - return SSLUtil.readArray(this.ciphers); - } - - public void setCiphers(String ciphers) { + public void setCiphers(String[] ciphers) { this.ciphers = ciphers; } @@ -149,7 +141,6 @@ public class SSLConfig { } - public Properties getProperties() { return this.properties; } @@ -186,8 +177,8 @@ public class SSLConfig { props.setProperty(CLUSTER_SSL_ENABLED, String.valueOf(this.enabled)); if (this.enabled) { - props.setProperty(CLUSTER_SSL_PROTOCOLS, this.protocols); - props.setProperty(CLUSTER_SSL_CIPHERS, this.ciphers); + props.setProperty(CLUSTER_SSL_PROTOCOLS, SSLUtil.arrayToSpaceDelimitedString(this.protocols)); + props.setProperty(CLUSTER_SSL_CIPHERS, SSLUtil.arrayToSpaceDelimitedString(this.ciphers)); props.setProperty(CLUSTER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(this.requireAuth)); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SSLConfigurationFactory.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SSLConfigurationFactory.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SSLConfigurationFactory.java index 33378b8..66fba7e 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SSLConfigurationFactory.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SSLConfigurationFactory.java @@ -27,6 +27,7 @@ import org.springframework.util.StringUtils; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl; import com.gemstone.gemfire.internal.admin.SSLConfig; +import com.gemstone.gemfire.management.internal.SSLUtil; public class SSLConfigurationFactory { @@ -316,8 +317,8 @@ public class SSLConfigurationFactory { final String alias) { SSLConfig sslConfig = new SSLConfig(); sslConfig.setAlias(alias); - sslConfig.setCiphers(ciphers); - sslConfig.setProtocols(protocols); + sslConfig.setCiphers(SSLUtil.stringToArray(ciphers)); + sslConfig.setProtocols(SSLUtil.stringToArray(protocols)); sslConfig.setRequireAuth(needClientAuth); sslConfig.setEnabled(useSSL); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SocketCreator.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SocketCreator.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SocketCreator.java index a11733a..d361829 100755 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SocketCreator.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SocketCreator.java @@ -440,7 +440,7 @@ public class SocketCreator { } private SSLContext getSSLContextInstance() { - String[] protocols = sslConfig.getProtocolsAsStringArray(); + String[] protocols = sslConfig.getProtocols(); SSLContext sslContext = null; if (protocols != null && protocols.length > 0) { for (String protocol : protocols) { @@ -1019,11 +1019,11 @@ public class SocketCreator { serverSocket.setEnableSessionCreation(true); // restrict cyphers - String[] protocols = this.sslConfig.getProtocolsAsStringArray(); + String[] protocols = this.sslConfig.getProtocols(); if (!"any".equalsIgnoreCase(protocols[0])) { serverSocket.setEnabledProtocols(protocols); } - String[] ciphers = this.sslConfig.getCiphersAsStringArray(); + String[] ciphers = this.sslConfig.getCiphers(); if (!"any".equalsIgnoreCase(ciphers[0])) { serverSocket.setEnabledCipherSuites(ciphers); } @@ -1040,13 +1040,13 @@ public class SocketCreator { sslSocket.setUseClientMode(true); sslSocket.setEnableSessionCreation(true); - String[] protocols = this.sslConfig.getProtocolsAsStringArray(); + String[] protocols = this.sslConfig.getProtocols(); // restrict cyphers if (protocols != null && !"any".equalsIgnoreCase(protocols[0])) { sslSocket.setEnabledProtocols(protocols); } - String[] ciphers = this.sslConfig.getCiphersAsStringArray(); + String[] ciphers = this.sslConfig.getCiphers(); if (ciphers != null && !"any".equalsIgnoreCase(ciphers[0])) { sslSocket.setEnabledCipherSuites(ciphers); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/management/GemFireProperties.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/GemFireProperties.java b/geode-core/src/main/java/com/gemstone/gemfire/management/GemFireProperties.java index 410d658..ed7e5b9 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/management/GemFireProperties.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/management/GemFireProperties.java @@ -442,12 +442,12 @@ public class GemFireProperties { * @deprecated Geode 1.0 use {@link #clusterSSLProtocols} */ @Deprecated - private String jmxManagerSSLProtocols; + private String[] jmxManagerSSLProtocols; /** * @deprecated Geode 1.0 use {@link #clusterSSLCiphers} */ @Deprecated - private String jmxManagerSSLCiphers; + private String[] jmxManagerSSLCiphers; /** * @deprecated Geode 1.0 use {@link #clusterSSLRequireAuthentication} */ @@ -481,8 +481,8 @@ public class GemFireProperties { private String jmxManagerSSLAlias; private boolean clusterSSLEnabled; - private String clusterSSLProtocols; - private String clusterSSLCiphers; + private String[] clusterSSLProtocols; + private String[] clusterSSLCiphers; private boolean clusterSSLRequireAuthentication; private String clusterSSLKeyStore; private String clusterSSLKeyStoreType; @@ -500,12 +500,12 @@ public class GemFireProperties { * @deprecated Geode 1.0 use {@link #clusterSSLProtocols} */ @Deprecated - private String serverSSLProtocols; + private String[] serverSSLProtocols; /** * @deprecated Geode 1.0 use {@link #clusterSSLCiphers} */ @Deprecated - private String serverSSLCiphers; + private String[] serverSSLCiphers; /** * @deprecated Geode 1.0 use {@link #clusterSSLRequireAuthentication} */ @@ -547,12 +547,12 @@ public class GemFireProperties { * @deprecated Geode 1.0 use {@link #clusterSSLProtocols} */ @Deprecated - private String gatewaySSLProtocols; + private String[] gatewaySSLProtocols; /** * @deprecated Geode 1.0 use {@link #clusterSSLCiphers} */ @Deprecated - private String gatewaySSLCiphers; + private String[] gatewaySSLCiphers; /** * @deprecated Geode 1.0 use {@link #clusterSSLRequireAuthentication} */ @@ -599,12 +599,12 @@ public class GemFireProperties { * @deprecated Geode 1.0 use {@link #clusterSSLProtocols} */ @Deprecated - private String httpServiceSSLProtocols; + private String[] httpServiceSSLProtocols; /** * @deprecated Geode 1.0 use {@link #clusterSSLCiphers} */ @Deprecated - private String httpServiceSSLCiphers; + private String[] httpServiceSSLCiphers; /** * @deprecated Geode 1.0 use {@link #clusterSSLKeyStore} */ @@ -1018,26 +1018,6 @@ public class GemFireProperties { } -// public void setSslEnabled(boolean sslEnabled) { -// this.sslEnabled = sslEnabled; -// -// } -// -// public void setSslCiphers(String sslCiphers) { -// this.sslCiphers = sslCiphers; -// -// } -// -// public void setSslProtocols(String sslProtocols) { -// this.sslProtocols = sslProtocols; -// -// } -// -// public void setSslRequireAuthentication(boolean sslRequireAuthentication) { -// this.sslRequireAuthentication = sslRequireAuthentication; -// -// } - public void setSocketLeaseTime(int socketLeaseTime) { this.socketLeaseTime = socketLeaseTime; @@ -1358,19 +1338,19 @@ public class GemFireProperties { this.jmxManagerSSLEnabled = jmxManagerSSLEnabled; } - public String getJmxManagerSSLProtocols() { + public String[] getJmxManagerSSLProtocols() { return jmxManagerSSLProtocols; } - public void setJmxManagerSSLProtocols(String jmxManagerSSLProtocols) { + public void setJmxManagerSSLProtocols(String[] jmxManagerSSLProtocols) { this.jmxManagerSSLProtocols = jmxManagerSSLProtocols; } - public String getJmxManagerSSLCiphers() { + public String[] getJmxManagerSSLCiphers() { return jmxManagerSSLCiphers; } - public void setJmxManagerSSLCiphers(String jmxManagerSSLCiphers) { + public void setJmxManagerSSLCiphers(String[] jmxManagerSSLCiphers) { this.jmxManagerSSLCiphers = jmxManagerSSLCiphers; } @@ -1431,19 +1411,19 @@ public class GemFireProperties { this.clusterSSLEnabled = clusterSSLEnabled; } - public String getClusterSSLProtocols() { + public String[] getClusterSSLProtocols() { return clusterSSLProtocols; } - public void setClusterSSLProtocols(String clusterSSLProtocols) { + public void setClusterSSLProtocols(String[] clusterSSLProtocols) { this.clusterSSLProtocols = clusterSSLProtocols; } - public String getClusterSSLCiphers() { + public String[] getClusterSSLCiphers() { return clusterSSLCiphers; } - public void setClusterSSLCiphers(String clusterSSLCiphers) { + public void setClusterSSLCiphers(String[] clusterSSLCiphers) { this.clusterSSLCiphers = clusterSSLCiphers; } @@ -1504,19 +1484,19 @@ public class GemFireProperties { this.serverSSLEnabled = serverSSLEnabled; } - public String getServerSSLProtocols() { + public String[] getServerSSLProtocols() { return serverSSLProtocols; } - public void setServerSSLProtocols(String serverSSLProtocols) { + public void setServerSSLProtocols(String[] serverSSLProtocols) { this.serverSSLProtocols = serverSSLProtocols; } - public String getServerSSLCiphers() { + public String[] getServerSSLCiphers() { return serverSSLCiphers; } - public void setServerSSLCiphers(String serverSSLCiphers) { + public void setServerSSLCiphers(String[] serverSSLCiphers) { this.serverSSLCiphers = serverSSLCiphers; } @@ -1577,19 +1557,19 @@ public class GemFireProperties { this.gatewaySSLEnabled = gatewaySSLEnabled; } - public String getGatewaySSLProtocols() { + public String[] getGatewaySSLProtocols() { return gatewaySSLProtocols; } - public void setGatewaySSLProtocols(String gatewaySSLProtocols) { + public void setGatewaySSLProtocols(String[] gatewaySSLProtocols) { this.gatewaySSLProtocols = gatewaySSLProtocols; } - public String getGatewaySSLCiphers() { + public String[] getGatewaySSLCiphers() { return gatewaySSLCiphers; } - public void setGatewaySSLCiphers(String gatewaySSLCiphers) { + public void setGatewaySSLCiphers(String[] gatewaySSLCiphers) { this.gatewaySSLCiphers = gatewaySSLCiphers; } @@ -1658,19 +1638,19 @@ public class GemFireProperties { this.httpServiceSSLRequireAuthentication = httpServiceSSLRequireAuthentication; } - public String getHttpServiceSSLProtocols() { + public String[] getHttpServiceSSLProtocols() { return httpServiceSSLProtocols; } - public void setHttpServiceSSLProtocols(String httpServiceSSLProtocols) { + public void setHttpServiceSSLProtocols(String[] httpServiceSSLProtocols) { this.httpServiceSSLProtocols = httpServiceSSLProtocols; } - public String getHttpServiceSSLCiphers() { + public String[] getHttpServiceSSLCiphers() { return httpServiceSSLCiphers; } - public void setHttpServiceSSLCiphers(String httpServiceSSLCiphers) { + public void setHttpServiceSSLCiphers(String[] httpServiceSSLCiphers) { this.httpServiceSSLCiphers = httpServiceSSLCiphers; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/management/internal/JettyHelper.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/JettyHelper.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/JettyHelper.java index 8724d73..8ebf4ef 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/JettyHelper.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/JettyHelper.java @@ -19,6 +19,7 @@ package com.gemstone.gemfire.management.internal; import java.io.File; import java.util.concurrent.CountDownLatch; +import org.apache.commons.lang.ArrayUtils; import org.apache.logging.log4j.Logger; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.server.Connector; @@ -80,12 +81,12 @@ public class JettyHelper { sslContextFactory.setNeedClientAuth(sslConfig.isRequireAuth()); - if (!StringUtils.isBlank(sslConfig.getCiphers()) && !"any".equalsIgnoreCase(sslConfig.getCiphers())) { + if (sslConfig.getCiphers().length > 0 && !ArrayUtils.contains(sslConfig.getCiphers(),"any")) { //If use has mentioned "any" let the SSL layer decide on the ciphers - sslContextFactory.setIncludeCipherSuites(SSLUtil.readArray(sslConfig.getCiphers())); + sslContextFactory.setIncludeCipherSuites(sslConfig.getCiphers()); } - String protocol = SSLUtil.getSSLAlgo(SSLUtil.readArray(sslConfig.getProtocols())); + String protocol = SSLUtil.getSSLAlgo(sslConfig.getProtocols()); if (protocol != null) { sslContextFactory.setProtocol(protocol); } else { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/management/internal/SSLUtil.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/SSLUtil.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/SSLUtil.java index 98248d5..7482d5d 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/SSLUtil.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/SSLUtil.java @@ -20,17 +20,15 @@ import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; - import javax.net.ssl.SSLContext; import com.gemstone.gemfire.internal.lang.StringUtils; /** - * * @since GemFire 8.1 */ public class SSLUtil { - + public static String getSSLAlgo(String[] protocols) { String c = null; @@ -63,19 +61,34 @@ public class SSLUtil { } return c; } - - /** Read an array of values from a string, whitespace separated. */ - public static String[] readArray( String text ) { + + /** + * Read an array of values from a string, whitespace separated. + */ + public static String[] stringToArray(String text) { if (StringUtils.isBlank(text)) { return null; } - - StringTokenizer st = new StringTokenizer( text ); - List<String> v = new ArrayList<String>( ); - while( st.hasMoreTokens() ) { - v.add( st.nextToken() ); + + StringTokenizer st = new StringTokenizer(text); + List<String> v = new ArrayList<String>(); + while (st.hasMoreTokens()) { + v.add(st.nextToken()); } - return v.toArray( new String[ v.size() ] ); + return v.toArray(new String[v.size()]); } + + public static String arrayToSpaceDelimitedString(String[] stringArray) { + if (stringArray.length == 0) { + return ""; + } + StringBuilder stringBuilder = new StringBuilder(); + for (String text : stringArray) { + stringBuilder.append(text); + stringBuilder.append(" "); + } + + return stringBuilder.toString().trim(); + } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommands.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommands.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommands.java index 523541c..e849d3a 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommands.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommands.java @@ -435,7 +435,7 @@ public class ShellCommands implements CommandMarker { trustManagerFactory.init(serverPub); } - SSLContext ssl = SSLContext.getInstance(SSLUtil.getSSLAlgo(SSLUtil.readArray(sslProtocolsToUse))); + SSLContext ssl = SSLContext.getInstance(SSLUtil.getSSLAlgo(SSLUtil.stringToArray(sslProtocolsToUse))); ssl.init(keyManagerFactory != null ? keyManagerFactory.getKeyManagers() : null, trustManagerFactory != null ? trustManagerFactory.getTrustManagers() : null, new java.security.SecureRandom()); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java index 56b35ea..d25615d 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java @@ -111,11 +111,11 @@ public class DistributionConfigJUnitTest { System.out.println("otherList: " + otherList); //TODO - This makes no sense. One has no idea what the correct expected number of attributes are. - assertEquals(28, boolList.size()); + assertEquals(29, boolList.size()); assertEquals(33, intList.size()); - assertEquals(84, stringList.size()); + assertEquals(72, stringList.size()); assertEquals(5, fileList.size()); - assertEquals(4, otherList.size()); + assertEquals(16, otherList.size()); } @Test @@ -306,7 +306,7 @@ public class DistributionConfigJUnitTest { public void testValidLocatorAddress() { String address = "81.240.0.1[7056]"; config.modifiable = true; - config.setAttributeObject(START_LOCATOR,address,ConfigSource.api()); + config.setAttributeObject(START_LOCATOR, address, ConfigSource.api()); assertEquals(config.getStartLocator(), address); } @@ -314,8 +314,8 @@ public class DistributionConfigJUnitTest { public void testInvalidLocatorAddress() { String address = "bad.bad[7056]"; config.modifiable = true; -// config.setStartLocator(address); - config.setAttributeObject(START_LOCATOR,address,ConfigSource.api()); + // config.setStartLocator(address); + config.setAttributeObject(START_LOCATOR, address, ConfigSource.api()); } @Test @@ -375,6 +375,7 @@ public class DistributionConfigJUnitTest { DistributionConfig config = new DistributionConfigImpl(props); } + @Test public void testSSLEnabledComponentsLegacyPass() { Properties props = new Properties(); @@ -385,4 +386,56 @@ public class DistributionConfigJUnitTest { DistributionConfig config = new DistributionConfigImpl(props); } + + @Test + public void testSSLCiphers() { + Properties props = new Properties(); + props.put(SSL_CIPHERS, "any,test,anythingelse"); + + DistributionConfig config = new DistributionConfigImpl(props); + assertArrayEquals(new String[] { "any", "test", "anythingelse" }, config.getSSLCiphers()); + } + + @Test + public void testSSLProtocols() { + Properties props = new Properties(); + props.put(SSL_PROTOCOLS, "any,protocol1,protocol2"); + + DistributionConfig config = new DistributionConfigImpl(props); + assertArrayEquals(new String[] { "any", "protocol1", "protocol2" }, config.getSSLProtocols()); + } + + @Test + public void testSSLLegacyCiphers() { + Properties props = new Properties(); + props.put(CLUSTER_SSL_CIPHERS, "cluster1 cluster2 cluster3"); + props.put(JMX_MANAGER_SSL_CIPHERS, "jmx1 jmx2 jmx3"); + props.put(HTTP_SERVICE_SSL_CIPHERS, "http1 http2 http3"); + props.put(GATEWAY_SSL_CIPHERS, "gateway1 gateway2 gateway3"); + props.put(SERVER_SSL_CIPHERS, "server1 server2 server3"); + + DistributionConfig config = new DistributionConfigImpl(props); + assertArrayEquals(new String[] { "cluster1", "cluster2", "cluster3" }, config.getClusterSSLCiphers()); + assertArrayEquals(new String[] { "jmx1", "jmx2", "jmx3" }, config.getJmxManagerSSLCiphers()); + assertArrayEquals(new String[] { "server1", "server2", "server3" }, config.getServerSSLCiphers()); + assertArrayEquals(new String[] { "gateway1", "gateway2", "gateway3" }, config.getGatewaySSLCiphers()); + assertArrayEquals(new String[] { "http1", "http2", "http3" }, config.getHttpServiceSSLCiphers()); + } + + @Test + public void testSSLLegacyProtocols() { + Properties props = new Properties(); + props.put(CLUSTER_SSL_PROTOCOLS, "cluster1 cluster2 cluster3"); + props.put(JMX_MANAGER_SSL_PROTOCOLS, "jmx1 jmx2 jmx3"); + props.put(HTTP_SERVICE_SSL_PROTOCOLS, "http1 http2 http3"); + props.put(GATEWAY_SSL_PROTOCOLS, "gateway1 gateway2 gateway3"); + props.put(SERVER_SSL_PROTOCOLS, "server1 server2 server3"); + + DistributionConfig config = new DistributionConfigImpl(props); + assertArrayEquals(new String[] { "cluster1", "cluster2", "cluster3" }, config.getClusterSSLProtocols()); + assertArrayEquals(new String[] { "jmx1", "jmx2", "jmx3" }, config.getJmxManagerSSLProtocols()); + assertArrayEquals(new String[] { "server1", "server2", "server3" }, config.getServerSSLProtocols()); + assertArrayEquals(new String[] { "gateway1", "gateway2", "gateway3" }, config.getGatewaySSLProtocols()); + assertArrayEquals(new String[] { "http1", "http2", "http3" }, config.getHttpServiceSSLProtocols()); + } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/geode-core/src/test/java/com/gemstone/gemfire/internal/net/SSLConfigurationFactoryTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/net/SSLConfigurationFactoryTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/net/SSLConfigurationFactoryTest.java index 0b70c8f..f97d485 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/net/SSLConfigurationFactoryTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/net/SSLConfigurationFactoryTest.java @@ -29,6 +29,7 @@ import org.junit.experimental.categories.Category; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl; import com.gemstone.gemfire.internal.admin.SSLConfig; +import com.gemstone.gemfire.management.internal.SSLUtil; import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase; import com.gemstone.gemfire.test.junit.categories.UnitTest; @@ -129,8 +130,8 @@ public class SSLConfigurationFactoryTest extends JUnit4DistributedTestCase { assertEquals(properties.getProperty(SSL_KEYSTORE_TYPE), sslConfig.getKeystoreType()); assertEquals(properties.getProperty(SSL_TRUSTSTORE), sslConfig.getTruststore()); assertEquals(properties.getProperty(SSL_TRUSTSTORE_PASSWORD), sslConfig.getTruststorePassword()); - assertEquals(properties.getProperty(SSL_CIPHERS), sslConfig.getCiphers()); - assertEquals(properties.getProperty(SSL_PROTOCOLS), sslConfig.getProtocols()); + assertEquals(SSLUtil.stringToArray(properties.getProperty(SSL_CIPHERS)), sslConfig.getCiphers()); + assertEquals(SSLUtil.stringToArray(properties.getProperty(SSL_PROTOCOLS)), sslConfig.getProtocols()); assertEquals(getCorrectAlias(expectedSSLEnabledComponent, properties), sslConfig.getAlias()); assertEquals(requiresAuthentication(properties, expectedSSLEnabledComponent), sslConfig.isRequireAuth()); assertEquals(expectedSSLEnabledComponent, sslConfig.getSslEnabledComponent()); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80731e54/gradle/java.gradle ---------------------------------------------------------------------- diff --git a/gradle/java.gradle b/gradle/java.gradle index 5b28e85..de501c6 100644 --- a/gradle/java.gradle +++ b/gradle/java.gradle @@ -23,29 +23,29 @@ allprojects { } subprojects { apply plugin: 'java' - + // apply compiler options -// gradle.taskGraph.whenReady( { graph -> -// tasks.withType(JavaCompile).each { javac -> -// javac.configure { -// sourceCompatibility '1.8' -// targetCompatibility '1.8' -// options.encoding = 'UTF-8' -// } -// } -// }) - + gradle.taskGraph.whenReady({ graph -> + tasks.withType(JavaCompile).each { javac -> + javac.configure { + sourceCompatibility '1.8' + targetCompatibility '1.8' + options.encoding = 'UTF-8' + } + } + }) + // apply default manifest - gradle.taskGraph.whenReady( { graph -> + gradle.taskGraph.whenReady({ graph -> tasks.withType(Jar).each { jar -> jar.doFirst { manifest { attributes( - "Manifest-Version" : "1.0", - "Created-By" : System.getProperty("user.name"), - "Title" : rootProject.name, - "Version" : version, - "Organization" : productOrg + "Manifest-Version": "1.0", + "Created-By": System.getProperty("user.name"), + "Title": rootProject.name, + "Version": version, + "Organization": productOrg ) } @@ -64,10 +64,10 @@ subprojects { description 'a dependency that is provided externally at runtime' visible true } - + testOutput { extendsFrom testCompile - description 'a dependency that exposes test artifacts' + description 'a dependency that exposes test artifacts' } } @@ -79,7 +79,7 @@ subprojects { } } - task jarTest (type: Jar, dependsOn: testClasses) { + task jarTest(type: Jar, dependsOn: testClasses) { description 'Assembles a jar archive of test classes.' from sourceSets.test.output classifier 'test' @@ -100,7 +100,7 @@ subprojects { javadoc { options.addStringOption('Xdoclint:none', '-quiet') - options.encoding='UTF-8' + options.encoding = 'UTF-8' } }
