use of org.apache.geode.internal.admin.SSLConfig in project geode by apache.
the class SSLConfigurationFactory method getSSLConfigForComponent.
public static SSLConfig getSSLConfigForComponent(SecurableCommunicationChannel sslEnabledComponent) {
SSLConfig sslConfig = getInstance().getRegisteredSSLConfigForComponent(sslEnabledComponent);
if (sslConfig == null) {
sslConfig = getInstance().createSSLConfigForComponent(sslEnabledComponent);
getInstance().registeredSSLConfigForComponent(sslEnabledComponent, sslConfig);
}
return sslConfig;
}
use of org.apache.geode.internal.admin.SSLConfig in project geode by apache.
the class SSLConfigurationFactory method createSSLConfigForComponent.
private SSLConfig createSSLConfigForComponent(final SecurableCommunicationChannel sslEnabledComponent) {
SSLConfig sslConfig = createSSLConfig(sslEnabledComponent);
SecurableCommunicationChannel[] sslEnabledComponents = getDistributionConfig().getSecurableCommunicationChannels();
if (sslEnabledComponents.length == 0) {
sslConfig = configureLegacyClusterSSL(sslConfig);
}
sslConfig.setSecurableCommunicationChannel(sslEnabledComponent);
switch(sslEnabledComponent) {
case ALL:
{
// Create a SSLConfig separate for HTTP Service. As the require-authentication might differ
createSSLConfigForComponent(SecurableCommunicationChannel.WEB);
break;
}
case CLUSTER:
{
if (sslEnabledComponents.length > 0) {
sslConfig = setAliasForComponent(sslConfig, getDistributionConfig().getClusterSSLAlias());
} else {
sslConfig = configureLegacyClusterSSL(sslConfig);
}
break;
}
case LOCATOR:
{
if (sslEnabledComponents.length > 0) {
sslConfig = setAliasForComponent(sslConfig, getDistributionConfig().getLocatorSSLAlias());
}
break;
}
case SERVER:
{
if (sslEnabledComponents.length > 0) {
sslConfig = setAliasForComponent(sslConfig, getDistributionConfig().getServerSSLAlias());
} else {
sslConfig = configureLegacyServerSSL(sslConfig);
}
break;
}
case GATEWAY:
{
if (sslEnabledComponents.length > 0) {
sslConfig = setAliasForComponent(sslConfig, getDistributionConfig().getGatewaySSLAlias());
} else {
sslConfig = configureLegacyGatewaySSL(sslConfig);
}
break;
}
case WEB:
{
if (sslEnabledComponents.length > 0) {
sslConfig = setAliasForComponent(sslConfig, getDistributionConfig().getHTTPServiceSSLAlias());
sslConfig.setRequireAuth(getDistributionConfig().getSSLWebRequireAuthentication());
} else {
sslConfig = configureLegacyHttpServiceSSL(sslConfig);
}
break;
}
case JMX:
{
if (sslEnabledComponents.length > 0) {
sslConfig = setAliasForComponent(sslConfig, getDistributionConfig().getJMXSSLAlias());
} else {
sslConfig = configureLegacyJMXSSL(sslConfig);
}
break;
}
}
configureSSLPropertiesFromSystemProperties(sslConfig);
return sslConfig;
}
use of org.apache.geode.internal.admin.SSLConfig in project geode by apache.
the class JettyHelper method main.
public static void main(final String... args) throws Exception {
if (args.length > 1) {
System.out.printf("Temporary Directory @ ($1%s)%n", USER_DIR);
final Server jetty = JettyHelper.initJetty(null, 8090, new SSLConfig());
for (int index = 0; index < args.length; index += 2) {
final String webAppContext = args[index];
final String webAppArchivePath = args[index + 1];
JettyHelper.addWebApplication(jetty, normalizeWebAppContext(webAppContext), normalizeWebAppArchivePath(webAppArchivePath));
}
JettyHelper.startJetty(jetty);
latch.await();
} else {
System.out.printf("usage:%n>java org.apache.geode.management.internal.TomcatHelper <web-app-context> <war-file-path> [<web-app-context> <war-file-path>]*");
}
}
use of org.apache.geode.internal.admin.SSLConfig in project geode by apache.
the class SSLConfigurationFactoryJUnitTest method getSSLConfigUsingJavaProperties.
@Test
public void getSSLConfigUsingJavaProperties() {
Properties properties = new Properties();
properties.setProperty(CLUSTER_SSL_ENABLED, "true");
properties.setProperty(MCAST_PORT, "0");
System.setProperty(SSLConfigurationFactory.JAVAX_KEYSTORE, "keystore");
System.setProperty(SSLConfigurationFactory.JAVAX_KEYSTORE_TYPE, "JKS");
System.setProperty(SSLConfigurationFactory.JAVAX_KEYSTORE_PASSWORD, "keystorePassword");
System.setProperty(SSLConfigurationFactory.JAVAX_TRUSTSTORE, "truststore");
System.setProperty(SSLConfigurationFactory.JAVAX_TRUSTSTORE_PASSWORD, "truststorePassword");
System.setProperty(SSLConfigurationFactory.JAVAX_TRUSTSTORE_TYPE, "JKS");
DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
SSLConfigurationFactory.setDistributionConfig(distributionConfig);
SSLConfig sslConfig = SSLConfigurationFactory.getSSLConfigForComponent(SecurableCommunicationChannel.CLUSTER);
assertEquals(true, sslConfig.isEnabled());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_KEYSTORE), sslConfig.getKeystore());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_KEYSTORE_PASSWORD), sslConfig.getKeystorePassword());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_KEYSTORE_TYPE), sslConfig.getKeystoreType());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_TRUSTSTORE), sslConfig.getTruststore());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_TRUSTSTORE_PASSWORD), sslConfig.getTruststorePassword());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_TRUSTSTORE_TYPE), sslConfig.getTruststoreType());
assertEquals(true, sslConfig.isEnabled());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_KEYSTORE), sslConfig.getKeystore());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_KEYSTORE_PASSWORD), sslConfig.getKeystorePassword());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_KEYSTORE_TYPE), sslConfig.getKeystoreType());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_TRUSTSTORE), sslConfig.getTruststore());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_TRUSTSTORE_PASSWORD), sslConfig.getTruststorePassword());
assertEquals(System.getProperty(SSLConfigurationFactory.JAVAX_TRUSTSTORE_TYPE), sslConfig.getTruststoreType());
}
use of org.apache.geode.internal.admin.SSLConfig in project geode by apache.
the class SSLConfigurationFactoryJUnitTest method getSSLHTTPMutualAuthenticationOffWithDefaultConfiguration.
@Test
public void getSSLHTTPMutualAuthenticationOffWithDefaultConfiguration() {
Properties properties = new Properties();
properties.setProperty(CLUSTER_SSL_ENABLED, "true");
properties.setProperty(MCAST_PORT, "0");
DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
SSLConfigurationFactory.setDistributionConfig(distributionConfig);
SSLConfig sslConfig = SSLConfigurationFactory.getSSLConfigForComponent(SecurableCommunicationChannel.WEB);
assertEquals(false, sslConfig.isRequireAuth());
assertEquals(true, sslConfig.isEnabled());
sslConfig = SSLConfigurationFactory.getSSLConfigForComponent(SecurableCommunicationChannel.CLUSTER);
assertEquals(true, sslConfig.isRequireAuth());
assertEquals(true, sslConfig.isEnabled());
sslConfig = SSLConfigurationFactory.getSSLConfigForComponent(SecurableCommunicationChannel.GATEWAY);
assertEquals(true, sslConfig.isRequireAuth());
assertEquals(true, sslConfig.isEnabled());
sslConfig = SSLConfigurationFactory.getSSLConfigForComponent(SecurableCommunicationChannel.SERVER);
assertEquals(true, sslConfig.isRequireAuth());
assertEquals(true, sslConfig.isEnabled());
sslConfig = SSLConfigurationFactory.getSSLConfigForComponent(SecurableCommunicationChannel.JMX);
assertEquals(true, sslConfig.isRequireAuth());
assertEquals(true, sslConfig.isEnabled());
}
Aggregations