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

smengcl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new e4ae41fc404 HDDS-17542. Re-enable TLSv1.3 by default on Ozone HTTPS 
endpoints (#11831)
e4ae41fc404 is described below

commit e4ae41fc4047c99af983020b4f33bd297c9d0ac5
Author: Siyao Meng <[email protected]>
AuthorDate: Fri Oct 30 10:57:53 2026 -0700

    HDDS-17542. Re-enable TLSv1.3 by default on Ozone HTTPS endpoints (#11831)
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 .../org/apache/hadoop/ozone/OzoneConfigKeys.java   |  1 +
 .../common/src/main/resources/ozone-default.xml    |  3 ++-
 .../hadoop/hdds/server/http/HttpServer2.java       |  5 +++-
 .../hdds/server/http/TestHttpServer2SSL.java       | 30 ++++++++++++++--------
 4 files changed, 27 insertions(+), 12 deletions(-)

diff --git 
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java 
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java
index e9f283269db..a6fcb792eea 100644
--- 
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java
+++ 
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java
@@ -573,6 +573,7 @@ public final class OzoneConfigKeys {
       "ozone.http.sni.host.check.enabled";
   public static final boolean OZONE_HTTP_SNI_HOST_CHECK_ENABLED_DEFAULT = 
false;
   public static final String  OZONE_SSL_ENABLED_PROTOCOLS = 
"ozone.ssl.enabled.protocols";
+  public static final String  OZONE_SSL_ENABLED_PROTOCOLS_DEFAULT = 
"TLSv1.2,TLSv1.3";
   public static final String  OZONE_SERVER_HTTPS_KEYSTORE_RESOURCE_KEY =
       "ozone.https.server.keystore.resource";
   public static final String  OZONE_SERVER_HTTPS_KEYSTORE_RESOURCE_DEFAULT =
diff --git a/hadoop-hdds/common/src/main/resources/ozone-default.xml 
b/hadoop-hdds/common/src/main/resources/ozone-default.xml
index f74c7f58648..a8174ddedb0 100644
--- a/hadoop-hdds/common/src/main/resources/ozone-default.xml
+++ b/hadoop-hdds/common/src/main/resources/ozone-default.xml
@@ -3930,7 +3930,8 @@
     <value/>
     <description>
       The supported SSL protocols used to restrict connections towards the 
WebUI of different components,
-      and the S3 GateWay.
+      and the S3 GateWay. If unset, hadoop.ssl.enabled.protocols is used when 
it is explicitly configured,
+      otherwise TLSv1.2,TLSv1.3.
     </description>
   </property>
   <property>
diff --git 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2.java
 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2.java
index f59d33209fc..ed5b95c4e88 100644
--- 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2.java
+++ 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2.java
@@ -683,8 +683,11 @@ private ServerConnector createHttpsChannelConnector(
     }
 
     private void setEnabledProtocols(SslContextFactory sslContextFactory) {
+      // core-default.xml sets hadoop.ssl.enabled.protocols to TLSv1.2, so 
honor it only when explicitly configured
       String enabledProtocols = 
conf.get(OzoneConfigKeys.OZONE_SSL_ENABLED_PROTOCOLS,
-          conf.get(SSLFactory.SSL_ENABLED_PROTOCOLS_KEY, 
SSLFactory.SSL_ENABLED_PROTOCOLS_DEFAULT));
+          conf.isExplicitlySet(SSLFactory.SSL_ENABLED_PROTOCOLS_KEY)
+              ? conf.get(SSLFactory.SSL_ENABLED_PROTOCOLS_KEY)
+              : OzoneConfigKeys.OZONE_SSL_ENABLED_PROTOCOLS_DEFAULT);
       List<String> originalExcludedProtocols = 
Arrays.asList(sslContextFactory.getExcludeProtocols());
       String[] enabledProtocolsArray = 
StringUtils.getTrimmedStrings(enabledProtocols);
 
diff --git 
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/server/http/TestHttpServer2SSL.java
 
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/server/http/TestHttpServer2SSL.java
index 31451584822..8cd44e0ee17 100644
--- 
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/server/http/TestHttpServer2SSL.java
+++ 
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/server/http/TestHttpServer2SSL.java
@@ -17,9 +17,9 @@
 
 package org.apache.hadoop.hdds.server.http;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
@@ -32,7 +32,6 @@
 import java.net.URI;
 import java.net.URL;
 import java.security.KeyStore;
-import java.util.Arrays;
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLHandshakeException;
@@ -150,13 +149,15 @@ public void testEnabledProtocolsTls12() throws Exception {
 
   @Test
   public void testEnabledProtocolsRejectsOther() throws Exception {
-    // Configure server to accept only TLSv1.2, try connecting with TLSv1.1
+    // Configure server to accept only TLSv1.2, try connecting with TLSv1.1 
and TLSv1.3
     HttpServer2 server = buildServer(null, null, "TLSv1.2");
     server.start();
     try {
       InetSocketAddress addr = server.getConnectorAddress(0);
       SSLSocketFactory factory = createSocketFactory(null, new 
String[]{"TLSv1.1"});
       assertThrows(Exception.class, () -> connectWithFactory(factory, addr));
+      SSLSocketFactory tls13Factory = createSocketFactory(null, new 
String[]{"TLSv1.3"});
+      assertThrows(Exception.class, () -> connectWithFactory(tls13Factory, 
addr));
     } finally {
       server.stop();
     }
@@ -172,6 +173,8 @@ public void testDefaultConfigAcceptsConnection() throws 
Exception {
       SSLSocketFactory factory = createSocketFactory(null, null);
       int responseCode = connectWithFactory(factory, addr);
       assertEquals(HttpURLConnection.HTTP_OK, responseCode);
+      SSLSocketFactory tls13Factory = createSocketFactory(null, new 
String[]{"TLSv1.3"});
+      assertEquals(HttpURLConnection.HTTP_OK, connectWithFactory(tls13Factory, 
addr));
     } finally {
       server.stop();
     }
@@ -235,7 +238,7 @@ public void testIpLiteralRejectedWhenSniHostCheckEnabled() 
throws Exception {
   public void testEnabledProtocolAppliedWhenConfigUnset() throws Exception {
     OzoneConfiguration serverConf = new OzoneConfiguration(conf);
     serverConf.unset(SSLFactory.SSL_ENABLED_PROTOCOLS_KEY);
-    assertServerAppliesEnabledProtocol(serverConf, 
SSLFactory.SSL_ENABLED_PROTOCOLS_DEFAULT);
+    assertServerAppliesEnabledProtocol(serverConf, "TLSv1.2", "TLSv1.3");
   }
 
   @Test
@@ -252,8 +255,16 @@ public void 
testEnabledProtocolAppliedWhenConfigSetToNonDefault() throws Excepti
     assertServerAppliesEnabledProtocol(serverConf, "TLSv1.3");
   }
 
+  @Test
+  public void testOzoneEnabledProtocolsTakesPrecedence() throws Exception {
+    OzoneConfiguration serverConf = new OzoneConfiguration(conf);
+    serverConf.set(SSLFactory.SSL_ENABLED_PROTOCOLS_KEY, "TLSv1.2");
+    serverConf.set(OzoneConfigKeys.OZONE_SSL_ENABLED_PROTOCOLS, "TLSv1.3");
+    assertServerAppliesEnabledProtocol(serverConf, "TLSv1.3");
+  }
+
   private void assertServerAppliesEnabledProtocol(
-      OzoneConfiguration serverConf, String protocol) throws Exception {
+      OzoneConfiguration serverConf, String... protocols) throws Exception {
     HttpServer2 server = buildServer(serverConf, null, null, null);
     server.start();
     try {
@@ -265,11 +276,10 @@ private void assertServerAppliesEnabledProtocol(
 
       SslContextFactory.Server sslContextFactory =
           (SslContextFactory.Server) connectionFactory.getSslContextFactory();
-      assertArrayEquals(new String[] {protocol},
-          sslContextFactory.getIncludeProtocols());
-      assertFalse(Arrays.asList(sslContextFactory.getExcludeProtocols())
-          .contains(protocol),
-          "Configured enabled protocol should be removed from excluded 
protocols");
+      assertArrayEquals(protocols, sslContextFactory.getIncludeProtocols());
+      assertThat(sslContextFactory.getExcludeProtocols())
+          .as("Configured enabled protocols should be removed from excluded 
protocols")
+          .doesNotContain(protocols);
     } finally {
       server.stop();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to