Skip to content

Commit f46343b

Browse files
committed
Default TLS protocol to TLSv1.3 and warn when not enabled
BREAKING CHANGE: Changes the default TLS protocol from "TLSv1.3,TLSv1.2" to just "TLSv1.3". Applications requiring TLSv1.2 support must now explicitly configure it using the `protocols` property (set to TLSv1.3,TLSv1.2) Adds a warning log when TLSv1.3 is not enabled in a TLS bucket configuration.
1 parent 26c975f commit f46343b

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/VertxCertificateHolder.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@
33
import java.nio.file.Path;
44
import java.security.KeyStore;
55
import java.security.SecureRandom;
6-
import java.util.ArrayList;
7-
import java.util.Collections;
8-
import java.util.List;
9-
import java.util.Optional;
6+
import java.util.*;
107
import java.util.concurrent.TimeUnit;
118

12-
import javax.net.ssl.KeyManager;
13-
import javax.net.ssl.KeyManagerFactory;
14-
import javax.net.ssl.SSLContext;
15-
import javax.net.ssl.TrustManager;
16-
import javax.net.ssl.TrustManagerFactory;
9+
import javax.net.ssl.*;
10+
11+
import org.jboss.logging.Logger;
1712

1813
import io.quarkus.tls.TlsConfiguration;
1914
import io.quarkus.tls.runtime.config.TlsBucketConfig;
@@ -114,6 +109,8 @@ public synchronized SSLOptions getSSLOptions() {
114109
options.setSslHandshakeTimeout(config().handshakeTimeout().toSeconds());
115110
options.setEnabledSecureTransportProtocols(config().protocols());
116111

112+
warnIfNotTls13(options.getEnabledSecureTransportProtocols(), name);
113+
117114
for (Buffer buffer : crls) {
118115
options.addCrlValue(buffer);
119116
}
@@ -125,6 +122,14 @@ public synchronized SSLOptions getSSLOptions() {
125122
return options;
126123
}
127124

125+
private void warnIfNotTls13(Set<String> protocols, String name) {
126+
if (!protocols.stream().map(String::toLowerCase).toList().contains("TLSv1.3".toLowerCase())) {
127+
Logger.getLogger(VertxCertificateHolder.class.getName())
128+
.warn("TLSv1.3 protocol is not enabled in TLS bucket '" + name +
129+
"'. It is *strongly* recommended to enable TLSv1.3.");
130+
}
131+
}
132+
128133
@Override
129134
public boolean isTrustAll() {
130135
return config().trustAll() || getTrustStoreOptions() == TrustAllOptions.INSTANCE;

extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/config/TlsBucketConfig.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@ public interface TlsBucketConfig {
4040
/**
4141
* Sets the ordered list of enabled TLS protocols.
4242
* <p>
43-
* If not set, it defaults to {@code "TLSv1.3, TLSv1.2"}.
43+
* If not set, it defaults to {@code "TLSv1.3"}.
4444
* The following list of protocols are supported: {@code TLSv1, TLSv1.1, TLSv1.2, TLSv1.3}.
45-
* To only enable {@code TLSv1.3}, set the value to {@code to "TLSv1.3"}.
45+
* To enable {@code TLSv1.3} and {@code TLSv1.2}, set the value to {@code to "TLSv1.3, TLSv1.2"}.
4646
* <p>
4747
* Note that setting an empty list, and enabling TLS is invalid.
4848
* You must at least have one protocol.
4949
* <p>
50-
* Also, setting this replaces the default list of protocols.
5150
*/
52-
@WithDefault("TLSv1.3,TLSv1.2")
51+
@WithDefault("TLSv1.3")
5352
Set<String> protocols();
5453

5554
/**

0 commit comments

Comments
 (0)