diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java index 7f304e1d91..728d6b9427 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java @@ -380,6 +380,7 @@ public class TransportConstants { allowableAcceptorKeys.add(TransportConstants.NEED_CLIENT_AUTH_PROP_NAME); allowableAcceptorKeys.add(TransportConstants.WANT_CLIENT_AUTH_PROP_NAME); allowableAcceptorKeys.add(TransportConstants.VERIFY_HOST_PROP_NAME); + allowableAcceptorKeys.add(TransportConstants.SNIHOST_PROP_NAME); allowableAcceptorKeys.add(TransportConstants.TCP_NODELAY_PROPNAME); allowableAcceptorKeys.add(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME); allowableAcceptorKeys.add(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME); @@ -445,6 +446,7 @@ public class TransportConstants { allowableConnectorKeys.add(TransportConstants.VERIFY_HOST_PROP_NAME); allowableConnectorKeys.add(TransportConstants.TRUST_ALL_PROP_NAME); allowableConnectorKeys.add(TransportConstants.FORCE_SSL_PARAMETERS); + allowableConnectorKeys.add(TransportConstants.SNIHOST_PROP_NAME); allowableConnectorKeys.add(TransportConstants.TCP_NODELAY_PROPNAME); allowableConnectorKeys.add(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME); allowableConnectorKeys.add(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java index 7331c5138f..697569bea3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java @@ -200,6 +200,25 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { } } + @Test + public void testOneWaySSLwithSNINegativeAndURL() throws Exception { + createCustomSslServer("myhost\\.com"); + + ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocator("tcp://127.0.0.1:61616?" + + TransportConstants.SSL_ENABLED_PROP_NAME + "=true;" + + TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME + "=" + storeType + ";" + + TransportConstants.TRUSTSTORE_PATH_PROP_NAME + "=" + CLIENT_SIDE_TRUSTSTORE +";" + + TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME + "=" + PASSWORD + ";" + + TransportConstants.SNIHOST_PROP_NAME + "=badhost.com")); + + try { + ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); + fail("Should have failed due to unrecognized SNI host name"); + } catch (Exception e) { + // ignore + } + } + @Test public void testOneWaySSLwithSNIOnlyOnTheClient() throws Exception { createCustomSslServer();