From 79f1c2feb7da7a632256afaec103f3740ab45822 Mon Sep 17 00:00:00 2001 From: Matt Pavlovich Date: Tue, 2 Mar 2021 10:44:40 -0600 Subject: [PATCH 1/2] [AMQ-6951] Hide embedded jetty version - WS transport - HTTP transport --- .../activemq/transport/http/HttpTransportServer.java | 9 ++++++++- .../apache/activemq/transport/ws/WSTransportServer.java | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java b/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java index 370742951a..f0ecefd00f 100644 --- a/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java @@ -28,8 +28,9 @@ import org.apache.activemq.transport.util.TextWireFormat; import org.apache.activemq.transport.xstream.XStreamWireFormat; import org.apache.activemq.util.ServiceStopper; import org.eclipse.jetty.security.ConstraintSecurityHandler; +import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.Connector; -import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.HandlerWrapper; import org.eclipse.jetty.servlet.ServletContextHandler; @@ -82,6 +83,12 @@ public class HttpTransportServer extends WebTransportServerSupport { connector = socketConnectorFactory.createConnector(server); } + for(ConnectionFactory cf : connector.getConnectionFactories()) { + if(HttpConnectionFactory.class.isAssignableFrom(cf.getClass())) { + HttpConnectionFactory.class.cast(cf).getHttpConfiguration().setSendServerVersion(false); + } + } + URI boundTo = bind(); ServletContextHandler contextHandler = diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java b/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java index ea8867d76e..7aaaecc736 100644 --- a/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/ws/WSTransportServer.java @@ -32,7 +32,9 @@ import org.apache.activemq.transport.ws.jetty9.WSServlet; import org.apache.activemq.util.IntrospectionSupport; import org.apache.activemq.util.ServiceStopper; import org.eclipse.jetty.security.ConstraintSecurityHandler; +import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; @@ -64,6 +66,12 @@ public class WSTransportServer extends WebTransportServerSupport implements Brok connector = socketConnectorFactory.createConnector(server); } + for(ConnectionFactory cf : connector.getConnectionFactories()) { + if(HttpConnectionFactory.class.isAssignableFrom(cf.getClass())) { + HttpConnectionFactory.class.cast(cf).getHttpConfiguration().setSendServerVersion(false); + } + } + URI boundTo = bind(); ServletContextHandler contextHandler = From 065b9ec33c19f055b1e91217e2fb71b82d303c5c Mon Sep 17 00:00:00 2001 From: Matt Pavlovich Date: Tue, 2 Mar 2021 10:56:20 -0600 Subject: [PATCH 2/2] [AMQ-6951] Update assembly/reelease/conf/jetty.xml to hide Jetty version --- assembly/src/release/conf/jetty.xml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/assembly/src/release/conf/jetty.xml b/assembly/src/release/conf/jetty.xml index 61648a47d7..f63a5d01f7 100644 --- a/assembly/src/release/conf/jetty.xml +++ b/assembly/src/release/conf/jetty.xml @@ -20,6 +20,10 @@ + + + + @@ -141,9 +145,16 @@ - - - + + + + + + + + + +