Skip to content

Commit 8860601

Browse files
committed
Sync documentation of main branch
1 parent 2564e62 commit 8860601

File tree

1 file changed

+51
-16
lines changed

1 file changed

+51
-16
lines changed

_versions/main/guides/tls-registry-reference.adoc

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,41 @@ certificate. Dynamic clients are `@Dependent` scoped, so you should
183183
inject them into components with an appropriate scope.
184184
====
185185

186+
=== Referencing the default truststore of SunJSSE
187+
188+
JDK distributions typically contain a truststore in the `$JAVA_HOME/lib/security/cacerts` file.
189+
It is used as a default truststore by SunJSSE, the default implementation of Java Secure Socket Extension (JSSE).
190+
SSL/TLS capabilities provided by SunJSSE are leveraged by various Java Runtime components,
191+
such as `javax.net.ssl.HttpsURLConnection` and others.
192+
193+
Although Quarkus extensions typically do not honor the default truststore of SunJSSE,
194+
it might still be practical to use it in some situations - be it migration from legacy technologies
195+
or when running on a Linux distribution where the SunJSSE truststore is synchronized with the operating system truststore.
196+
197+
To make the use of SunJSSE truststore easier, Quarkus TLS Registry provides a TLS configuration
198+
under the name `javax.net.ssl` that mimics the default behavior of SunJSSE:
199+
200+
. If the `javax.net.ssl.trustStore` system property is defined, then its value is honored as a truststore
201+
. Otherwise, the paths `$JAVA_HOME/lib/security/jssecacerts` and `$JAVA_HOME/lib/security/cacerts` are checked
202+
and the first existing file is used as a truststore
203+
. Otherwise an `IllegalStateException` is thrown.
204+
205+
The password for opening the truststore is taken from the `javax.net.ssl.trustStorePassword` system property.
206+
If it is not set, the default password `changeit` is used.
207+
208+
`javax.net.ssl` can be used as a value for various `*.tls-configuration-name` properties, for example:
209+
210+
.Example configuration for a gRPC client:
211+
[source,properties]
212+
----
213+
quarkus.grpc.clients.hello.tls-configuration-name=javax.net.ssl
214+
----
215+
216+
[WARNING]
217+
====
218+
The `javax.net.ssl` TLS configuration can be neither customized nor overridden.
219+
====
220+
186221
== Configuring TLS
187222

188223
TLS configuration primarily involves managing keystores and truststores.
@@ -248,15 +283,15 @@ quarkus.tls.http.key-store.pem.password=password
248283
PKCS12 keystores are single files that contain the certificate and the private key.
249284

250285
To configure a PKCS12 keystore:
251-
286+
252287
[source,properties]
253288
----
254289
quarkus.tls.key-store.p12.path=server-keystore.p12
255290
quarkus.tls.key-store.p12.password=secret
256291
----
257-
292+
258293
`.p12` files are password-protected, so you need to provide the password to open the keystore.
259-
294+
260295
These files can include more than one certificate and private key.
261296
If this is the case, take either of the following actions:
262297

@@ -292,11 +327,11 @@ To configure a JKS keystore:
292327
quarkus.tls.key-store.jks.path=server-keystore.jks
293328
quarkus.tls.key-store.jks.password=secret
294329
----
295-
330+
296331
`.jks` files are password-protected, so you need to provide the password to open the keystore.
297332
Also, they can include more than one certificate and private key.
298333
If this is the case:
299-
334+
300335
* Provide and configure the alias of the certificate and the private key you want to use:
301336
+
302337
[source,properties]
@@ -317,12 +352,12 @@ Server Name Indication (SNI) is a TLS extension that makes it possible for a cli
317352
SNI enables a server to present different TLS certificates for multiple domains on a single IP address, which facilitates secure communication for virtual hosting scenarios.
318353

319354
To enable SNI:
320-
355+
321356
[source,properties]
322357
----
323358
quarkus.tls.key-store.sni=true # Disabled by default
324359
----
325-
360+
326361
With SNI enabled, the client indicates the server name during the TLS handshake, which allows the server to select the appropriate certificate:
327362

328363
* When configuring the keystore with PEM files, multiple certificate (CRT) and key files must be provided.
@@ -390,7 +425,7 @@ quarkus.tls.trust-store.p12.path=client-truststore.p12
390425
quarkus.tls.trust-store.p12.password=password
391426
quarkus.tls.trust-store.p12.alias=my-alias
392427
----
393-
428+
394429
`.p12` files are password-protected, so you need to provide the password to open the truststore.
395430
However, unlike keystores, the alias does not require a password because it contains a public certificate, not a private key.
396431

@@ -408,7 +443,7 @@ quarkus.tls.trust-store.jks.path=client-truststore.jks
408443
quarkus.tls.trust-store.jks.password=password
409444
quarkus.tls.trust-store.jks.alias=my-alias
410445
----
411-
446+
412447
`.jks` files are password-protected, so you need to provide the password to open the truststore.
413448
However, unlike keystores, the alias does not require a password because it contains a public certificate, not a private key.
414449

@@ -432,7 +467,7 @@ quarkus.tls.trust-store.credentials-provider.bean-name=my-credentials-provider
432467
# The key used to retrieve the truststore password, `password` by default
433468
quarkus.tls.trust-store.credentials-provider.password-key=password
434469
----
435-
470+
436471
IMPORTANT: The credential provider can only be used with PKCS12 and JKS truststores.
437472

438473
=== Other properties
@@ -562,7 +597,7 @@ While extensions automatically use the TLS registry, you can also access the TLS
562597

563598
To access the TLS configuration, inject the `TlsConfigurationRegistry` bean.
564599
You can retrieve a named TLS configuration by calling `get("<NAME>")` or the default configuration by calling `getDefault()`.
565-
600+
566601
[source,java]
567602
----
568603
@Inject
@@ -572,7 +607,7 @@ TlsConfiguration def = certificates.getDefault().orElseThrow();
572607
TlsConfiguration named = certificates.get("name").orElseThrow();
573608
//...
574609
----
575-
610+
576611
The `TlsConfiguration` object contains the keystores, truststores, cipher suites, protocols, and other properties.
577612
It also provides a way to create an `SSLContext` from the configuration.
578613

@@ -591,9 +626,9 @@ To register a certificate in the TLS registry by using the extension, the _proce
591626
TlsCertificateBuildItem item = new TlsCertificateBuildItem("named",
592627
new MyCertificateSupplier());
593628
----
594-
629+
595630
The certificate supplier is a runtime object generally retrieved by using a recorder method.
596-
631+
597632
.An example of a certificate supplier:
598633
[source,java]
599634
----
@@ -937,7 +972,7 @@ Ensure that the path matches the one used in the configuration (here `/etc/tls`)
937972
. Deploy your application to use the certificate generated by OpenShift.
938973
This will make the service available over HTTPS.
939974

940-
[NOTE]
975+
[NOTE]
941976
====
942977
By setting the `quarkus.tls.key-store.pem.acme.cert` and `quarkus.tls.key-store.pem.acme.key` variables or their environment variable variant, the TLS registry will use the certificate and private key from the secret.
943978
@@ -1209,7 +1244,7 @@ Even if the Quarkus Development CA is installed, you can generate a self-signed
12091244
----
12101245
quarkus tls generate-certificate --name my-cert --self-signed
12111246
----
1212-
1247+
12131248
This generates a self-signed certificate that the Quarkus Development CA does not sign.
12141249

12151250
=== Uninstalling the Quarkus Development CA

0 commit comments

Comments
 (0)