[ZEPPELIN-1074] Enhance SSL Support

- Run SLL on the defined SSL port
- If Client Authentication is not enabled
  does not use it's properties
This commit is contained in:
Luciano Resende 2016-12-13 22:51:22 -08:00 committed by Luciano Resende
parent e3cc8ea1be
commit 1b1050eace
2 changed files with 21 additions and 7 deletions

View file

@ -187,10 +187,14 @@ public class ZeppelinServer extends Application {
ServerConnector connector;
if (conf.useSsl()) {
LOG.debug("Enabling SSL for Zeppelin Server on port " + conf.getServerSslPort());
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSecureScheme("https");
httpConfig.setSecurePort(conf.getServerSslPort());
httpConfig.setOutputBufferSize(32768);
httpConfig.setRequestHeaderSize(8192);
httpConfig.setResponseHeaderSize(8192);
httpConfig.setSendServerVersion(true);
HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
SecureRequestCustomizer src = new SecureRequestCustomizer();
@ -212,7 +216,11 @@ public class ZeppelinServer extends Application {
connector.setIdleTimeout(timeout);
connector.setSoLingerTime(-1);
connector.setHost(conf.getServerAddress());
connector.setPort(conf.getServerPort());
if (conf.useSsl()) {
connector.setPort(conf.getServerSslPort());
} else {
connector.setPort(conf.getServerPort());
}
server.addConnector(connector);
@ -241,12 +249,14 @@ public class ZeppelinServer extends Application {
sslContextFactory.setKeyStorePassword(conf.getKeyStorePassword());
sslContextFactory.setKeyManagerPassword(conf.getKeyManagerPassword());
// Set truststore
sslContextFactory.setTrustStorePath(conf.getTrustStorePath());
sslContextFactory.setTrustStoreType(conf.getTrustStoreType());
sslContextFactory.setTrustStorePassword(conf.getTrustStorePassword());
if (conf.useClientAuth()) {
sslContextFactory.setNeedClientAuth(conf.useClientAuth());
sslContextFactory.setNeedClientAuth(conf.useClientAuth());
// Set truststore
sslContextFactory.setTrustStorePath(conf.getTrustStorePath());
sslContextFactory.setTrustStoreType(conf.getTrustStoreType());
sslContextFactory.setTrustStorePassword(conf.getTrustStorePassword());
}
return sslContextFactory;
}

View file

@ -107,7 +107,11 @@ public class ZeppelinConfiguration extends XMLConfiguration {
}
LOG.info("Server Host: " + conf.getServerAddress());
LOG.info("Server Port: " + conf.getServerPort());
if (conf.useSsl() == false) {
LOG.info("Server Port: " + conf.getServerPort());
} else {
LOG.info("Server SSL Port: " + conf.getServerSslPort());
}
LOG.info("Context Path: " + conf.getServerContextPath());
LOG.info("Zeppelin Version: " + Util.getVersion());