use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testCustomizedCacheServerSslConfig.
@Test
public void testCustomizedCacheServerSslConfig() throws Exception {
boolean sslenabled = false;
String sslprotocols = "any";
String sslciphers = "any";
boolean requireAuth = true;
boolean cacheServerSslenabled = true;
String cacheServerSslprotocols = "SSLv7";
String cacheServerSslciphers = "RSA_WITH_GARBAGE";
boolean cacheServerSslRequireAuth = true;
Properties gemFireProps = new Properties();
gemFireProps.put(CLUSTER_SSL_ENABLED, String.valueOf(sslenabled));
gemFireProps.put(CLUSTER_SSL_PROTOCOLS, sslprotocols);
gemFireProps.put(CLUSTER_SSL_CIPHERS, sslciphers);
gemFireProps.put(CLUSTER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(requireAuth));
gemFireProps.put(SERVER_SSL_ENABLED, String.valueOf(cacheServerSslenabled));
gemFireProps.put(SERVER_SSL_PROTOCOLS, cacheServerSslprotocols);
gemFireProps.put(SERVER_SSL_CIPHERS, cacheServerSslciphers);
gemFireProps.put(SERVER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(cacheServerSslRequireAuth));
gemFireProps.putAll(getGfSecurityPropertiesForCS(false));
DistributionConfigImpl config = new DistributionConfigImpl(gemFireProps);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
isEqual(config.getServerSSLEnabled(), cacheServerSslenabled);
isEqual(config.getServerSSLProtocols(), cacheServerSslprotocols);
isEqual(config.getServerSSLCiphers(), cacheServerSslciphers);
isEqual(config.getServerSSLRequireAuthentication(), cacheServerSslRequireAuth);
isEqual(SERVER_SSL_PROPS_MAP.get(SERVER_SSL_KEYSTORE), config.getServerSSLKeyStore());
isEqual(SERVER_SSL_PROPS_MAP.get(SERVER_SSL_KEYSTORE_TYPE), config.getServerSSLKeyStoreType());
isEqual(SERVER_SSL_PROPS_MAP.get(SERVER_SSL_KEYSTORE_PASSWORD), config.getServerSSLKeyStorePassword());
isEqual(SERVER_SSL_PROPS_MAP.get(SERVER_SSL_TRUSTSTORE), config.getServerSSLTrustStore());
isEqual(SERVER_SSL_PROPS_MAP.get(SERVER_SSL_TRUSTSTORE_PASSWORD), config.getServerSSLTrustStorePassword());
}
use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testCustomizedGatewaySslConfig.
@Test
public void testCustomizedGatewaySslConfig() throws Exception {
boolean sslenabled = false;
String sslprotocols = "any";
String sslciphers = "any";
boolean requireAuth = true;
boolean gatewaySslenabled = true;
String gatewaySslprotocols = "SSLv7";
String gatewaySslciphers = "RSA_WITH_GARBAGE";
boolean gatewaySslRequireAuth = true;
Properties gemFireProps = new Properties();
gemFireProps.put(CLUSTER_SSL_ENABLED, String.valueOf(sslenabled));
gemFireProps.put(CLUSTER_SSL_PROTOCOLS, sslprotocols);
gemFireProps.put(CLUSTER_SSL_CIPHERS, sslciphers);
gemFireProps.put(CLUSTER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(requireAuth));
gemFireProps.put(GATEWAY_SSL_ENABLED, String.valueOf(gatewaySslenabled));
gemFireProps.put(GATEWAY_SSL_PROTOCOLS, gatewaySslprotocols);
gemFireProps.put(GATEWAY_SSL_CIPHERS, gatewaySslciphers);
gemFireProps.put(GATEWAY_SSL_REQUIRE_AUTHENTICATION, String.valueOf(gatewaySslRequireAuth));
gemFireProps.putAll(getGfSecurityPropertiesForGateway(false));
DistributionConfigImpl config = new DistributionConfigImpl(gemFireProps);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
isEqual(config.getGatewaySSLEnabled(), gatewaySslenabled);
isEqual(config.getGatewaySSLProtocols(), gatewaySslprotocols);
isEqual(config.getGatewaySSLCiphers(), gatewaySslciphers);
isEqual(config.getGatewaySSLRequireAuthentication(), gatewaySslRequireAuth);
isEqual(GATEWAY_SSL_PROPS_MAP.get(GATEWAY_SSL_KEYSTORE), config.getGatewaySSLKeyStore());
isEqual(GATEWAY_SSL_PROPS_MAP.get(GATEWAY_SSL_KEYSTORE_TYPE), config.getGatewaySSLKeyStoreType());
isEqual(GATEWAY_SSL_PROPS_MAP.get(GATEWAY_SSL_KEYSTORE_PASSWORD), config.getGatewaySSLKeyStorePassword());
isEqual(GATEWAY_SSL_PROPS_MAP.get(GATEWAY_SSL_TRUSTSTORE), config.getGatewaySSLTrustStore());
isEqual(GATEWAY_SSL_PROPS_MAP.get(GATEWAY_SSL_TRUSTSTORE_PASSWORD), config.getGatewaySSLTrustStorePassword());
}
use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testPartialCustomizedCacheServerSslConfig.
@Test
public void testPartialCustomizedCacheServerSslConfig() throws Exception {
boolean sslenabled = false;
String sslprotocols = "any";
String sslciphers = "any";
boolean requireAuth = true;
boolean cacheServerSslenabled = true;
String cacheServerSslprotocols = "SSLv7";
String cacheServerSslciphers = "RSA_WITH_GARBAGE";
boolean cacheServerSslRequireAuth = true;
Properties gemFireProps = new Properties();
gemFireProps.put(CLUSTER_SSL_ENABLED, String.valueOf(sslenabled));
gemFireProps.put(CLUSTER_SSL_PROTOCOLS, sslprotocols);
gemFireProps.put(CLUSTER_SSL_CIPHERS, sslciphers);
gemFireProps.put(CLUSTER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(requireAuth));
gemFireProps.put(SERVER_SSL_ENABLED, String.valueOf(cacheServerSslenabled));
gemFireProps.put(SERVER_SSL_PROTOCOLS, cacheServerSslprotocols);
gemFireProps.put(SERVER_SSL_CIPHERS, cacheServerSslciphers);
gemFireProps.put(SERVER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(cacheServerSslRequireAuth));
gemFireProps.putAll(getGfSecurityPropertiesForCS(true));
DistributionConfigImpl config = new DistributionConfigImpl(gemFireProps);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
isEqual(config.getServerSSLEnabled(), cacheServerSslenabled);
isEqual(config.getServerSSLProtocols(), cacheServerSslprotocols);
isEqual(config.getServerSSLCiphers(), cacheServerSslciphers);
isEqual(config.getServerSSLRequireAuthentication(), cacheServerSslRequireAuth);
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE), config.getClusterSSLKeyStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_TYPE), config.getClusterSSLKeyStoreType());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_PASSWORD), config.getClusterSSLKeyStorePassword());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE), config.getClusterSSLTrustStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE_PASSWORD), config.getClusterSSLTrustStorePassword());
isEqual(SERVER_PROPS_SUBSET_MAP.get(SERVER_SSL_KEYSTORE), config.getServerSSLKeyStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_TYPE), config.getServerSSLKeyStoreType());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_PASSWORD), config.getServerSSLKeyStorePassword());
isEqual(SERVER_PROPS_SUBSET_MAP.get(SERVER_SSL_TRUSTSTORE), config.getServerSSLTrustStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE_PASSWORD), config.getServerSSLTrustStorePassword());
}
use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testPartialCustomizedGatewaySslConfig.
@Test
public void testPartialCustomizedGatewaySslConfig() throws Exception {
boolean sslenabled = false;
String sslprotocols = "any";
String sslciphers = "any";
boolean requireAuth = true;
boolean gatewaySslenabled = true;
String gatewaySslprotocols = "SSLv7";
String gatewaySslciphers = "RSA_WITH_GARBAGE";
boolean gatewaySslRequireAuth = true;
Properties gemFireProps = new Properties();
gemFireProps.put(CLUSTER_SSL_ENABLED, String.valueOf(sslenabled));
gemFireProps.put(CLUSTER_SSL_PROTOCOLS, sslprotocols);
gemFireProps.put(CLUSTER_SSL_CIPHERS, sslciphers);
gemFireProps.put(CLUSTER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(requireAuth));
gemFireProps.put(GATEWAY_SSL_ENABLED, String.valueOf(gatewaySslenabled));
gemFireProps.put(GATEWAY_SSL_PROTOCOLS, gatewaySslprotocols);
gemFireProps.put(GATEWAY_SSL_CIPHERS, gatewaySslciphers);
gemFireProps.put(GATEWAY_SSL_REQUIRE_AUTHENTICATION, String.valueOf(gatewaySslRequireAuth));
gemFireProps.putAll(getGfSecurityPropertiesForGateway(true));
DistributionConfigImpl config = new DistributionConfigImpl(gemFireProps);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
isEqual(config.getGatewaySSLEnabled(), gatewaySslenabled);
isEqual(config.getGatewaySSLProtocols(), gatewaySslprotocols);
isEqual(config.getGatewaySSLCiphers(), gatewaySslciphers);
isEqual(config.getGatewaySSLRequireAuthentication(), gatewaySslRequireAuth);
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE), config.getClusterSSLKeyStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_TYPE), config.getClusterSSLKeyStoreType());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_PASSWORD), config.getClusterSSLKeyStorePassword());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE), config.getClusterSSLTrustStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE_PASSWORD), config.getClusterSSLTrustStorePassword());
isEqual(GATEWAY_PROPS_SUBSET_MAP.get(GATEWAY_SSL_KEYSTORE), config.getGatewaySSLKeyStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_TYPE), config.getGatewaySSLKeyStoreType());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_PASSWORD), config.getGatewaySSLKeyStorePassword());
isEqual(GATEWAY_PROPS_SUBSET_MAP.get(GATEWAY_SSL_TRUSTSTORE), config.getGatewaySSLTrustStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE_PASSWORD), config.getGatewaySSLTrustStorePassword());
}
use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testP2pSSLPropsOverriden_JMXPropsNotOverriden.
@Test
public void testP2pSSLPropsOverriden_JMXPropsNotOverriden() throws Exception {
boolean sslenabled = true;
String sslprotocols = "overrriden";
String sslciphers = "overrriden";
boolean requireAuth = true;
boolean jmxManagerSslenabled = false;
String jmxManagerSslprotocols = "SSLv7";
String jmxManagerSslciphers = "RSA_WITH_GARBAGE";
boolean jmxManagerSslRequireAuth = false;
Properties gemFireProps = new Properties();
gemFireProps.put(MCAST_PORT, "0");
gemFireProps.put(CLUSTER_SSL_ENABLED, String.valueOf(sslenabled));
gemFireProps.put(CLUSTER_SSL_PROTOCOLS, sslprotocols);
gemFireProps.put(CLUSTER_SSL_CIPHERS, sslciphers);
gemFireProps.put(CLUSTER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(requireAuth));
gemFireProps.putAll(getGfSecurityPropertiesJMX(true));
DistributionConfigImpl config = new DistributionConfigImpl(gemFireProps);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
isEqual(config.getJmxManagerSSLEnabled(), sslenabled);
isEqual(config.getJmxManagerSSLProtocols(), sslprotocols);
isEqual(config.getJmxManagerSSLCiphers(), sslciphers);
isEqual(config.getJmxManagerSSLRequireAuthentication(), requireAuth);
assertFalse(config.getJmxManagerSSLEnabled() == jmxManagerSslenabled);
assertFalse(config.getJmxManagerSSLProtocols().equals(jmxManagerSslprotocols));
assertFalse(config.getJmxManagerSSLCiphers().equals(jmxManagerSslciphers));
assertFalse(config.getJmxManagerSSLRequireAuthentication() == jmxManagerSslRequireAuth);
System.out.println(config.toLoggerString());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE), config.getClusterSSLKeyStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_TYPE), config.getClusterSSLKeyStoreType());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_PASSWORD), config.getClusterSSLKeyStorePassword());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE), config.getClusterSSLTrustStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE_PASSWORD), config.getClusterSSLTrustStorePassword());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE), config.getJmxManagerSSLKeyStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_TYPE), config.getJmxManagerSSLKeyStoreType());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_PASSWORD), config.getJmxManagerSSLKeyStorePassword());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE), config.getJmxManagerSSLTrustStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE_PASSWORD), config.getJmxManagerSSLTrustStorePassword());
}
Aggregations