Skip to content

Commit 94ce2b5

Browse files
committed
Update ciphers for TLSv1.3 and JDK11 if available
This commit updates the default ciphers and TLS protocols that are used when the runtime JDK supports them. New cipher support has been introduced in JDK 11 and 12 along with performance fixes for AES GCM. The ciphers are ordered with PFS ciphers being most preferred, then AEAD ciphers, and finally those with mainstream hardware support. When available stronger encryption is preferred for a given cipher. This is a backport of elastic#41385 and elastic#41808. There are known JDK bugs with TLSv1.3 that have been fixed in various versions. These are: 1. The JDK's bundled HttpsServer will endless loop under JDK11 and JDK 12.0 (Fixed in 12.0.1) based on the way the Apache HttpClient performs a close (half close). 2. In all versions of JDK 11 and 12, the HttpsServer will endless loop when certificates are not trusted or another handshake error occurs. An email has been sent to the openjdk security-dev list and elastic#38646 is open to track this. 3. In JDK 11.0.2 and prior there is a race condition with session resumption that leads to handshake errors when multiple concurrent handshakes are going on between the same client and server. This bug does not appear when client authentication is in use. This is JDK-8213202, which was fixed in 11.0.3 and 12.0. 4. In JDK 11.0.2 and prior there is a bug where resumed TLS sessions do not retain peer certificate information. This is JDK-8212885. The way these issues are addressed is that the current java version is checked and used to determine the supported protocols for tests that provoke these issues.
1 parent 44c3418 commit 94ce2b5

File tree

27 files changed

+553
-88
lines changed

27 files changed

+553
-88
lines changed

client/rest/src/test/java/org/elasticsearch/client/RestClientBuilderIntegTests.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@
3838
import java.net.InetSocketAddress;
3939
import java.nio.file.Files;
4040
import java.nio.file.Paths;
41+
import java.security.AccessController;
4142
import java.security.KeyFactory;
4243
import java.security.KeyStore;
44+
import java.security.PrivilegedAction;
4345
import java.security.cert.Certificate;
4446
import java.security.cert.CertificateFactory;
4547
import java.security.spec.PKCS8EncodedKeySpec;
@@ -106,7 +108,7 @@ private RestClient buildRestClient() {
106108
}
107109

108110
private static SSLContext getSslContext() throws Exception {
109-
SSLContext sslContext = SSLContext.getInstance("TLS");
111+
SSLContext sslContext = SSLContext.getInstance(getProtocol());
110112
try (InputStream certFile = RestClientBuilderIntegTests.class.getResourceAsStream("/test.crt")) {
111113
// Build a keystore of default type programmatically since we can't use JKS keystores to
112114
// init a KeyManagerFactory in FIPS 140 JVMs.
@@ -126,4 +128,37 @@ private static SSLContext getSslContext() throws Exception {
126128
}
127129
return sslContext;
128130
}
131+
132+
/**
133+
* The {@link HttpsServer} in the JDK has issues with TLSv1.3 when running in a JDK that supports TLSv1.3 prior to
134+
* 12.0.1 so we pin to TLSv1.2 when running on an earlier JDK.
135+
*/
136+
private static String getProtocol() {
137+
String version = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty("java.version"));
138+
String[] components = version.split("\\.");
139+
if (components.length > 0) {
140+
final int major = Integer.valueOf(components[0]);
141+
if (major < 11) {
142+
return "TLS";
143+
} if (major > 12) {
144+
return "TLS";
145+
} else if (major == 12 && components.length > 2) {
146+
final int minor = Integer.valueOf(components[1]);
147+
if (minor > 0) {
148+
return "TLS";
149+
} else {
150+
String patch = components[2];
151+
final int index = patch.indexOf("_");
152+
if (index > -1) {
153+
patch = patch.substring(0, index);
154+
}
155+
156+
if (Integer.valueOf(patch) >= 1) {
157+
return "TLS";
158+
}
159+
}
160+
}
161+
}
162+
return "TLSv1.2";
163+
}
129164
}

docs/reference/settings/security-settings.asciidoc

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,13 +1526,30 @@ Controls the verification of certificates. Valid values are:
15261526
The default value is `full`.
15271527

15281528
`*.ssl.cipher_suites`::
1529-
Supported cipher suites can be found in Oracle's http://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html[
1530-
Java Cryptography Architecture documentation]. Defaults to `TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256`,
1531-
`TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256`, `TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA`, `TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA`,
1532-
`TLS_RSA_WITH_AES_128_CBC_SHA256`, `TLS_RSA_WITH_AES_128_CBC_SHA`. If the _Java Cryptography Extension (JCE) Unlimited Strength
1533-
Jurisdiction Policy Files_ has been installed, the default value also includes `TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384`,
1534-
`TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384`, `TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA`, `TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA`,
1535-
`TLS_RSA_WITH_AES_256_CBC_SHA256`, `TLS_RSA_WITH_AES_256_CBC_SHA`.
1529+
Supported cipher suites can be found in Oracle's
1530+
https://docs.oracle.com/en/java/javase/11/security/oracle-providers.html#GUID-7093246A-31A3-4304-AC5F-5FB6400405E2[Java
1531+
Cryptography Architecture documentation].
1532+
Defaults to `TLS_AES_256_GCM_SHA384`, `TLS_AES_128_GCM_SHA256`,
1533+
`TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384`, `TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256`,
1534+
`TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384`, `TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256`,
1535+
`TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384`, `TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256`,
1536+
`TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384`, `TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256`,
1537+
`TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA`, `TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA`,
1538+
`TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA`, `TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA`,
1539+
`TLS_RSA_WITH_AES_256_GCM_SHA384`, `TLS_RSA_WITH_AES_128_GCM_SHA256`,
1540+
`TLS_RSA_WITH_AES_256_CBC_SHA256`, `TLS_RSA_WITH_AES_128_CBC_SHA256`,
1541+
`TLS_RSA_WITH_AES_256_CBC_SHA`, `TLS_RSA_WITH_AES_128_CBC_SHA`.
1542+
+
1543+
--
1544+
NOTE: The default cipher suites list above includes TLSv1.3 ciphers and ciphers
1545+
that require the _Java Cryptography Extension (JCE) Unlimited Strength
1546+
Jurisdiction Policy Files_ for 256-bit AES encryption. If TLSv1.3 is not
1547+
available, the TLSv1.3 ciphers TLS_AES_256_GCM_SHA384`, `TLS_AES_128_GCM_SHA256`
1548+
will not be included in the default list. If 256-bit AES is unavailable, ciphers
1549+
with `AES_256` in their names wil not be included in the default list. Finally,
1550+
AES GCM has known performance issues in Java versions prior to 11 and will only
1551+
be included in the default list when using Java 11 or above.
1552+
--
15361553

15371554
[float]
15381555
[[tls-ssl-key-settings]]

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

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
package org.elasticsearch.common.ssl;
2121

22+
import org.elasticsearch.bootstrap.JavaVersion;
23+
2224
import javax.crypto.Cipher;
2325
import javax.net.ssl.KeyManagerFactory;
2426
import javax.net.ssl.TrustManagerFactory;
@@ -338,30 +340,53 @@ private <V> List<V> resolveListSetting(String key, Function<String, V> parser, L
338340
}
339341

340342
private static List<String> loadDefaultCiphers() {
341-
final List<String> ciphers128 = Arrays.asList(
342-
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
343-
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
344-
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
345-
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
346-
"TLS_RSA_WITH_AES_128_CBC_SHA256",
347-
"TLS_RSA_WITH_AES_128_CBC_SHA"
348-
);
349-
final List<String> ciphers256 = Arrays.asList(
350-
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",
351-
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384",
352-
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
353-
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
354-
"TLS_RSA_WITH_AES_256_CBC_SHA256",
355-
"TLS_RSA_WITH_AES_256_CBC_SHA"
356-
);
357-
if (has256BitAES()) {
358-
List<String> ciphers = new ArrayList<>(ciphers256.size() + ciphers128.size());
359-
ciphers.addAll(ciphers256);
360-
ciphers.addAll(ciphers128);
361-
return ciphers;
343+
final boolean has256BitAES = has256BitAES();
344+
final boolean useGCM = JavaVersion.current().compareTo(JavaVersion.parse("11")) >= 0;
345+
final boolean tlsV13Supported = DEFAULT_PROTOCOLS.contains("TLSv1.3");
346+
List<String> ciphers = new ArrayList<>();
347+
if (tlsV13Supported) { // TLSv1.3 cipher has PFS, AEAD, hardware support
348+
if (has256BitAES) {
349+
ciphers.add("TLS_AES_256_GCM_SHA384");
350+
}
351+
ciphers.add("TLS_AES_128_GCM_SHA256");
352+
}
353+
if (useGCM) { // PFS, AEAD, hardware support
354+
if (has256BitAES) {
355+
ciphers.addAll(Arrays.asList("TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
356+
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"));
357+
} else {
358+
ciphers.addAll(Arrays.asList("TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"));
359+
}
360+
}
361+
362+
// PFS, hardware support
363+
if (has256BitAES) {
364+
ciphers.addAll(Arrays.asList("TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
365+
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
366+
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
367+
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"));
368+
} else {
369+
ciphers.addAll(Arrays.asList("TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
370+
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"));
371+
}
372+
373+
// AEAD, hardware support
374+
if (useGCM) {
375+
if (has256BitAES) {
376+
ciphers.addAll(Arrays.asList("TLS_RSA_WITH_AES_256_GCM_SHA384", "TLS_RSA_WITH_AES_128_GCM_SHA256"));
377+
} else {
378+
ciphers.add("TLS_RSA_WITH_AES_128_GCM_SHA256");
379+
}
380+
}
381+
382+
// hardware support
383+
if (has256BitAES) {
384+
ciphers.addAll(Arrays.asList("TLS_RSA_WITH_AES_256_CBC_SHA256", "TLS_RSA_WITH_AES_128_CBC_SHA256",
385+
"TLS_RSA_WITH_AES_256_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA"));
362386
} else {
363-
return ciphers128;
387+
ciphers.addAll(Arrays.asList("TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_RSA_WITH_AES_128_CBC_SHA"));
364388
}
389+
return ciphers;
365390
}
366391

367392
private static boolean has256BitAES() {

modules/reindex/src/test/java/org/elasticsearch/index/reindex/ReindexRestClientSslTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public void testClientFailsWithUntrustedCertificate() throws IOException {
120120
final List<Thread> threads = new ArrayList<>();
121121
final Settings settings = Settings.builder()
122122
.put("path.home", createTempDir())
123+
.put("reindex.ssl.supported_protocols", "TLSv1.2")
123124
.build();
124125
final Environment environment = TestEnvironment.newEnvironment(settings);
125126
final ReindexSslConfig ssl = new ReindexSslConfig(settings, environment, mock(ResourceWatcherService.class));
@@ -134,6 +135,7 @@ public void testClientSucceedsWithCertificateAuthorities() throws IOException {
134135
final Settings settings = Settings.builder()
135136
.put("path.home", createTempDir())
136137
.putList("reindex.ssl.certificate_authorities", ca.toString())
138+
.put("reindex.ssl.supported_protocols", "TLSv1.2")
137139
.build();
138140
final Environment environment = TestEnvironment.newEnvironment(settings);
139141
final ReindexSslConfig ssl = new ReindexSslConfig(settings, environment, mock(ResourceWatcherService.class));
@@ -149,6 +151,7 @@ public void testClientSucceedsWithVerificationDisabled() throws IOException {
149151
final Settings settings = Settings.builder()
150152
.put("path.home", createTempDir())
151153
.put("reindex.ssl.verification_mode", "NONE")
154+
.put("reindex.ssl.supported_protocols", "TLSv1.2")
152155
.build();
153156
final Environment environment = TestEnvironment.newEnvironment(settings);
154157
final ReindexSslConfig ssl = new ReindexSslConfig(settings, environment, mock(ResourceWatcherService.class));
@@ -169,6 +172,7 @@ public void testClientPassesClientCertificate() throws IOException {
169172
.put("reindex.ssl.certificate", cert)
170173
.put("reindex.ssl.key", key)
171174
.put("reindex.ssl.key_passphrase", "client-password")
175+
.put("reindex.ssl.supported_protocols", "TLSv1.2")
172176
.build();
173177
AtomicReference<Certificate[]> clientCertificates = new AtomicReference<>();
174178
handler = https -> {

plugins/discovery-azure-classic/src/test/java/org/elasticsearch/discovery/azure/classic/AzureDiscoveryClusterFormationTests.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.sun.net.httpserver.HttpsConfigurator;
2626
import com.sun.net.httpserver.HttpsServer;
2727
import org.apache.logging.log4j.LogManager;
28+
import org.elasticsearch.bootstrap.JavaVersion;
2829
import org.elasticsearch.cloud.azure.classic.management.AzureComputeService;
2930
import org.elasticsearch.common.SuppressForbidden;
3031
import org.elasticsearch.common.io.FileSystemUtils;
@@ -59,7 +60,9 @@
5960
import java.nio.charset.StandardCharsets;
6061
import java.nio.file.Files;
6162
import java.nio.file.Path;
63+
import java.security.AccessController;
6264
import java.security.KeyStore;
65+
import java.security.PrivilegedAction;
6366
import java.util.Arrays;
6467
import java.util.Collection;
6568
import java.util.Collections;
@@ -262,11 +265,30 @@ private static SSLContext getSSLContext() throws Exception {
262265
kmf.init(ks, passphrase);
263266
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
264267
tmf.init(ks);
265-
SSLContext ssl = SSLContext.getInstance("TLS");
268+
SSLContext ssl = SSLContext.getInstance(getProtocol());
266269
ssl.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
267270
return ssl;
268271
}
269272

273+
/**
274+
* The {@link HttpsServer} in the JDK has issues with TLSv1.3 when running in a JDK prior to
275+
* 12.0.1 so we pin to TLSv1.2 when running on an earlier JDK
276+
*/
277+
private static String getProtocol() {
278+
if (JavaVersion.current().compareTo(JavaVersion.parse("11")) < 0) {
279+
return "TLS";
280+
} else if (JavaVersion.current().compareTo(JavaVersion.parse("12")) < 0) {
281+
return "TLSv1.2";
282+
} else {
283+
JavaVersion full =
284+
AccessController.doPrivileged((PrivilegedAction<JavaVersion>) () -> JavaVersion.parse(System.getProperty("java.version")));
285+
if (full.compareTo(JavaVersion.parse("12.0.1")) < 0) {
286+
return "TLSv1.2";
287+
}
288+
}
289+
return "TLS";
290+
}
291+
270292
@AfterClass
271293
public static void stopHttpd() throws IOException {
272294
for (int i = 0; i < internalCluster().size(); i++) {

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java

Lines changed: 59 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package org.elasticsearch.xpack.core;
88

99
import org.apache.logging.log4j.LogManager;
10+
import org.elasticsearch.bootstrap.JavaVersion;
1011
import org.elasticsearch.common.settings.Setting;
1112
import org.elasticsearch.common.settings.Setting.Property;
1213
import org.elasticsearch.xpack.core.security.SecurityField;
@@ -118,31 +119,79 @@ private XPackSettings() {
118119
/** Setting for enabling or disabling sql. Defaults to true. */
119120
public static final Setting<Boolean> SQL_ENABLED = Setting.boolSetting("xpack.sql.enabled", true, Setting.Property.NodeScope);
120121

122+
public static final List<String> DEFAULT_SUPPORTED_PROTOCOLS;
123+
124+
static {
125+
boolean supportsTLSv13 = false;
126+
try {
127+
SSLContext.getInstance("TLSv1.3");
128+
supportsTLSv13 = true;
129+
} catch (NoSuchAlgorithmException e) {
130+
LogManager.getLogger(XPackSettings.class).debug("TLSv1.3 is not supported", e);
131+
}
132+
DEFAULT_SUPPORTED_PROTOCOLS = supportsTLSv13 ?
133+
Arrays.asList("TLSv1.3", "TLSv1.2", "TLSv1.1") : Arrays.asList("TLSv1.2", "TLSv1.1");
134+
}
135+
121136
/*
122137
* SSL settings. These are the settings that are specifically registered for SSL. Many are private as we do not explicitly use them
123138
* but instead parse based on a prefix (eg *.ssl.*)
124139
*/
125140
public static final List<String> DEFAULT_CIPHERS;
126141

127142
static {
128-
List<String> ciphers = Arrays.asList("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
129-
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256",
130-
"TLS_RSA_WITH_AES_128_CBC_SHA");
143+
List<String> ciphers = new ArrayList<>();
144+
final boolean useGCM = JavaVersion.current().compareTo(JavaVersion.parse("11")) >= 0;
145+
final boolean tlsV13Supported = DEFAULT_SUPPORTED_PROTOCOLS.contains("TLSv1.3");
131146
try {
132147
final boolean use256Bit = Cipher.getMaxAllowedKeyLength("AES") > 128;
148+
if (tlsV13Supported) { // TLSv1.3 cipher has PFS, AEAD, hardware support
149+
if (use256Bit) {
150+
ciphers.add("TLS_AES_256_GCM_SHA384");
151+
}
152+
ciphers.add("TLS_AES_128_GCM_SHA256");
153+
}
154+
if (useGCM) { // PFS, AEAD, hardware support
155+
if (use256Bit) {
156+
ciphers.addAll(Arrays.asList("TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
157+
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"));
158+
} else {
159+
ciphers.addAll(Arrays.asList("TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"));
160+
}
161+
}
162+
163+
// PFS, hardware support
164+
if (use256Bit) {
165+
ciphers.addAll(Arrays.asList("TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
166+
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
167+
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
168+
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"));
169+
} else {
170+
ciphers.addAll(Arrays.asList("TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
171+
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"));
172+
}
173+
174+
// AEAD, hardware support
175+
if (useGCM) {
176+
if (use256Bit) {
177+
ciphers.addAll(Arrays.asList("TLS_RSA_WITH_AES_256_GCM_SHA384", "TLS_RSA_WITH_AES_128_GCM_SHA256"));
178+
} else {
179+
ciphers.add("TLS_RSA_WITH_AES_128_GCM_SHA256");
180+
}
181+
}
182+
183+
// hardware support
133184
if (use256Bit) {
134-
List<String> strongerCiphers = new ArrayList<>(ciphers.size() * 2);
135-
strongerCiphers.addAll(Arrays.asList("TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",
136-
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
137-
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", "TLS_RSA_WITH_AES_256_CBC_SHA256", "TLS_RSA_WITH_AES_256_CBC_SHA"));
138-
strongerCiphers.addAll(ciphers);
139-
ciphers = strongerCiphers;
185+
ciphers.addAll(Arrays.asList("TLS_RSA_WITH_AES_256_CBC_SHA256", "TLS_RSA_WITH_AES_128_CBC_SHA256",
186+
"TLS_RSA_WITH_AES_256_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA"));
187+
} else {
188+
ciphers.addAll(Arrays.asList("TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_RSA_WITH_AES_128_CBC_SHA"));
140189
}
141190
} catch (NoSuchAlgorithmException e) {
142191
// ignore it here - there will be issues elsewhere and its not nice to throw in a static initializer
143192
}
144193

145-
DEFAULT_CIPHERS = ciphers;
194+
DEFAULT_CIPHERS = Collections.unmodifiableList(ciphers);
146195
}
147196

148197
/*
@@ -164,20 +213,6 @@ private XPackSettings() {
164213
}
165214
}, Setting.Property.NodeScope);
166215

167-
public static final List<String> DEFAULT_SUPPORTED_PROTOCOLS;
168-
169-
static {
170-
boolean supportsTLSv13 = false;
171-
try {
172-
SSLContext.getInstance("TLSv1.3");
173-
supportsTLSv13 = true;
174-
} catch (NoSuchAlgorithmException e) {
175-
LogManager.getLogger(XPackSettings.class).debug("TLSv1.3 is not supported", e);
176-
}
177-
DEFAULT_SUPPORTED_PROTOCOLS = supportsTLSv13 ?
178-
Arrays.asList("TLSv1.3", "TLSv1.2", "TLSv1.1") : Arrays.asList("TLSv1.2", "TLSv1.1");
179-
}
180-
181216
public static final SSLClientAuth CLIENT_AUTH_DEFAULT = SSLClientAuth.REQUIRED;
182217
public static final SSLClientAuth HTTP_CLIENT_AUTH_DEFAULT = SSLClientAuth.NONE;
183218
public static final VerificationMode VERIFICATION_MODE_DEFAULT = VerificationMode.FULL;

0 commit comments

Comments
 (0)