use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testGatewayDefaultConfig.
@Test
public void testGatewayDefaultConfig() throws Exception {
boolean sslenabled = false;
String sslprotocols = "any";
String sslciphers = "any";
boolean requireAuth = true;
boolean gatewaySslenabled = false;
String gatewaySslprotocols = "any";
String gatewaySslciphers = "any";
boolean gatewaySslRequireAuth = true;
DistributionConfigImpl config = new DistributionConfigImpl(new Properties());
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);
}
use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testConfigCopyWithSSL.
@Test
public void testConfigCopyWithSSL() throws Exception {
boolean sslenabled = false;
String sslprotocols = "any";
String sslciphers = "any";
boolean requireAuth = true;
DistributionConfigImpl config = new DistributionConfigImpl(new Properties());
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
Properties props = new Properties();
sslciphers = "RSA_WITH_GARBAGE";
props.setProperty(CLUSTER_SSL_CIPHERS, sslciphers);
config = new DistributionConfigImpl(props);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
sslprotocols = "SSLv7";
props.setProperty(CLUSTER_SSL_PROTOCOLS, sslprotocols);
config = new DistributionConfigImpl(props);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
requireAuth = false;
props.setProperty(CLUSTER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(requireAuth));
config = new DistributionConfigImpl(props);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
sslenabled = true;
props.setProperty(CLUSTER_SSL_ENABLED, String.valueOf(sslenabled));
props.setProperty(MCAST_PORT, "0");
config = new DistributionConfigImpl(props);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
config = new DistributionConfigImpl(config);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
}
use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testP2pSSLPropsOverriden_ServerPropsOverriden.
@Test
public void testP2pSSLPropsOverriden_ServerPropsOverriden() throws Exception {
boolean sslenabled = true;
String sslprotocols = "overrriden";
String sslciphers = "overrriden";
boolean requireAuth = true;
boolean cacheServerSslenabled = false;
String cacheServerSslprotocols = "SSLv7";
String cacheServerSslciphers = "RSA_WITH_GARBAGE";
boolean cacheServerSslRequireAuth = 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.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);
assertFalse(config.getServerSSLEnabled() == sslenabled);
assertFalse(config.getServerSSLProtocols().equals(sslprotocols));
assertFalse(config.getServerSSLCiphers().equals(sslciphers));
assertFalse(config.getServerSSLRequireAuthentication() == requireAuth);
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(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 testMCastPortWithClusterSSL.
@Test
public void testMCastPortWithClusterSSL() throws Exception {
Properties props = new Properties();
// default mcast-port is not 0.
props.setProperty(CLUSTER_SSL_ENABLED, "true");
try {
new DistributionConfigImpl(props);
} catch (IllegalArgumentException e) {
if (!e.toString().matches(".*Could not set \"cluster-ssl-enabled.*")) {
throw new Exception("did not get expected exception, got this instead...", e);
}
}
props.setProperty(MCAST_PORT, "0");
new DistributionConfigImpl(props);
}
use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testGatewayConfig.
@Test
public void testGatewayConfig() 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));
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);
}
Aggregations