Skip to content

Commit f2cfd36

Browse files
authored
Always allow both TLS 1.2 and 1.3 (#2978)
The JDK version of SSL has long supported TLS v1.3 (since version 11) so fortunately we can use TLS v1.3 regardless if which implementation of SSL we're using. We prefer OpenSSL in general so I'm not entirely sure why we were using the JDK version of SSL on the proxy before, but this should work and be a good idea regardless. Tested on alpha by running ``` $ openssl s_client -connect epp.registryalpha.foo:700 -tls1_3 -ciphersuites "TLS_AES_128_GCM_SHA256" ``` Previously we'd get a failure, now it returns the proper cert data.
1 parent 8ea5fe3 commit f2cfd36

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

networking/src/main/java/google/registry/networking/handler/SslServerInitializer.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ public class SslServerInitializer<C extends Channel> extends ChannelInitializer<
7070
/**
7171
* The list of cipher suites that are currently acceptable to create a successful handshake.
7272
*
73-
* <p>This list includes all of the current TLS1.3 ciphers and a collection of TLS1.2 ciphers with
74-
* no known security vulnerabilities. Note that OpenSSL uses a separate nomenclature for the
75-
* ciphers internally but the IANA names listed here will be transparently translated by the
76-
* OpenSSL provider (if used), so there is no need to include the OpenSSL name variants here. More
73+
* <p>This list includes all the current TLS1.3 ciphers and a collection of TLS1.2 ciphers with no
74+
* known security vulnerabilities. Note that OpenSSL uses a separate nomenclature for the ciphers
75+
* internally but the IANA names listed here will be transparently translated by the OpenSSL
76+
* provider (if used), so there is no need to include the OpenSSL name variants here. More
7777
* information about these cipher suites and their OpenSSL names can be found at ciphersuite.info.
7878
*/
7979
private static final ImmutableList<String> ALLOWED_TLS_CIPHERS =
@@ -90,6 +90,10 @@ public class SslServerInitializer<C extends Channel> extends ChannelInitializer<
9090
"TLS_AES_128_CCM_SHA256",
9191
"TLS_AES_128_CCM_8_SHA256");
9292

93+
/** Thankfully, the JDK supports TLS version 1.3 now. */
94+
private static final ImmutableList<String> SUPPORTED_TLS_VERSIONS =
95+
ImmutableList.of("TLSv1.3", "TLSv1.2");
96+
9397
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
9498
private final boolean requireClientCert;
9599
// TODO(jianglai): Always validate client certs (if required).
@@ -99,7 +103,6 @@ public class SslServerInitializer<C extends Channel> extends ChannelInitializer<
99103
// change when the artifacts on GCS changes.
100104
private final Supplier<PrivateKey> privateKeySupplier;
101105
private final Supplier<ImmutableList<X509Certificate>> certificatesSupplier;
102-
private final ImmutableList<String> supportedSslVersions;
103106

104107
public SslServerInitializer(
105108
boolean requireClientCert,
@@ -116,12 +119,6 @@ public SslServerInitializer(
116119
this.sslProvider = sslProvider;
117120
this.privateKeySupplier = privateKeySupplier;
118121
this.certificatesSupplier = certificatesSupplier;
119-
this.supportedSslVersions =
120-
sslProvider == SslProvider.OPENSSL
121-
? ImmutableList.of("TLSv1.3", "TLSv1.2")
122-
// JDK support for TLS 1.3 won't be available until 2021-04-20 at the earliest.
123-
// See: https://java.com/en/jre-jdk-cryptoroadmap.html
124-
: ImmutableList.of("TLSv1.2");
125122
}
126123

127124
@Override
@@ -133,7 +130,7 @@ protected void initChannel(C channel) throws Exception {
133130
.sslProvider(sslProvider)
134131
.trustManager(InsecureTrustManagerFactory.INSTANCE)
135132
.clientAuth(requireClientCert ? ClientAuth.REQUIRE : ClientAuth.NONE)
136-
.protocols(supportedSslVersions)
133+
.protocols(SUPPORTED_TLS_VERSIONS)
137134
.ciphers(ALLOWED_TLS_CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
138135
.build();
139136

0 commit comments

Comments
 (0)