Search in sources :

Example 21 with DistributionConfigImpl

use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.

the class SocketCreatorFactoryJUnitTest method testLegacyClusterSSLConfig.

@Test
public void testLegacyClusterSSLConfig() throws IOException {
    File jks = findTestJKS();
    Properties properties = new Properties();
    properties.setProperty(MCAST_PORT, "0");
    properties.setProperty(CLUSTER_SSL_REQUIRE_AUTHENTICATION, "true");
    properties.setProperty(CLUSTER_SSL_ENABLED, "true");
    properties.setProperty(CLUSTER_SSL_CIPHERS, "TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA");
    properties.setProperty(CLUSTER_SSL_PROTOCOLS, "TLSv1,TLSv1.1,TLSv1.2");
    properties.setProperty(CLUSTER_SSL_KEYSTORE, jks.getCanonicalPath());
    properties.setProperty(CLUSTER_SSL_KEYSTORE_PASSWORD, "password");
    properties.setProperty(CLUSTER_SSL_KEYSTORE_TYPE, "JKS");
    properties.setProperty(CLUSTER_SSL_TRUSTSTORE, jks.getCanonicalPath());
    properties.setProperty(CLUSTER_SSL_TRUSTSTORE_PASSWORD, "password");
    DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
    SocketCreatorFactory.setDistributionConfig(distributionConfig);
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.CLUSTER).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.GATEWAY).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.JMX).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.SERVER).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.WEB).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.LOCATOR).useSSL());
}
Also used : DistributionConfigImpl(org.apache.geode.distributed.internal.DistributionConfigImpl) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) File(java.io.File) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 22 with DistributionConfigImpl

use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.

the class SocketCreatorFactoryJUnitTest method testNewSSLConfigSSLComponentLocator.

@Test
public void testNewSSLConfigSSLComponentLocator() throws Exception {
    Properties properties = configureSSLProperties(SecurableCommunicationChannel.LOCATOR.getConstant());
    DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
    SocketCreatorFactory.setDistributionConfig(distributionConfig);
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.LOCATOR).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.CLUSTER).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.GATEWAY).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.JMX).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.SERVER).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.WEB).useSSL());
}
Also used : DistributionConfigImpl(org.apache.geode.distributed.internal.DistributionConfigImpl) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 23 with DistributionConfigImpl

use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.

the class SocketCreatorFactoryJUnitTest method testNewSSLConfigSSLComponentWithoutAliasWithMultiKeyStore.

@Test
public void testNewSSLConfigSSLComponentWithoutAliasWithMultiKeyStore() throws Exception {
    Properties properties = configureSSLProperties(SecurableCommunicationChannel.ALL.getConstant());
    properties.setProperty(SSL_KEYSTORE, TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKey.jks"));
    properties.setProperty(SSL_TRUSTSTORE, TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKeyTrust.jks"));
    DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
    SocketCreatorFactory.setDistributionConfig(distributionConfig);
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.CLUSTER).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.GATEWAY).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.JMX).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.SERVER).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.WEB).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.LOCATOR).useSSL());
}
Also used : DistributionConfigImpl(org.apache.geode.distributed.internal.DistributionConfigImpl) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 24 with DistributionConfigImpl

use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.

the class SocketCreatorFactoryJUnitTest method testNewSSLConfigSSLComponentCombinations2.

@Test
public void testNewSSLConfigSSLComponentCombinations2() throws Exception {
    Properties properties = configureSSLProperties(commaDelimitedString(SecurableCommunicationChannel.CLUSTER.getConstant(), SecurableCommunicationChannel.SERVER.getConstant(), SecurableCommunicationChannel.WEB.getConstant(), SecurableCommunicationChannel.JMX.getConstant()));
    DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
    SocketCreatorFactory.setDistributionConfig(distributionConfig);
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.CLUSTER).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.GATEWAY).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.JMX).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.SERVER).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.WEB).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.LOCATOR).useSSL());
}
Also used : DistributionConfigImpl(org.apache.geode.distributed.internal.DistributionConfigImpl) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 25 with DistributionConfigImpl

use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.

the class SocketCreatorFactoryJUnitTest method testNewSSLConfigSSLComponentAliasWithMultiKeyStore.

@Test
public void testNewSSLConfigSSLComponentAliasWithMultiKeyStore() throws Exception {
    Properties properties = configureSSLProperties(SecurableCommunicationChannel.ALL.getConstant());
    properties.setProperty(SSL_KEYSTORE, TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKey.jks"));
    properties.setProperty(SSL_TRUSTSTORE, TestUtil.getResourcePath(getClass(), "/org/apache/geode/internal/net/multiKeyTrust.jks"));
    properties.setProperty(SSL_CLUSTER_ALIAS, "clusterKey");
    properties.setProperty(SSL_DEFAULT_ALIAS, "serverKey");
    DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
    SocketCreatorFactory.setDistributionConfig(distributionConfig);
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.CLUSTER).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.GATEWAY).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.JMX).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.SERVER).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.WEB).useSSL());
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.LOCATOR).useSSL());
}
Also used : DistributionConfigImpl(org.apache.geode.distributed.internal.DistributionConfigImpl) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Aggregations

DistributionConfigImpl (org.apache.geode.distributed.internal.DistributionConfigImpl)61 Properties (java.util.Properties)59 Test (org.junit.Test)50 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)45 UnitTest (org.apache.geode.test.junit.categories.UnitTest)26 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)23 SecurityTest (org.apache.geode.test.junit.categories.SecurityTest)20 RestoreSystemProperties (org.junit.contrib.java.lang.system.RestoreSystemProperties)11 MembershipTest (org.apache.geode.test.junit.categories.MembershipTest)10 File (java.io.File)6 SecurableCommunicationChannel (org.apache.geode.internal.security.SecurableCommunicationChannel)6 DistributionConfig (org.apache.geode.distributed.internal.DistributionConfig)5 ServiceConfig (org.apache.geode.distributed.internal.membership.gms.ServiceConfig)4 Services (org.apache.geode.distributed.internal.membership.gms.Services)4 RemoteTransportConfig (org.apache.geode.internal.admin.remote.RemoteTransportConfig)4 Before (org.junit.Before)3 Map (java.util.Map)2 LogWriter (org.apache.geode.LogWriter)2 Cache (org.apache.geode.cache.Cache)2 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)2