You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2019/09/20 13:25:18 UTC

[qpid-broker-j] branch master updated (f2876f7 -> d4a3e0c)

This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git.


    from f2876f7  QPID-8360: [Broker-J] Change logger types to upper-case for consistency reasons
     new 84125e5  QPID-8354: [Broker-J] Blacklist TLSv1.1
     new d4a3e0c  QPID-8354: [Broker-J] Address review comments from Oleksandr Rudyy

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../server/configuration/CommonProperties.java     |   4 +-
 .../java/org/apache/qpid/server/model/Broker.java  |   6 +-
 .../server/transport/TCPandSSLTransportTest.java   | 207 ++++++++++++++-------
 3 files changed, 147 insertions(+), 70 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-broker-j] 01/02: QPID-8354: [Broker-J] Blacklist TLSv1.1

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git

commit 84125e51c445bef4070d88ae11a85f859b8ef667
Author: Tomas Vavricka <to...@deutsche-boerse.com>
AuthorDate: Thu Sep 19 15:33:14 2019 +0200

    QPID-8354: [Broker-J] Blacklist TLSv1.1
---
 .../server/configuration/CommonProperties.java     |   4 +-
 .../java/org/apache/qpid/server/model/Broker.java  |   6 +-
 .../server/transport/TCPandSSLTransportTest.java   | 161 ++++++++++++---------
 3 files changed, 102 insertions(+), 69 deletions(-)

diff --git a/broker-core/src/main/java/org/apache/qpid/server/configuration/CommonProperties.java b/broker-core/src/main/java/org/apache/qpid/server/configuration/CommonProperties.java
index 949216d..600f985 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/configuration/CommonProperties.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/configuration/CommonProperties.java
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Centralised record of Qpid common properties.
  *
- * Qpid build specific information like  project name, version number, and source code repository revision number
+ * Qpid build specific information like project name, version number, and source code repository revision number
  * are captured by this class and exposed via public static methods.
  *
  */
@@ -57,7 +57,7 @@ public class CommonProperties
     public static final String QPID_SECURITY_TLS_PROTOCOL_WHITE_LIST = "qpid.security.tls.protocolWhiteList";
     public static final String QPID_SECURITY_TLS_PROTOCOL_WHITE_LIST_DEFAULT = "TLSv1\\.[0-9]+";
     public static final String QPID_SECURITY_TLS_PROTOCOL_BLACK_LIST = "qpid.security.tls.protocolBlackList";
-    public static final String QPID_SECURITY_TLS_PROTOCOL_BLACK_LIST_DEFAULT = "TLSv1\\.0";
+    public static final String QPID_SECURITY_TLS_PROTOCOL_BLACK_LIST_DEFAULT = "TLSv1\\.[0-1]";
 
     public static final String QPID_SECURITY_TLS_CIPHER_SUITE_WHITE_LIST = "qpid.security.tls.cipherSuiteWhiteList";
     public static final String QPID_SECURITY_TLS_CIPHER_SUITE_WHITE_LIST_DEFAULT = "";
diff --git a/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java b/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
index e959818..62e2519 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
@@ -107,10 +107,12 @@ public interface Broker<X extends Broker<X>> extends ConfiguredObject<X>, EventL
     boolean DEFAULT_BROKER_MSG_AUTH = false;
 
     @ManagedContextDefault(name = CommonProperties.QPID_SECURITY_TLS_PROTOCOL_WHITE_LIST)
-    String DEFAULT_SECURITY_TLS_PROTOCOL_WHITE_LIST = "[\"TLSv1\\\\.[0-9]+\"]";
+    String DEFAULT_SECURITY_TLS_PROTOCOL_WHITE_LIST =
+            "[\"" + CommonProperties.QPID_SECURITY_TLS_PROTOCOL_WHITE_LIST_DEFAULT.replace("\\", "\\\\") + "\"]";
 
     @ManagedContextDefault(name = CommonProperties.QPID_SECURITY_TLS_PROTOCOL_BLACK_LIST)
-    String DEFAULT_SECURITY_TLS_PROTOCOL_BLACK_LIST = "[\"TLSv1\\\\.0\"]";
+    String DEFAULT_SECURITY_TLS_PROTOCOL_BLACK_LIST =
+            "[\"" + CommonProperties.QPID_SECURITY_TLS_PROTOCOL_BLACK_LIST_DEFAULT.replace("\\", "\\\\") + "\"]";
 
     @ManagedContextDefault(name = CommonProperties.QPID_SECURITY_TLS_CIPHER_SUITE_WHITE_LIST)
     String DEFAULT_SECURITY_TLS_CIPHER_SUITE_WHITE_LIST = "[]";
diff --git a/broker-core/src/test/java/org/apache/qpid/server/transport/TCPandSSLTransportTest.java b/broker-core/src/test/java/org/apache/qpid/server/transport/TCPandSSLTransportTest.java
index ef6d5f4..c3ce9f3 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/transport/TCPandSSLTransportTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/transport/TCPandSSLTransportTest.java
@@ -62,6 +62,48 @@ public class TCPandSSLTransportTest extends UnitTestBase
 {
     private static final Logger LOGGER = LoggerFactory.getLogger(TCPandSSLTransportTest.class);
 
+    /** self signed cert keystore valid until Oct 2024 */
+    private static final String KEYSTORE_STRING =
+            "/u3+7QAAAAIAAAABAAAAAQAKc2VsZnNpZ25lZAAAAUkYmo+uAAAFATCCBP0wDgYKKwYBBAEqAhEB"
+            + "AQUABIIE6bR+b7FHo2BRT/WG+zDIfO8zOXoGIbuNL2znNMnvEp9xwfMQOkhKxEbVtX8uJ7HSwi1V"
+            + "bV2it0CA59sgvRt9awmgg+W1CLgkGKNOB+kQZbjL8R8lXmKibw4yU/EFm5rqDqPEXBRBj40TF0aT"
+            + "GtCCmmLPsH2pGU1wH2Ne/tozk8q7hYK6XMH/i43ZXhS9V2CKzPWrzhXmvjFKCtmYHNLj5nLLE/n0"
+            + "snqAssBoFSAJKmqkqHQBJNQjm4oqJFSISB8pwDX++0kvOMM7j5ryjVwihsCYuHZ6lh5BntDGF41L"
+            + "f4XADfv3Fma6nZQKfKs0VU2kAWUmjPpyV1FFq/ua4x6SUdZKS22YIQ3t6iO76TDABbQNyUX+Ge4n"
+            + "k6clF8MFswKTT0ug7zjb17d36gwl+UznvFqMSE6Zkrr9nNAcSVlQS+JaazXveiVEXTBYCAZgsNw3"
+            + "3KqlLWliAegnwQCQLOguw7bgusnZ/E61/TL8GTryiwN1mltbnsWkCjMj1AGUBM3sYNwbj87Vdhij"
+            + "iHJbjcB7q3Dak68khrCTLmqoD43KHBB5g+UMlruXYbE0elWqYpXGjI5cvt4gzfh1V+ira5DOfa4B"
+            + "Qskv/dh1uj2xAe1YEvF3xmdO2F6Yuzd88VO0aaPGroYPfRmh2M6rEOlwc2Ku/p23FjSWrLyzori8"
+            + "8/OKV4PM2b/NtY51ztTKWR/eUdX6qTPUJMK5CJiOxKGxk9PDtmsbQY685H6QVDKzTkbaPlP97+Oa"
+            + "xv3/2RIWR7KJzsxbqiYhX0fevRJw/RY6ZY3NEE5RAmCjzxD+1qDtu0QM/LspgPxyv5oSInAtT23U"
+            + "BrcNIiQ8jO+6E+fDcVhFSrs6gLGe1BwKYHsosjvup8FETLZgqKY6g1mwECA/Un2agzhI4tGC0O8v"
+            + "lU4VEZKrXwgy/XQ5C2vwwgLvJh94OfE20Wuf7Jjq8IUPcdF201XeYREE/vSNcBnJf22yPouJMIPk"
+            + "yNxlAHcapeFUi00yC19FEIpdoW/8pX2k64jx63CwwVckWWOIWlg8N+z9jsiwdjvm5wL2aFU3+wtu"
+            + "8Nj6Soy7Y3QYAwx17q/nUOJOk5DqLedG+/DKXVs5jghmbQ9wyzqGjGs+xYvSCXtQJygETUU/ddoM"
+            + "/iK4hhnZL2uqZ0wamef4ibdBbhpoRO8C7mSbi7TbDtcfysZrMb6i5MugR+NwKKzN2DznXItvpgzc"
+            + "Xm9j7LP8HZcQANa+1o2aIGDqK1fMSAOmBbTWlYkHPDbpoE/lx32iBNL/Aj8aKbtkwy/J2JRvo9m2"
+            + "uBdLK4DoDeTjqG//AwISrwm9y6xxIIPNQq7GiftN6p9KCI87U5pxqs5yUQ1g/e9DCioLe8O3Vug7"
+            + "+1jS1ZHWFtb4BBEF3EhkKa1AOVKNu9+M8lcG9tKWUBjnIFTD68a++6B36ShRnIZNbmbRkLC6wWdB"
+            + "SdyI6FWPxsPvGSF+3wq+n+0bu75N3Xsta5tEOjc67DfnQlyZtP/BIZsKxgEueOcXkjzaXMPYcrlJ"
+            + "2BInovQSHnSHvQfaBKqj/nKcGaDyydfdxF5fyjRPFYF+fFCWXrFkbQgAst8ymJ//UpLomfw+Ni6f"
+            + "xx2XQGt3941zhRuXJI2tdvUb2Czzsp0tq+h46d0WOlYQ57Q70weUQRrtARqCKoSp/gNUzQsvd+FO"
+            + "sUUxKRoJltRYBwAAAAEABVguNTA5AAADdTCCA3EwggJZoAMCAQICBBAXeI4wDQYJKoZIhvcNAQEL"
+            + "BQAwaDELMAkGA1UEBhMCVUsxETAPBgNVBAgTCFNjb3RsYW5kMRAwDgYDVQQHEwdHbGFzZ293MQ8w"
+            + "DQYDVQQKEwZBcGFjaGUxDTALBgNVBAsTBFFwaWQxFDASBgNVBAMTC0FwYWNoZSBRcGlkMCAXDTE0"
+            + "MTAxNjEwNTY1NVoYDzIxMTMwNTEwMTA1NjU1WjBoMQswCQYDVQQGEwJVSzERMA8GA1UECBMIU2Nv"
+            + "dGxhbmQxEDAOBgNVBAcTB0dsYXNnb3cxDzANBgNVBAoTBkFwYWNoZTENMAsGA1UECxMEUXBpZDEU"
+            + "MBIGA1UEAxMLQXBhY2hlIFFwaWQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC520Yd"
+            + "1GuXh67h7HawvL5/pwTr46P45R0gx+LDGC1Equ9/wvvsVbCPL0JLDTSKl0qpgbJNMH/A740vSilb"
+            + "FDdqfyOuIkQZN1Ub9CkOaI5uR9RjaC2MfyNUJl7Gp64nSYk9iDX15ddZjsAijUDvET32XzfirlML"
+            + "dwLXv1Y5dLskV0r6xK4NdLtXi+Ndn+Uy4EllD7VMIFaLt6oG9Vo6mNl0jze7Yz/aYYtWns4x+uG8"
+            + "WbMgtcXo/VxCyp+4ji06XFerwfkS0zBS1wfvxd5Qb1+4dYovSn1v0AaPvZ0XwG4XErP2/svU01nc"
+            + "C43Z4neHdsj8Y/kmXLDD8Nc7Mpv/Wm6hAgMBAAGjITAfMB0GA1UdDgQWBBQfKBRPr/QD7PjpM3s4"
+            + "rD8u6ZxiijANBgkqhkiG9w0BAQsFAAOCAQEAFjyjJ8pbHf6MioZpOOlZh4lz6F+9dW1KyJR0OIc4"
+            + "FXnYnU/CNzjkwPminuZJoYgXBh+sVFN238YFS3I8ONEQJy8uSH33T81sklXhqnrSk9OlWk1v60wH"
+            + "NwwNFz5ZuGrGlvk9EFhbC8FgdkXJbz21drAl18i2oJHPdQQNwdc6mwqhpNfjqZ2opfJPbVscX1P/"
+            + "dbJjfcoZ01fy5687zjpN11G4egwsrya2FZiAw1WPI10OhrJgiGL5aDiDLjauNZmoM7QchUUD1cjE"
+            + "EwvRkU1MesliLg4y3UqDoV6ooHB4ClE2aKmIdbVB/eP1QrEEkey93ptt1z5fLk1l408AkXQtzyw7"
+            + "9WC+xnZta0IoYC/vO29IVsok";
     @Test
     public void testNoSSLv3SupportOnSSLOnlyPort() throws Exception
     {
@@ -77,14 +119,14 @@ public class TCPandSSLTransportTest extends UnitTestBase
         }
     }
 
-
     @Test
-    public void testNoTLSv1SupportOnSharedPort() throws Exception
+    public void testNoSSLv3SupportOnSharedPort() throws Exception
     {
+        assumeThat("The IBM JDK has different TLS defaults", getJvmVendor(), is(not(equalTo(IBM))));
         try
         {
-            checkSSLExcluded("TLSv1", Transport.TCP, Transport.SSL);
-            fail("Should not be able to connect using TLSv1");
+            checkSSLExcluded("SSLv3", Transport.TCP, Transport.SSL);
+            fail("Should not be able to connect using SSLv3");
         }
         catch(SSLHandshakeException e)
         {
@@ -92,7 +134,6 @@ public class TCPandSSLTransportTest extends UnitTestBase
         }
     }
 
-
     @Test
     public void testNoTLSv1SupportOnSSLOnlyPort() throws Exception
     {
@@ -107,15 +148,13 @@ public class TCPandSSLTransportTest extends UnitTestBase
         }
     }
 
-
     @Test
-    public void testNoSSLv3SupportOnSharedPort() throws Exception
+    public void testNoTLSv1SupportOnSharedPort() throws Exception
     {
-        assumeThat("The IBM JDK has different TLS defaults", getJvmVendor(), is(not(equalTo(IBM))));
         try
         {
-            checkSSLExcluded("SSLv3", Transport.TCP, Transport.SSL);
-            fail("Should not be able to connect using SSLv3");
+            checkSSLExcluded("TLSv1", Transport.TCP, Transport.SSL);
+            fail("Should not be able to connect using TLSv1");
         }
         catch(SSLHandshakeException e)
         {
@@ -123,28 +162,67 @@ public class TCPandSSLTransportTest extends UnitTestBase
         }
     }
 
+    @Test
+    public void testNoTLSv1_1SupportOnSSLOnlyPort() throws Exception
+    {
+        try
+        {
+            checkSSLExcluded("TLSv1.1", Transport.SSL);
+            fail("Should not be able to connect using TLSv1.1");
+        }
+        catch(SSLHandshakeException e)
+        {
+            // pass
+        }
+    }
 
     @Test
-    public void testTLSSupportOnSharedPort() throws Exception
+    public void testNoTLSv1_1SupportOnSharedPort() throws Exception
     {
         try
         {
             checkSSLExcluded("TLSv1.1", Transport.TCP, Transport.SSL);
+            fail("Should not be able to connect using TLSv1.1");
         }
         catch(SSLHandshakeException e)
         {
-            LOGGER.error("Should be able to connect using TLSv1.1", e);
-            fail("Should be able to connect using TLSv1.1");
+            // pass
         }
     }
 
+    @Test
+    public void testTLSv1_2SupportOnSSLOnlyPort() throws Exception
+    {
+        try
+        {
+            checkSSLExcluded("TLSv1.2", Transport.SSL);
+        }
+        catch(SSLHandshakeException e)
+        {
+            LOGGER.error("Should be able to connect using TLSv1.2", e);
+            fail("Should be able to connect using TLSv1.2");
+        }
+    }
+
+    @Test
+    public void testTLSv1_2SupportOnSharedPort() throws Exception
+    {
+        try
+        {
+            checkSSLExcluded("TLSv1.2", Transport.TCP, Transport.SSL);
+        }
+        catch(SSLHandshakeException e)
+        {
+            LOGGER.error("Should be able to connect using TLSv1.2", e);
+            fail("Should be able to connect using TLSv1.2");
+        }
+    }
 
 
     private void checkSSLExcluded(String clientProtocol, final Transport... transports) throws Exception
     {
         KeyStore keyStore = KeyStore.getInstance("JKS");
-        keyStore.load(new ByteArrayInputStream(Base64.getDecoder().decode(keystoreString)), "password".toCharArray());
-
+        keyStore.load(new ByteArrayInputStream(Base64.getDecoder().decode(KEYSTORE_STRING)), "password".toCharArray());
 
         final SSLContext sslContext = SSLContext.getInstance("TLS");
         KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
@@ -152,8 +230,6 @@ public class TCPandSSLTransportTest extends UnitTestBase
 
         sslContext.init(kmf.getKeyManagers(), null, null);
 
-
-
         final AmqpPort<?> port = mock(AmqpPort.class);
         when(port.getPort()).thenReturn(0);
         when(port.getName()).thenReturn("testAmqp");
@@ -163,7 +239,8 @@ public class TCPandSSLTransportTest extends UnitTestBase
         when(port.getNumberOfSelectors()).thenReturn(1);
         when(port.getSSLContext()).thenReturn(sslContext);
         when(port.getContextValue(Long.class, AmqpPort.PORT_AMQP_THREAD_POOL_KEEP_ALIVE_TIMEOUT)).thenReturn(1L);
-        when(port.getContextValue(Integer.class, AmqpPort.PORT_AMQP_ACCEPT_BACKLOG)).thenReturn(AmqpPort.DEFAULT_PORT_AMQP_ACCEPT_BACKLOG);
+        when(port.getContextValue(Integer.class, AmqpPort.PORT_AMQP_ACCEPT_BACKLOG))
+                .thenReturn(AmqpPort.DEFAULT_PORT_AMQP_ACCEPT_BACKLOG);
         when(port.getProtocolHandshakeTimeout()).thenReturn(AmqpPort.DEFAULT_PROTOCOL_HANDSHAKE_TIMEOUT);
         ObjectMapper mapper = new ObjectMapper();
         JavaType type = mapper.getTypeFactory().constructCollectionType(List.class, String.class);
@@ -192,10 +269,8 @@ public class TCPandSSLTransportTest extends UnitTestBase
         clientContext.init(null, tmf.getTrustManagers(), null);
 
         try (SSLSocket sslSocket = (SSLSocket) clientContext.getSocketFactory()
-                                                            .createSocket(InetAddress.getLoopbackAddress(),
-                                                                          transport.getAcceptingPort()))
+                .createSocket(InetAddress.getLoopbackAddress(), transport.getAcceptingPort()))
         {
-
             sslSocket.setEnabledProtocols(new String[]{clientProtocol});
             sslSocket.startHandshake();
         }
@@ -204,48 +279,4 @@ public class TCPandSSLTransportTest extends UnitTestBase
             transport.close();
         }
     }
-
-
-
-    // self signed cert keystore valid until Oct 2024
-    private static String keystoreString = "/u3+7QAAAAIAAAABAAAAAQAKc2VsZnNpZ25lZAAAAUkYmo+uAAAFATCCBP0wDgYKKwYBBAEqAhEB"
-                                           + "AQUABIIE6bR+b7FHo2BRT/WG+zDIfO8zOXoGIbuNL2znNMnvEp9xwfMQOkhKxEbVtX8uJ7HSwi1V"
-                                           + "bV2it0CA59sgvRt9awmgg+W1CLgkGKNOB+kQZbjL8R8lXmKibw4yU/EFm5rqDqPEXBRBj40TF0aT"
-                                           + "GtCCmmLPsH2pGU1wH2Ne/tozk8q7hYK6XMH/i43ZXhS9V2CKzPWrzhXmvjFKCtmYHNLj5nLLE/n0"
-                                           + "snqAssBoFSAJKmqkqHQBJNQjm4oqJFSISB8pwDX++0kvOMM7j5ryjVwihsCYuHZ6lh5BntDGF41L"
-                                           + "f4XADfv3Fma6nZQKfKs0VU2kAWUmjPpyV1FFq/ua4x6SUdZKS22YIQ3t6iO76TDABbQNyUX+Ge4n"
-                                           + "k6clF8MFswKTT0ug7zjb17d36gwl+UznvFqMSE6Zkrr9nNAcSVlQS+JaazXveiVEXTBYCAZgsNw3"
-                                           + "3KqlLWliAegnwQCQLOguw7bgusnZ/E61/TL8GTryiwN1mltbnsWkCjMj1AGUBM3sYNwbj87Vdhij"
-                                           + "iHJbjcB7q3Dak68khrCTLmqoD43KHBB5g+UMlruXYbE0elWqYpXGjI5cvt4gzfh1V+ira5DOfa4B"
-                                           + "Qskv/dh1uj2xAe1YEvF3xmdO2F6Yuzd88VO0aaPGroYPfRmh2M6rEOlwc2Ku/p23FjSWrLyzori8"
-                                           + "8/OKV4PM2b/NtY51ztTKWR/eUdX6qTPUJMK5CJiOxKGxk9PDtmsbQY685H6QVDKzTkbaPlP97+Oa"
-                                           + "xv3/2RIWR7KJzsxbqiYhX0fevRJw/RY6ZY3NEE5RAmCjzxD+1qDtu0QM/LspgPxyv5oSInAtT23U"
-                                           + "BrcNIiQ8jO+6E+fDcVhFSrs6gLGe1BwKYHsosjvup8FETLZgqKY6g1mwECA/Un2agzhI4tGC0O8v"
-                                           + "lU4VEZKrXwgy/XQ5C2vwwgLvJh94OfE20Wuf7Jjq8IUPcdF201XeYREE/vSNcBnJf22yPouJMIPk"
-                                           + "yNxlAHcapeFUi00yC19FEIpdoW/8pX2k64jx63CwwVckWWOIWlg8N+z9jsiwdjvm5wL2aFU3+wtu"
-                                           + "8Nj6Soy7Y3QYAwx17q/nUOJOk5DqLedG+/DKXVs5jghmbQ9wyzqGjGs+xYvSCXtQJygETUU/ddoM"
-                                           + "/iK4hhnZL2uqZ0wamef4ibdBbhpoRO8C7mSbi7TbDtcfysZrMb6i5MugR+NwKKzN2DznXItvpgzc"
-                                           + "Xm9j7LP8HZcQANa+1o2aIGDqK1fMSAOmBbTWlYkHPDbpoE/lx32iBNL/Aj8aKbtkwy/J2JRvo9m2"
-                                           + "uBdLK4DoDeTjqG//AwISrwm9y6xxIIPNQq7GiftN6p9KCI87U5pxqs5yUQ1g/e9DCioLe8O3Vug7"
-                                           + "+1jS1ZHWFtb4BBEF3EhkKa1AOVKNu9+M8lcG9tKWUBjnIFTD68a++6B36ShRnIZNbmbRkLC6wWdB"
-                                           + "SdyI6FWPxsPvGSF+3wq+n+0bu75N3Xsta5tEOjc67DfnQlyZtP/BIZsKxgEueOcXkjzaXMPYcrlJ"
-                                           + "2BInovQSHnSHvQfaBKqj/nKcGaDyydfdxF5fyjRPFYF+fFCWXrFkbQgAst8ymJ//UpLomfw+Ni6f"
-                                           + "xx2XQGt3941zhRuXJI2tdvUb2Czzsp0tq+h46d0WOlYQ57Q70weUQRrtARqCKoSp/gNUzQsvd+FO"
-                                           + "sUUxKRoJltRYBwAAAAEABVguNTA5AAADdTCCA3EwggJZoAMCAQICBBAXeI4wDQYJKoZIhvcNAQEL"
-                                           + "BQAwaDELMAkGA1UEBhMCVUsxETAPBgNVBAgTCFNjb3RsYW5kMRAwDgYDVQQHEwdHbGFzZ293MQ8w"
-                                           + "DQYDVQQKEwZBcGFjaGUxDTALBgNVBAsTBFFwaWQxFDASBgNVBAMTC0FwYWNoZSBRcGlkMCAXDTE0"
-                                           + "MTAxNjEwNTY1NVoYDzIxMTMwNTEwMTA1NjU1WjBoMQswCQYDVQQGEwJVSzERMA8GA1UECBMIU2Nv"
-                                           + "dGxhbmQxEDAOBgNVBAcTB0dsYXNnb3cxDzANBgNVBAoTBkFwYWNoZTENMAsGA1UECxMEUXBpZDEU"
-                                           + "MBIGA1UEAxMLQXBhY2hlIFFwaWQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC520Yd"
-                                           + "1GuXh67h7HawvL5/pwTr46P45R0gx+LDGC1Equ9/wvvsVbCPL0JLDTSKl0qpgbJNMH/A740vSilb"
-                                           + "FDdqfyOuIkQZN1Ub9CkOaI5uR9RjaC2MfyNUJl7Gp64nSYk9iDX15ddZjsAijUDvET32XzfirlML"
-                                           + "dwLXv1Y5dLskV0r6xK4NdLtXi+Ndn+Uy4EllD7VMIFaLt6oG9Vo6mNl0jze7Yz/aYYtWns4x+uG8"
-                                           + "WbMgtcXo/VxCyp+4ji06XFerwfkS0zBS1wfvxd5Qb1+4dYovSn1v0AaPvZ0XwG4XErP2/svU01nc"
-                                           + "C43Z4neHdsj8Y/kmXLDD8Nc7Mpv/Wm6hAgMBAAGjITAfMB0GA1UdDgQWBBQfKBRPr/QD7PjpM3s4"
-                                           + "rD8u6ZxiijANBgkqhkiG9w0BAQsFAAOCAQEAFjyjJ8pbHf6MioZpOOlZh4lz6F+9dW1KyJR0OIc4"
-                                           + "FXnYnU/CNzjkwPminuZJoYgXBh+sVFN238YFS3I8ONEQJy8uSH33T81sklXhqnrSk9OlWk1v60wH"
-                                           + "NwwNFz5ZuGrGlvk9EFhbC8FgdkXJbz21drAl18i2oJHPdQQNwdc6mwqhpNfjqZ2opfJPbVscX1P/"
-                                           + "dbJjfcoZ01fy5687zjpN11G4egwsrya2FZiAw1WPI10OhrJgiGL5aDiDLjauNZmoM7QchUUD1cjE"
-                                           + "EwvRkU1MesliLg4y3UqDoV6ooHB4ClE2aKmIdbVB/eP1QrEEkey93ptt1z5fLk1l408AkXQtzyw7"
-                                           + "9WC+xnZta0IoYC/vO29IVsok";
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-broker-j] 02/02: QPID-8354: [Broker-J] Address review comments from Oleksandr Rudyy

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git

commit d4a3e0cab5fbf3be0760afd6999d23f088f064c4
Author: Tomas Vavricka <to...@deutsche-boerse.com>
AuthorDate: Fri Sep 20 13:51:28 2019 +0200

    QPID-8354: [Broker-J] Address review comments from Oleksandr Rudyy
    
    This closes #37
---
 .../server/transport/TCPandSSLTransportTest.java   | 62 ++++++++++++++++++----
 1 file changed, 53 insertions(+), 9 deletions(-)

diff --git a/broker-core/src/test/java/org/apache/qpid/server/transport/TCPandSSLTransportTest.java b/broker-core/src/test/java/org/apache/qpid/server/transport/TCPandSSLTransportTest.java
index c3ce9f3..e7726c0 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/transport/TCPandSSLTransportTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/transport/TCPandSSLTransportTest.java
@@ -110,7 +110,7 @@ public class TCPandSSLTransportTest extends UnitTestBase
         assumeThat("The IBM JDK has different TLS defaults", getJvmVendor(), is(not(equalTo(IBM))));
         try
         {
-            checkSSLExcluded("SSLv3", Transport.SSL);
+            checkHandshakeWithTlsProtocol("SSLv3", Transport.SSL);
             fail("Should not be able to connect using SSLv3");
         }
         catch(SSLHandshakeException e)
@@ -125,7 +125,7 @@ public class TCPandSSLTransportTest extends UnitTestBase
         assumeThat("The IBM JDK has different TLS defaults", getJvmVendor(), is(not(equalTo(IBM))));
         try
         {
-            checkSSLExcluded("SSLv3", Transport.TCP, Transport.SSL);
+            checkHandshakeWithTlsProtocol("SSLv3", Transport.TCP, Transport.SSL);
             fail("Should not be able to connect using SSLv3");
         }
         catch(SSLHandshakeException e)
@@ -139,7 +139,7 @@ public class TCPandSSLTransportTest extends UnitTestBase
     {
         try
         {
-            checkSSLExcluded("TLSv1", Transport.SSL);
+            checkHandshakeWithTlsProtocol("TLSv1", Transport.SSL);
             fail("Should not be able to connect using TLSv1");
         }
         catch(SSLHandshakeException e)
@@ -153,7 +153,7 @@ public class TCPandSSLTransportTest extends UnitTestBase
     {
         try
         {
-            checkSSLExcluded("TLSv1", Transport.TCP, Transport.SSL);
+            checkHandshakeWithTlsProtocol("TLSv1", Transport.TCP, Transport.SSL);
             fail("Should not be able to connect using TLSv1");
         }
         catch(SSLHandshakeException e)
@@ -167,7 +167,7 @@ public class TCPandSSLTransportTest extends UnitTestBase
     {
         try
         {
-            checkSSLExcluded("TLSv1.1", Transport.SSL);
+            checkHandshakeWithTlsProtocol("TLSv1.1", Transport.SSL);
             fail("Should not be able to connect using TLSv1.1");
         }
         catch(SSLHandshakeException e)
@@ -181,7 +181,7 @@ public class TCPandSSLTransportTest extends UnitTestBase
     {
         try
         {
-            checkSSLExcluded("TLSv1.1", Transport.TCP, Transport.SSL);
+            checkHandshakeWithTlsProtocol("TLSv1.1", Transport.TCP, Transport.SSL);
             fail("Should not be able to connect using TLSv1.1");
         }
         catch(SSLHandshakeException e)
@@ -195,7 +195,7 @@ public class TCPandSSLTransportTest extends UnitTestBase
     {
         try
         {
-            checkSSLExcluded("TLSv1.2", Transport.SSL);
+            checkHandshakeWithTlsProtocol("TLSv1.2", Transport.SSL);
         }
         catch(SSLHandshakeException e)
         {
@@ -209,7 +209,7 @@ public class TCPandSSLTransportTest extends UnitTestBase
     {
         try
         {
-            checkSSLExcluded("TLSv1.2", Transport.TCP, Transport.SSL);
+            checkHandshakeWithTlsProtocol("TLSv1.2", Transport.TCP, Transport.SSL);
         }
         catch(SSLHandshakeException e)
         {
@@ -218,8 +218,38 @@ public class TCPandSSLTransportTest extends UnitTestBase
         }
     }
 
+    @Test
+    public void testTLSv1_3SupportOnSSLOnlyPort() throws Exception
+    {
+        assumeThat("Java 11 or above is required", isJava11OrAbove(), is(true));
+        try
+        {
+            checkHandshakeWithTlsProtocol("TLSv1.3", Transport.SSL);
+        }
+        catch(SSLHandshakeException e)
+        {
+            LOGGER.error("Should be able to connect using TLSv1.3", e);
+            fail("Should be able to connect using TLSv1.3");
+        }
+    }
+
+    @Test
+    public void testTLSv1_3SupportOnSharedPort() throws Exception
+    {
+        assumeThat("Java 11 or above is required", isJava11OrAbove(), is(true));
+        try
+        {
+            checkHandshakeWithTlsProtocol("TLSv1.3", Transport.TCP, Transport.SSL);
+        }
+        catch(SSLHandshakeException e)
+        {
+            LOGGER.error("Should be able to connect using TLSv1.3", e);
+            fail("Should be able to connect using TLSv1.3");
+        }
+    }
+
 
-    private void checkSSLExcluded(String clientProtocol, final Transport... transports) throws Exception
+    private void checkHandshakeWithTlsProtocol(String clientProtocol, final Transport... transports) throws Exception
     {
         KeyStore keyStore = KeyStore.getInstance("JKS");
         keyStore.load(new ByteArrayInputStream(Base64.getDecoder().decode(KEYSTORE_STRING)), "password".toCharArray());
@@ -279,4 +309,18 @@ public class TCPandSSLTransportTest extends UnitTestBase
             transport.close();
         }
     }
+
+    private boolean isJava11OrAbove()
+    {
+        try
+        {
+            // introduced in java 11
+            Class.forName("java.net.http.HttpClient");
+            return true;
+        }
+        catch (ClassNotFoundException e)
+        {
+            return false;
+        }
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org