aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreconwar <conor.ward@ericsson.com>2018-08-15 12:12:42 +0000
committerRonan Keogh <ronan.keogh@ericsson.com>2018-08-16 14:43:05 +0100
commit49fbf9a09d244bbdc19783d9ff10cd03cd89640a (patch)
tree2976c63daf00746f4958601ba5883834165e08d4
parentf20d316c4a4d8666f93be0a654dd042c6d0ac835 (diff)
Fix datarouter-prov server issue
Change-Id: Id9637c56d39156da60c167dfb8f375f4cb498f55 Signed-off-by: Conor Ward <conor.ward@ericsson.com> Issue-ID: DMAAP-596
-rwxr-xr-xdatarouter-node/pom.xml5
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java40
-rwxr-xr-xdatarouter-prov/pom.xml5
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java77
4 files changed, 62 insertions, 65 deletions
diff --git a/datarouter-node/pom.xml b/datarouter-node/pom.xml
index fb28724f..bb0b7ffa 100755
--- a/datarouter-node/pom.xml
+++ b/datarouter-node/pom.xml
@@ -62,11 +62,6 @@
<version>0.0.1</version>
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- </dependency>
- <dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.7</version>
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java
index b9cdb541..f9d82a77 100644
--- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java
+++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java
@@ -92,12 +92,13 @@ public class NodeMain {
Server server = new Server();
// HTTP configuration
- HttpConfiguration http_config = new HttpConfiguration();
- http_config.setIdleTimeout(2000);
- http_config.setRequestHeaderSize(2048);
+ HttpConfiguration httpConfiguration = new HttpConfiguration();
+ httpConfiguration.setIdleTimeout(2000);
+ httpConfiguration.setRequestHeaderSize(2048);
- ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config));
- http.setPort(ncm.getHttpPort());
+ // HTTP connector
+ ServerConnector httpServerConnector = new ServerConnector(server, new HttpConnectionFactory(httpConfiguration));
+ httpServerConnector.setPort(ncm.getHttpPort());
// HTTPS configuration
SslContextFactory sslContextFactory = new SslContextFactory();
@@ -105,23 +106,28 @@ public class NodeMain {
sslContextFactory.setKeyStorePath(ncm.getKSFile());
sslContextFactory.setKeyStorePassword(ncm.getKSPass());
sslContextFactory.setKeyManagerPassword(ncm.getKPass());
-
- HttpConfiguration https_config = new HttpConfiguration(http_config);
- https_config.setRequestHeaderSize(8192);
-
- ServerConnector https = new ServerConnector(server,
- new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
- new HttpConnectionFactory(https_config));
- https.setPort(ncm.getHttpsPort());
- https.setIdleTimeout(500000);
- https.setAcceptQueueSize(2);
-
/* Skip SSLv3 Fixes */
sslContextFactory.addExcludeProtocols("SSLv3");
logger.info("Excluded protocols node-" + sslContextFactory.getExcludeProtocols());
/* End of SSLv3 Fixes */
- server.setConnectors(new Connector[]{http, https});
+ HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration);
+ httpsConfiguration.setRequestHeaderSize(8192);
+
+ SecureRequestCustomizer secureRequestCustomizer = new SecureRequestCustomizer();
+ secureRequestCustomizer.setStsMaxAge(2000);
+ secureRequestCustomizer.setStsIncludeSubDomains(true);
+ httpsConfiguration.addCustomizer(secureRequestCustomizer);
+
+ // HTTPS connector
+ ServerConnector httpsServerConnector = new ServerConnector(server,
+ new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
+ new HttpConnectionFactory(httpsConfiguration));
+ httpsServerConnector.setPort(ncm.getHttpsPort());
+ httpsServerConnector.setIdleTimeout(500000);
+ httpsServerConnector.setAcceptQueueSize(2);
+
+ server.setConnectors(new Connector[]{httpServerConnector, httpsServerConnector});
ServletContextHandler ctxt = new ServletContextHandler(0);
ctxt.setContextPath("/");
server.setHandler(ctxt);
diff --git a/datarouter-prov/pom.xml b/datarouter-prov/pom.xml
index a0650a02..a0624d2b 100755
--- a/datarouter-prov/pom.xml
+++ b/datarouter-prov/pom.xml
@@ -75,11 +75,6 @@
<version>0.0.1</version>
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- </dependency>
- <dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java
index 60496e56..3e3f45fe 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/Main.java
@@ -116,50 +116,60 @@ public class Main {
// Get properties
Properties p = (new DB()).getProperties();
- int http_port = Integer.parseInt(p.getProperty("org.onap.dmaap.datarouter.provserver.http.port", "8080"));
- int https_port = Integer.parseInt(p.getProperty("org.onap.dmaap.datarouter.provserver.https.port", "8443"));
+ int httpPort = Integer.parseInt(p.getProperty("org.onap.dmaap.datarouter.provserver.http.port", "8080"));
+ int httpsPort = Integer.parseInt(p.getProperty("org.onap.dmaap.datarouter.provserver.https.port", "8443"));
+
+ // HTTP configuration
+ HttpConfiguration httpConfiguration = new HttpConfiguration();
+ httpConfiguration.setSecureScheme("https");
+ httpConfiguration.setSecurePort(httpsPort);
+ httpConfiguration.setOutputBufferSize(32768);
+ httpConfiguration.setRequestHeaderSize(2048);
+ httpConfiguration.setIdleTimeout(300000);
+ httpConfiguration.setSendServerVersion(true);
+ httpConfiguration.setSendDateHeader(false);
+
+ // Server's thread pool
+ QueuedThreadPool queuedThreadPool = new QueuedThreadPool();
+ queuedThreadPool.setMinThreads(10);
+ queuedThreadPool.setMaxThreads(200);
+ queuedThreadPool.setDetailedDump(false);
+
+ // The server itself
+ server = new Server(queuedThreadPool);
// HTTP connector
- HttpConfiguration http_config = new HttpConfiguration();
- http_config.setSecureScheme("https");
- http_config.setSecurePort(https_port);
- http_config.setOutputBufferSize(32768);
- http_config.setRequestHeaderSize(2048);
- http_config.setIdleTimeout(300000);
- http_config.setSendServerVersion(true);
- http_config.setSendDateHeader(false);
-
- ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config));
- http.setPort(http_port);
- http.setAcceptQueueSize(2);
-
- // HTTPS config
- HttpConfiguration https_config = new HttpConfiguration(http_config);
- https_config.setRequestHeaderSize(8192);
+ ServerConnector httpServerConnector = new ServerConnector(server, new HttpConnectionFactory(httpConfiguration));
+ httpServerConnector.setPort(httpPort);
+ httpServerConnector.setAcceptQueueSize(2);
+
+ // HTTPS configuration
+ HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration);
+ httpsConfiguration.setRequestHeaderSize(8192);
// HTTPS connector
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath(p.getProperty(KEYSTORE_PATH_PROPERTY));
sslContextFactory.setKeyStorePassword(p.getProperty(KEYSTORE_PASSWORD_PROPERTY));
sslContextFactory.setKeyManagerPassword(p.getProperty("org.onap.dmaap.datarouter.provserver.keymanager.password"));
-
- ServerConnector https = new ServerConnector(server,
- new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
- new HttpConnectionFactory(https_config));
- https.setPort(https_port);
- https.setIdleTimeout(30000);
- https.setAcceptQueueSize(2);
-
// SSL stuff
/* Skip SSLv3 Fixes */
sslContextFactory.addExcludeProtocols("SSLv3");
logger.info("Excluded protocols prov-" + sslContextFactory.getExcludeProtocols());
/* End of SSLv3 Fixes */
+ ServerConnector httpsServerConnector = new ServerConnector(server,
+ new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
+ new HttpConnectionFactory(httpsConfiguration));
+ httpsServerConnector.setPort(httpsPort);
+ httpsServerConnector.setIdleTimeout(30000);
+ httpsServerConnector.setAcceptQueueSize(2);
+
sslContextFactory.setKeyStoreType(p.getProperty(KEYSTORE_TYPE_PROPERTY, "jks"));
sslContextFactory.setKeyStorePath(p.getProperty(KEYSTORE_PATH_PROPERTY));
sslContextFactory.setKeyStorePassword(p.getProperty(KEYSTORE_PASSWORD_PROPERTY));
sslContextFactory.setKeyManagerPassword(p.getProperty("org.onap.dmaap.datarouter.provserver.keymanager.password"));
+
String ts = p.getProperty(TRUSTSTORE_PATH_PROPERTY);
if (ts != null && ts.length() > 0) {
System.out.println("@@ TS -> " + ts);
@@ -210,12 +220,6 @@ public class Main {
hc.setHandlers(new Handler[]{contexts, new DefaultHandler()});
hc.addHandler(reqlog);
- // Server's thread pool
- QueuedThreadPool queuedThreadPool = new QueuedThreadPool();
- queuedThreadPool.setMinThreads(10);
- queuedThreadPool.setMaxThreads(200);
- queuedThreadPool.setDetailedDump(false);
-
// Daemon to clean up the log directory on a daily basis
Timer rolex = new Timer();
rolex.scheduleAtFixedRate(new PurgeLogDirTask(), 0, 86400000L); // run once per day
@@ -223,16 +227,13 @@ public class Main {
// Start LogfileLoader
LogfileLoader.getLoader();
- // The server itself
- server = new Server(queuedThreadPool);
-
ServerConnector serverConnector = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
- new HttpConnectionFactory(https_config));
- serverConnector.setPort(https_port);
+ new HttpConnectionFactory(httpsConfiguration));
+ serverConnector.setPort(httpsPort);
serverConnector.setIdleTimeout(500000);
- server.setConnectors(new Connector[]{http, https});
+ server.setConnectors(new Connector[]{httpServerConnector, httpsServerConnector});
server.setHandler(hc);
server.setStopAtShutdown(true);
server.setStopTimeout(5000);