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

davsclaus pushed a commit to branch camel-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.18.x by this push:
     new 5afe20538025 [backport camel-4.18.x] CAMEL-25104: camel-core - 
SSLContextParameters should use TLSv1.2 as minimum protocol by default (#29863)
5afe20538025 is described below

commit 5afe205380253c46abca28f044019af77e9770db
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Nov 13 20:44:17 2026 +0100

    [backport camel-4.18.x] CAMEL-25104: camel-core - SSLContextParameters 
should use TLSv1.2 as minimum protocol by default (#29863)
    
    Backport of #27008 to camel-4.18.x.
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
---
 .../support/jsse/BaseSSLContextParameters.java     | 12 ++--
 .../SSLContextParametersDefaultProtocolsTest.java  | 66 ++++++++++++++++++++++
 .../ROOT/pages/camel-configuration-utilities.adoc  |  6 +-
 3 files changed, 77 insertions(+), 7 deletions(-)

diff --git 
a/core/camel-api/src/main/java/org/apache/camel/support/jsse/BaseSSLContextParameters.java
 
b/core/camel-api/src/main/java/org/apache/camel/support/jsse/BaseSSLContextParameters.java
index c7fe6d8ce233..0df782a63b1e 100644
--- 
a/core/camel-api/src/main/java/org/apache/camel/support/jsse/BaseSSLContextParameters.java
+++ 
b/core/camel-api/src/main/java/org/apache/camel/support/jsse/BaseSSLContextParameters.java
@@ -59,13 +59,13 @@ public abstract class BaseSSLContextParameters extends 
JsseParameters {
             = List.of(".*");
 
     protected static final List<String> DEFAULT_CIPHER_SUITES_FILTER_EXCLUDE
-            = List.of(".*_NULL_.*", ".*_anon_.*", ".*_EXPORT_.*", ".*_DES_.*", 
".*MD5", ".*RC4.*");
+            = List.of(".*_NULL_.*", ".*_anon_.*", ".*_EXPORT_.*", ".*_DES_.*", 
".*_3DES_.*", ".*MD5", ".*RC4.*");
 
     protected static final List<String> 
DEFAULT_SECURE_SOCKET_PROTOCOLS_FILTER_INCLUDE
             = List.of(".*");
 
     protected static final List<String> 
DEFAULT_SECURE_SOCKET_PROTOCOLS_FILTER_EXCLUDE
-            = List.of("SSL.*");
+            = List.of("SSL.*", "TLSv1", "TLSv1\\.1");
 
     private static final Logger LOG = 
LoggerFactory.getLogger(BaseSSLContextParameters.class);
 
@@ -590,7 +590,7 @@ public abstract class BaseSSLContextParameters extends 
JsseParameters {
             public SSLServerSocket configure(SSLServerSocket socket) {
 
                 Collection<String> filteredCipherSuites = 
BaseSSLContextParameters.this
-                        .filter(enabledCipherSuites, 
Arrays.asList(socket.getSupportedCipherSuites()),
+                        .filter(enabledCipherSuites, 
Arrays.asList(socket.getSSLParameters().getCipherSuites()),
                                 Arrays.asList(socket.getEnabledCipherSuites()),
                                 enabledCipherSuitePatterns, 
defaultEnabledCipherSuitePatterns,
                                 !allowPassthrough);
@@ -600,7 +600,7 @@ public abstract class BaseSSLContextParameters extends 
JsseParameters {
                             socket,
                             enabledCipherSuites,
                             enabledCipherSuitePatterns,
-                            socket.getSupportedCipherSuites(),
+                            socket.getSSLParameters().getCipherSuites(),
                             socket.getEnabledCipherSuites(),
                             defaultEnabledCipherSuitePatterns,
                             filteredCipherSuites);
@@ -609,7 +609,7 @@ public abstract class BaseSSLContextParameters extends 
JsseParameters {
                 socket.setEnabledCipherSuites(filteredCipherSuites.toArray(new 
String[0]));
 
                 Collection<String> filteredSecureSocketProtocols = 
BaseSSLContextParameters.this
-                        .filter(enabledSecureSocketProtocols, 
Arrays.asList(socket.getSupportedProtocols()),
+                        .filter(enabledSecureSocketProtocols, 
Arrays.asList(socket.getSSLParameters().getProtocols()),
                                 Arrays.asList(socket.getEnabledProtocols()),
                                 enabledSecureSocketProtocolsPatterns, 
defaultEnabledSecureSocketProtocolsPatterns,
                                 !allowPassthrough);
@@ -619,7 +619,7 @@ public abstract class BaseSSLContextParameters extends 
JsseParameters {
                             socket,
                             enabledSecureSocketProtocols,
                             enabledSecureSocketProtocolsPatterns,
-                            socket.getSupportedProtocols(),
+                            socket.getSSLParameters().getProtocols(),
                             socket.getEnabledProtocols(),
                             defaultEnabledSecureSocketProtocolsPatterns,
                             filteredSecureSocketProtocols);
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/support/jsse/SSLContextParametersDefaultProtocolsTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/support/jsse/SSLContextParametersDefaultProtocolsTest.java
new file mode 100644
index 000000000000..90f5cf398a12
--- /dev/null
+++ 
b/core/camel-core/src/test/java/org/apache/camel/support/jsse/SSLContextParametersDefaultProtocolsTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.support.jsse;
+
+import java.util.List;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLServerSocket;
+import javax.net.ssl.SSLSocket;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class SSLContextParametersDefaultProtocolsTest {
+
+    @Test
+    public void testDefaultProtocolsAreTls12OrNewer() throws Exception {
+        SSLContext context = new SSLContextParameters().createSSLContext(null);
+
+        SSLEngine engine = context.createSSLEngine();
+        SSLSocket socket = (SSLSocket) 
context.getSocketFactory().createSocket();
+        SSLServerSocket serverSocket = (SSLServerSocket) 
context.getServerSocketFactory().createServerSocket();
+
+        for (String[] protocols : List.of(engine.getEnabledProtocols(), 
socket.getEnabledProtocols(),
+                serverSocket.getEnabledProtocols())) {
+            List<String> list = List.of(protocols);
+            assertFalse(list.isEmpty());
+            assertFalse(list.contains("TLSv1"), list.toString());
+            assertFalse(list.contains("TLSv1.1"), list.toString());
+            assertTrue(list.contains("TLSv1.2") || list.contains("TLSv1.3"), 
list.toString());
+        }
+
+        // the server socket uses the same protocols and cipher suites as the 
socket and engine
+        assertEquals(List.of(engine.getEnabledProtocols()), 
List.of(serverSocket.getEnabledProtocols()));
+        assertEquals(List.of(engine.getEnabledCipherSuites()), 
List.of(serverSocket.getEnabledCipherSuites()));
+    }
+
+    @Test
+    public void testExplicitOlderProtocol() throws Exception {
+        SSLContextParameters scp = new SSLContextParameters();
+        SecureSocketProtocolsParameters protocols = new 
SecureSocketProtocolsParameters();
+        protocols.setSecureSocketProtocol(List.of("TLSv1.2"));
+        scp.setSecureSocketProtocols(protocols);
+
+        SSLEngine engine = scp.createSSLContext(null).createSSLEngine();
+        assertEquals(List.of("TLSv1.2"), 
List.of(engine.getEnabledProtocols()));
+    }
+}
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-configuration-utilities.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-configuration-utilities.adoc
index 295ad0a67378..63a6c29f3089 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-configuration-utilities.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-configuration-utilities.adoc
@@ -87,7 +87,7 @@ present, the default patterns applied are:
 [source,text]
 ----
 Includes .\*;
-Excludes .*_NULL_.*, .\*_anon_.*, .\*DES.*, .\*EXPORT.*, .\*MD5, .*RC4.*
+Excludes .*_NULL_.*, .\*_anon_.*, .\*_EXPORT_.*, .\*_DES_.*, .\*_3DES_.*, 
.\*MD5, .*RC4.*
 ----
 
 secureSocketProtocols::
@@ -111,8 +111,12 @@ are:
 [source,text]
 ----
 Includes .*
+Excludes SSL.*, TLSv1, TLSv1\.1
 ----
 
+This means TLSv1.2 is the minimum protocol by default. To enable an older 
protocol (not recommended) it must
+be configured explicitly in secureSocketProtocols.
+
 keyManagers::
 This optional property configures the source of key material for
 providing identity of client and server side connections as well as in

Reply via email to