Skip to content

Commit d140fe0

Browse files
committed
try changing default ciphers
1 parent 932b4a3 commit d140fe0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/SslConfigurationLoader.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.Set;
1919
import java.util.function.Function;
2020
import java.util.stream.Collectors;
21+
import java.util.stream.Stream;
2122

2223
import javax.net.ssl.KeyManagerFactory;
2324
import javax.net.ssl.TrustManagerFactory;
@@ -62,7 +63,7 @@ public abstract class SslConfigurationLoader {
6263

6364
static final List<String> DEFAULT_PROTOCOLS = List.of("TLSv1.3", "TLSv1.2");
6465

65-
private static final List<String> JDK12_CIPHERS = List.of(
66+
private static final List<String> JDK24_CIPHERS = List.of(
6667
// TLSv1.3 cipher has PFS, AEAD, hardware support
6768
"TLS_AES_256_GCM_SHA384",
6869
"TLS_AES_128_GCM_SHA256",
@@ -96,8 +97,13 @@ public abstract class SslConfigurationLoader {
9697

9798
// PFS, hardware support
9899
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
99-
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
100+
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"
101+
);
102+
100103

104+
private static final List<String> JDK12_CIPHERS = Stream.concat(
105+
JDK24_CIPHERS.stream(),
106+
List.of(
101107
// AEAD, hardware support
102108
"TLS_RSA_WITH_AES_256_GCM_SHA384",
103109
"TLS_RSA_WITH_AES_128_GCM_SHA256",
@@ -109,9 +115,9 @@ public abstract class SslConfigurationLoader {
109115
// hardware support
110116
"TLS_RSA_WITH_AES_256_CBC_SHA",
111117
"TLS_RSA_WITH_AES_128_CBC_SHA"
112-
);
118+
).stream()).toList();
113119

114-
static final List<String> DEFAULT_CIPHERS = JDK12_CIPHERS;
120+
static final List<String> DEFAULT_CIPHERS = Runtime.version().feature() >= 24 ? JDK24_CIPHERS : JDK12_CIPHERS;
115121
private static final char[] EMPTY_PASSWORD = new char[0];
116122
public static final List<X509Field> GLOBAL_DEFAULT_RESTRICTED_TRUST_FIELDS = List.of(X509Field.SAN_OTHERNAME_COMMONNAME);
117123

0 commit comments

Comments
 (0)