Management of security keys and certificates with the TLS Registry
Abstract
Chapter 1. Management of security keys and certificates with the TLS Registry Copy linkLink copied to clipboard!
The TLS Registry is a Quarkus extension that centralizes TLS configuration, making it easier to manage and maintain secure connections across your application. When defining TLS configurations in a single centralized location, you can use the TLS Registry to reference these configurations from multiple components within the application, which ensures consistency and reduces the potential for configuration errors.
The TLS Registry consolidates settings and supports multiple named configurations. Therefore, you can tailor TLS settings for different application parts. This flexibility is particularly useful when different components require distinct security configurations.
The TLS Registry extension is automatically included in your project when you use compatible extensions, such as Quarkus REST, gRPC, SmallRye GraphQL Client .
As a result, applications that use the TLS Registry can be ready to handle secure communications out of the box.
TLS Registry also provides automatic certificate reloading and compatibility with various keystore formats, such as PKCS12, PEM, and JKS.
1.1. Using the TLS registry Copy linkLink copied to clipboard!
To configure a TLS connection, including key and truststores, use the quarkus.tls.* properties. These properties are required for:
-
Setting up the default TLS configuration, defined directly under
quarkus.tls.* -
Creating separate, named configurations by using
quarkus.tls.<name>.*. By specifying thequarkus.tls.<name>.*properties, you can adapt the TLS settings for a specific component.
The default TLS configuration is not a fallback or global configuration. Each named TLS configuration, or "TLS bucket," must provide its own properties. For instance, quarkus.tls.reload-period will only be applied to the default TLS configuration.
As described in detail here, Quarkus client extensions (such as REST, GRPC, and so on) ignore properties defined in default (that is, unnamed) TLS configurations. The quarkus.tls.trust-all property is the only exception.
1.1.1. Configuring HTTPS for a HTTP server Copy linkLink copied to clipboard!
To ensure secure client-server communication, the client is often required to verify the server’s authenticity.
- The server must use a keystore that contains its certificate and private key.
- The client needs to be configured with a truststore to validate the server’s certificate.
During the TLS handshake, the server presents its certificate, which the client then validates. This prevents man-in-the-middle attacks and secures data transmission.
The following sections guide you through setting up HTTPS by using PEM or PKCS12 keystore types. In addition, they provide information on how to use named configurations to specify and manage multiple TLS setups at once, which makes it possible for you to define distinct settings for each.
Use one of the following configuration examples based on your keystore type:
By using PEM files:
quarkus.tls.key-store.pem.0.cert=server.crt quarkus.tls.key-store.pem.0.key=server.key quarkus.http.insecure-requests=disabled # Reject HTTP requests
quarkus.tls.key-store.pem.0.cert=server.crt quarkus.tls.key-store.pem.0.key=server.key quarkus.http.insecure-requests=disabled # Reject HTTP requestsCopy to Clipboard Copied! Toggle word wrap Toggle overflow By using a
p12(PKCS12) keystore:quarkus.tls.key-store.p12.path=server-keystore.p12 quarkus.tls.key-store.p12.password=secret quarkus.http.insecure-requests=disabled # Reject HTTP requests
quarkus.tls.key-store.p12.path=server-keystore.p12 quarkus.tls.key-store.p12.password=secret quarkus.http.insecure-requests=disabled # Reject HTTP requestsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Distinguishing multiple configurations with names:
quarkus.tls.https.key-store.p12.path=server-keystore.p12 quarkus.tls.https.key-store.p12.password=secret quarkus.http.insecure-requests=disabled quarkus.http.tls-configuration-name=https
quarkus.tls.https.key-store.p12.path=server-keystore.p12 quarkus.tls.https.key-store.p12.password=secret quarkus.http.insecure-requests=disabled quarkus.http.tls-configuration-name=httpsCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.1.2. Configuring HTTPS for a client Copy linkLink copied to clipboard!
The following example configures a gRPC client named "hello" to use HTTPS with a truststore from the default TLS configuration:
quarkus.tls.trust-store.jks.path=grpc-client-truststore.jks quarkus.tls.trust-store.jks.password=password quarkus.grpc.clients.hello.plain-text=false quarkus.grpc.clients.hello.use-quarkus-grpc-client=true
quarkus.tls.trust-store.jks.path=grpc-client-truststore.jks
quarkus.tls.trust-store.jks.password=password
quarkus.grpc.clients.hello.plain-text=false
quarkus.grpc.clients.hello.use-quarkus-grpc-client=true
1.1.3. Configuring mTLS Copy linkLink copied to clipboard!
To set up mutual TLS (mTLS) in your Quarkus application, configure the server and the client by creating and managing both a keystore and a truststore for each:
- Server keystore: Contains the server’s certificate and private key.
- Client keystore: Contains the client’s certificate and private key.
- Server truststore: Stores the client’s certificate for authenticating the client.
Client truststore: Stores the server’s certificate for authenticating the server.
An example configuration for specifying keystores and truststores:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This configuration enables mTLS by ensuring that both the server and client validate each other’s certificates, which provides an additional layer of security.
1.2. Referencing a TLS configuration Copy linkLink copied to clipboard!
To reference an example named configuration that you created by using the quarkus.tls.<name>.* properties as explained in Using the TLS registry, use the tls-configuration-name property as shown in the following examples:
Example configuration for the core HTTP server:
Reference the named configuration
# Reference the named configuration
quarkus.http.tls-configuration-name=MY_TLS_CONFIGURATION
Example configuration for a gRPC client:
quarkus.grpc.clients.hello.tls-configuration-name=MY_TLS_CONFIGURATION
quarkus.grpc.clients.hello.tls-configuration-name=MY_TLS_CONFIGURATION
Example configuration for a SmallRye GraphQL client:
quarkus.smallrye-graphql-client.my-client.tls-configuration-name=MY_TLS_CONFIGURATION
quarkus.smallrye-graphql-client.my-client.tls-configuration-name=MY_TLS_CONFIGURATION
When using the Typesafe GraphQL client with a certificate reloading mechanism, as described in the Reloading certificates section, it is essential to override the bean’s scope to RequestScoped or another similar scope shorter than the application. This is because, by default, the Typesafe client is an application-scoped bean. Shortening the scope guarantees that new instances of the bean created after a certificate reload will be configured with the latest certificate. Dynamic clients are @Dependent scoped; inject them into components with an appropriate scope.
1.2.1. Referencing the default truststore of SunJSSE Copy linkLink copied to clipboard!
JDK distributions typically contain a truststore in the $JAVA_HOME/lib/security/cacerts file. This truststore is used as a default truststore by SunJSSE, the default implementation of the Java Secure Socket Extension (JSSE). SSL/TLS capabilities provided by SunJSSE are leveraged by various Java Runtime components, such as javax.net.ssl.HttpsURLConnection and others.
Although Quarkus extensions typically do not honor the default truststore of SunJSSE, it is still practical to use it in some situations. This applies when migrating from legacy technologies or running on a Linux distribution where the SunJSSE truststore is synchronized with the operating system (OS).
To simplify the use of the SunJSSE truststore, Quarkus TLS Registry provides a TLS configuration under the name javax.net.ssl that mimics the default behavior of SunJSSE:
-
If the
javax.net.ssl.trustStoresystem property is defined, its value is honored as a truststore. -
Otherwise, the paths
$JAVA_HOME/lib/security/jssecacertsand$JAVA_HOME/lib/security/cacertsare checked, and the first existing file is used as a truststore. -
If neither condition is met, an
IllegalStateExceptionis thrown.
The password for opening the truststore is taken from the javax.net.ssl.trustStorePassword system property. If this property is not set, the default password changeit is used.
The javax.net.ssl configuration can be used as a value for various *.tls-configuration-name properties, as shown below:
Example configuration for a gRPC client:
quarkus.grpc.clients.hello.tls-configuration-name=javax.net.ssl
quarkus.grpc.clients.hello.tls-configuration-name=javax.net.ssl
The javax.net.ssl TLS configuration can be neither customized nor overridden.
1.3. Configuring TLS Copy linkLink copied to clipboard!
TLS configuration primarily involves managing keystores and truststores. The specific setup depends on the format used, such as PEM, P12, or JKS.
The following sections outline the various properties available for configuring TLS.
1.3.1. Key stores Copy linkLink copied to clipboard!
Key stores store private keys and certificates. They are mainly used on the server side but can also be used on the client side when mTLS is used.
1.3.1.1. PEM keystores Copy linkLink copied to clipboard!
Privacy Enhanced Mail (PEM) keystores are composed of a list of file pairs:
-
The certificate file - a
.crtor.pemfile. -
The private key file - often a
.keyfile.
To configure a PEM keystore:
quarkus.tls.key-store.pem.a.cert=server.crt quarkus.tls.key-store.pem.a.key=server.key quarkus.tls.key-store.pem.b.cert=my-second-cert.crt quarkus.tls.key-store.pem.b.key=my-second-key.key
quarkus.tls.key-store.pem.a.cert=server.crt
quarkus.tls.key-store.pem.a.key=server.key
quarkus.tls.key-store.pem.b.cert=my-second-cert.crt
quarkus.tls.key-store.pem.b.key=my-second-key.key
In most cases, you only need a single pair consisting of a certificate and a private key. Even if the certificate is part of a certificate chain, it includes only one private key that corresponds to the end-entity certificate.
When multiple pairs are configured, the selection of one of the configured pairs of certificates and private keys is based on Server Name Indication (SNI). The client sends the name of the server to which the client is attempting to connect, and the server selects the appropriate pair of certificates and private keys. To use this feature, ensure that SNI is enabled on both the client and server.
When configuring multiple key pairs or certificate pairs, the server executes the configured pairs in a lexicographical order of their names by default, as demonstrated with store.pem.a and store.pem.b in the previous example. The pair with the lowest lexicographical order is executed first. To change this, you can define the order by using the quarkus.tls.key-store.pem.order property. For example, quarkus.tls.key-store.pem.order=b,c,a.
This setting is important when using SNI, because it uses the first specified pair as the default.
When using PEM keystore, the following formats are supported:
- PKCS#8 private key (unencrypted)
- PKCS#1 RSA private key (unencrypted)
- Encrypted PKCS#8 private key (encrypted with AES-128-CBC)
In the later case, the quarkus.tls.key-store.pem.password or quarkus.tls.key-store.pem.<name>.password property must be set to the password used to decrypt the private key.
An encrypted PEM keystore configuration example:
quarkus.tls.http.key-store.pem.cert=certificate.crt quarkus.tls.http.key-store.pem.key=key.key quarkus.tls.http.key-store.pem.password=password
quarkus.tls.http.key-store.pem.cert=certificate.crt
quarkus.tls.http.key-store.pem.key=key.key
quarkus.tls.http.key-store.pem.password=password
The usage of the encrypted PEM files is now available only as a Technology Preview in Red Hat build of Quarkus 3.27, and Red Hat recommends that you do not use them in production.
For more information, see the Technology Preview scope of support.
1.3.1.2. PKCS12 keystores Copy linkLink copied to clipboard!
PKCS12 keystores are single files that contain the certificate and the private key.
To configure a PKCS12 keystore:
quarkus.tls.key-store.p12.path=server-keystore.p12 quarkus.tls.key-store.p12.password=secret
quarkus.tls.key-store.p12.path=server-keystore.p12
quarkus.tls.key-store.p12.password=secret
.p12 files are password-protected, so you need to provide the password to open the keystore.
These files can include more than one certificate and private key. If this is the case, take either of the following actions:
Provide and configure the alias of the certificate and the private key you want to use:
quarkus.tls.key-store.p12.path=server-keystore.p12 quarkus.tls.key-store.p12.password=secret quarkus.tls.key-store.p12.alias=my-alias quarkus.tls.key-store.p12.alias-password=my-alias-password
quarkus.tls.key-store.p12.path=server-keystore.p12 quarkus.tls.key-store.p12.password=secret quarkus.tls.key-store.p12.alias=my-alias quarkus.tls.key-store.p12.alias-password=my-alias-passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Alternatively, use SNI to select the appropriate certificate and private key. Note that all keys must use the same password.
1.3.1.3. JKS keystores Copy linkLink copied to clipboard!
JKS keystores are single files that contain the certificate and the private key for the server or client, used to authenticate and establish secure communications in TLS/SSL connections.
JKS is an old but still widely used Java-specific format. However, to work with this format, you must use specific, and nowadays also deprecated, Java tooling. Thus, its use with your Quarkus application is not recommended.
Additionally, OpenShift cert-manager or Let’s Encrypt does not typically provide JKS and remains PEM-only.
To configure a JKS keystore:
quarkus.tls.key-store.jks.path=server-keystore.jks quarkus.tls.key-store.jks.password=secret
quarkus.tls.key-store.jks.path=server-keystore.jks
quarkus.tls.key-store.jks.password=secret
.jks files are password-protected, so you need to provide the password to open the keystore. Also, they can include more than one certificate and private key. If this is the case:
Provide and configure the alias of the certificate and the private key you want to use:
quarkus.tls.key-store.jks.path=server-keystore.jks quarkus.tls.key-store.jks.password=secret quarkus.tls.key-store.jks.alias=my-alias quarkus.tls.key-store.jks.alias-password=my-alias-password
quarkus.tls.key-store.jks.path=server-keystore.jks quarkus.tls.key-store.jks.password=secret quarkus.tls.key-store.jks.alias=my-alias quarkus.tls.key-store.jks.alias-password=my-alias-passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Alternatively, use SNI to select the appropriate certificate and private key. Note that all keys must use the same password.
1.3.1.4. Provided keystores Copy linkLink copied to clipboard!
If you need more control over the keystore used in a TLS configuration, you can provide a CDI bean implementing the io.quarkus.tls.runtime.KeyStoreProvider interface. Quarkus calls KeyStoreProvider::getKeyStore when the TLS configuration is initially created and any time the configuration is reloaded. The resulting keystore and options are then made available via TlsConfiguration::getKeyStore and TlsConfiguration::getKeyStoreOptions.
Example KeyStoreProvider
- 1
- The CDI bean implementing the
KeyStoreProviderinterface can be@ApplicationScoped,@Singletonor@Dependent. - 2
- Use the
@Identifierqualifier to indicate a named TLS configuration for which to provide keystore options. Omit the qualifier (or use@Defaultexplicitly) to indicate the default TLS configuration. See Referencing a TLS configuration for more details. - 3
- Other CDI beans can be injected for runtime access to keystore material.
1.3.1.5. SNI Copy linkLink copied to clipboard!
Server Name Indication (SNI) is a TLS extension that makes it possible for a client to specify the host name to which it attempts to connect during the TLS handshake. 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.
To enable SNI:
quarkus.tls.key-store.sni=true # Disabled by default
quarkus.tls.key-store.sni=true # Disabled by default
With SNI enabled, the client indicates the server name during the TLS handshake, which allows the server to select the appropriate certificate:
- When configuring the keystore with PEM files, multiple certificate (CRT) and key files must be provided. CRT is a common file extension for X.509 certificate files, typically in PEM (Privacy-Enhanced Mail) format. These files contain the public certificate.
- When configuring the keystore with a JKS or P12 file, the server selects the appropriate certificate based on the SNI host name provided by the client during the TLS handshake. The server matches the SNI hostname with the common name (CN) or subject alternative names (SAN) configured in the certificates stored in the keystore. All keystore and alias passwords must be identical.
1.3.1.6. Credential providers Copy linkLink copied to clipboard!
You can use a credential provider instead of passing the keystore password and alias password in the configuration.
A credential provider offers a way to retrieve the keystore and alias password. Note that the credential provider is only used if the password or alias password is not set in the configuration.
To configure a credential provider:
The credential provider can only be used with PKCS12 and JKS keystores.
1.3.2. Trust stores Copy linkLink copied to clipboard!
Trust stores are used to store the certificates of the trusted parties. In regular TLS, the client uses a truststore to authenticate the server. With mutual TLS (mTLS), both the server and the client use truststores to authenticate each other.
1.3.2.1. PEM truststores Copy linkLink copied to clipboard!
PEM truststores are composed of a list of .crt or .pem files. Each of them contains a certificate.
To configure a PEM truststore:
quarkus.tls.trust-store.pem.certs=ca.crt,ca2.pem
quarkus.tls.trust-store.pem.certs=ca.crt,ca2.pem
1.3.2.2. PKCS12 truststores Copy linkLink copied to clipboard!
PKCS12 truststores are a single file containing the certificates. You can use the alias to select the appropriate certificate when multiple certificates are included.
To configure a PKCS12 truststore:
quarkus.tls.trust-store.p12.path=client-truststore.p12 quarkus.tls.trust-store.p12.password=password quarkus.tls.trust-store.p12.alias=my-alias
quarkus.tls.trust-store.p12.path=client-truststore.p12
quarkus.tls.trust-store.p12.password=password
quarkus.tls.trust-store.p12.alias=my-alias
.p12 files are password-protected, so you need to provide the password to open the truststore. However, unlike keystores, the alias does not require a password because it contains a public certificate, not a private key.
1.3.2.3. JKS truststores Copy linkLink copied to clipboard!
JKS truststores are single files that contain multiple certificates. You can use the alias to select the appropriate certificate when multiple certificates are present. However, avoid using the JKS format, because it is less secure than PKCS12.
To configure a JKS truststore:
quarkus.tls.trust-store.jks.path=client-truststore.jks quarkus.tls.trust-store.jks.password=password quarkus.tls.trust-store.jks.alias=my-alias
quarkus.tls.trust-store.jks.path=client-truststore.jks
quarkus.tls.trust-store.jks.password=password
quarkus.tls.trust-store.jks.alias=my-alias
.jks files are password-protected, so you need to provide the password to open the truststore. However, unlike keystores, the alias does not require a password because it contains a public certificate, not a private key.
1.3.2.4. Provided truststores Copy linkLink copied to clipboard!
If you need more control over the truststore used in a TLS configuration, you can provide a CDI bean implementing the io.quarkus.tls.runtime.TrustStoreProvider interface. Quarkus calls TrustStoreProvider::getTrustStore when the TLS configuration is initially created and any time the configuration is reloaded. The resulting truststore and options are then made available via TlsConfiguration::getTrustStore and TlsConfiguration::getTrustStoreOptions.
Example TrustStoreProvider
- 1
- The CDI bean implementing the
TrustStoreProviderinterface can be@ApplicationScoped,@Singletonor@Dependent. - 2
- Use the
@Identifierqualifier to indicate a named TLS configuration for which to provide truststore options. Omit the qualifier (or use@Defaultexplicitly) to indicate the default TLS configuration. See Referencing a TLS configuration for more details. - 3
- Other CDI beans can be injected for runtime access to truststore material.
1.3.2.5. Credential providers Copy linkLink copied to clipboard!
Instead of passing the truststore password in the configuration, you can use a credential provider. A credential provider allows you to retrieve passwords and other credentials. Note that the credential provider is used only if the password is not set in the configuration.
To configure a credential provider:
The credential provider can only be used with PKCS12 and JKS truststores.
1.3.3. Other properties Copy linkLink copied to clipboard!
While keystores and truststores are the most important properties, there are other properties you can use to configure TLS.
While the following examples use the default configuration, you can use the named configuration by prefixing the properties with the configuration’s name.
1.3.3.1. Cipher suites Copy linkLink copied to clipboard!
Cipher suites are a list of ciphers that you can use during the TLS handshake. You can configure an ordered list of enabled cipher suites. If not configured, a reasonable default is selected from the built-in ciphers. However, when specified, your configuration precedes the default suite defined by the SSL engine in use.
To configure the cipher suites:
quarkus.tls.cipher-suites=TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384
quarkus.tls.cipher-suites=TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384
1.3.3.2. TLS protocol versions Copy linkLink copied to clipboard!
The TLS protocol versions are the list of protocols that can be used during the TLS handshake. Enabled TLS protocol versions are specified as an ordered list separated by commas. The relevant configuration property is quarkus.tls.protocols or quarkus.tls.<name>.protocols for named TLS configurations. It defaults to TLSv1.3, TLSv1.2 if not configured.
The available options are TLSv1, TLSv1.1, TLSv1.2, and TLSv1.3.
For example, to only enable TLSv1.3:
quarkus.tls.protocols=TLSv1.3
quarkus.tls.protocols=TLSv1.3
1.3.3.3. Handshake timeout Copy linkLink copied to clipboard!
When a TLS connection is established, the handshake phase is the first step. During this phase, the client and server exchange information to establish the connection, which typically includes the cipher suite, the TLS protocol version, and the certification validation.
To configure the timeout for the handshake phase:
quarkus.tls.handshake-timeout=10S # Default.
quarkus.tls.handshake-timeout=10S # Default.
1.3.3.4. ALPN Copy linkLink copied to clipboard!
Application-Layer Protocol Negotiation (ALPN) is a TLS extension that allows the client and server to negotiate which protocol they will use for communication during the TLS handshake. ALPN enables more efficient communication by allowing the client to indicate its preferred application protocol to the server before establishing the TLS connection.
This helps in scenarios like HTTP/2, where multiple protocols might be available, allowing for faster protocol selection.
ALPN is enabled by default.
To disable it:
quarkus.tls.alpn=false
quarkus.tls.alpn=falseCopy to Clipboard Copied! Toggle word wrap Toggle overflow WarningDisabling ALPN is not recommended for non-experts, as it can lead to performance degradation, protocol negotiation issues, and unexpected behavior, particularly with protocols like HTTP/2. However, disabling ALPN can be useful for diagnosing native inconsistencies or testing performance in specific edge cases where protocol negotiation causes conflicts.
1.3.3.5. Certificate Revocation List (CRL) Copy linkLink copied to clipboard!
A Certificate Revocation List (CRL) is a list of certificates that the issuing Certificate Authority (CA) revoked before their scheduled expiration date. When a certificate is compromised, no longer needed, or deemed invalid, the CA adds it to the CRL to inform relying parties not to trust it anymore.
You can configure the CRL with the list of certificate files you no longer trust by using the DER or PKCS#7 (P7B) formats.
- For the DER format, pass DER-encoded CRLs.
-
For the PKCS#7 format, pass the
SignedDataobject, where the only significant field iscrls.
To configure the CRL:
quarkus.tls.certificate-revocation-list=ca.crl, ca2.crl
quarkus.tls.certificate-revocation-list=ca.crl, ca2.crl
1.3.3.6. Trusting all certificates and hostname verification Copy linkLink copied to clipboard!
You can configure your TLS connection to trust all certificates and disable the hostname verification. Note that these are two different processes:
- Trusting all certificates ignores the certificate validation, so all certificates are trusted. This method is useful for testing with self-signed certificates, but it should not be used in production.
- Hostname verification is the process of verifying the server’s identity.
It is useful to prevent man-in-the-middle attacks and often defaults to HTTPS or LDAPS.
These two properties should not be used in production.
To trust all certificates:
quarkus.tls.trust-all=true
quarkus.tls.trust-all=true
To disable hostname verification:
quarkus.tls.hostname-verification-algorithm=NONE
quarkus.tls.hostname-verification-algorithm=NONE
1.3.3.7. Preventing client renegotiation Copy linkLink copied to clipboard!
Client-initiated renegotiation allows a client to request new session parameters, such as a different cipher suite, during an established TLS connection. While this feature can provide flexibility, it also introduces a potential security risk when using TLS 1.2.
When a client initiates a new TLS handshake, the server typically consumes significantly more CPU resources than the client. This resource asymmetry can be exploited to launch denial-of-service (DoS) attacks, overwhelming the server with renegotiation requests.
TLS 1.3 completely removes support for renegotiation, effectively closing this potential attack vector.
To secure TLS 1.2 and earlier, set
jdk.tls.rejectClientInitiatedRenegotiationtotrueto prevent client-initiated renegotiation.JVM mode: Native mode
# JVM mode: java -Djdk.tls.rejectClientInitiatedRenegotiation=true -jar ... # Native mode ./application -Djdk.tls.rejectClientInitiatedRenegotiation=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you are using the Quarkus-provided
Dockerfilein JVM mode, you can disable renegotiation by adding the property to theJAVA_OPTS_APPENDenvironment variable:ENV JAVA_OPTS_APPPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djdk.tls.rejectClientInitiatedRenegotiation=true"
ENV JAVA_OPTS_APPPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djdk.tls.rejectClientInitiatedRenegotiation=true"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.3.4. Configuration reference Copy linkLink copied to clipboard!
The following table lists the supported properties:
🔒 Fixed at build time: Configuration property fixed at build time - All other configuration properties are overridable at runtime
| Configuration property | Type | Default |
|
🔒 Fixed at build time
Set to
Environment variable: | boolean |
|
|
The order of the key/cert files, based on the names in the By default, Quarkus sorts the key using a lexicographical order. This property allows you to specify the order of the key/cert files.
Environment variable: | list of string | |
|
Path to the key store file (P12 / PFX format).
Environment variable: | path | required ⚠️ Required |
|
Password of the key store. When not set, the password must be retrieved from the credential provider.
Environment variable: | string | |
|
Alias of the private key and certificate in the key store.
Environment variable: | string | |
|
Password of the alias in the key store. If not set, the password will be retrieved from the credential provider.
Environment variable: | string | |
|
Provider of the key store.
Environment variable: | string | |
|
Path to the keystore file (JKS format).
Environment variable: | path | required ⚠️ Required |
|
Password of the key store. When not set, the password must be retrieved from the credential provider.
Environment variable: | string | |
|
Alias of the private key and certificate in the key store.
Environment variable: | string | |
|
Password of the alias in the key store. When not set, the password may be retrieved from the credential provider.
Environment variable: | string | |
|
Provider of the key store.
Environment variable: | string | |
|
Enables Server Name Indication (SNI). Server Name Indication (SNI) is a TLS extension that allows a client to specify the hostname it is attempting to connect to during the TLS handshake. This enables a server to present different SSL certificates for multiple domains on a single IP address, facilitating secure communication for virtual hosting scenarios. With this setting enabled, the client indicate the server name during the TLS handshake, allowing the server to select the right certificate.
When configuring the keystore with PEM files, multiple CRT/Key must be given. When configuring the keystore with a JKS or a P12 file, it selects one alias based on the SNI hostname. In this case, all the keystore password and alias password must be the same (configured with the
Environment variable: | boolean |
|
|
The name of the "credential" bucket (map key → passwords) to retrieve from the A credential provider offers a way to retrieve the key store password as well as alias password. Note that the credential provider is only used if the passwords are not set in the configuration.
Environment variable: | string | |
|
The name of the bean providing the credential provider.
The name is used to select the credential provider to use. The credential provider must be exposed as a CDI bean and with the If not set, the default credential provider is used.
Environment variable: | string | |
|
The key used to retrieve the key store password. If the selected credential provider does not support the key, the password is not retrieved. Otherwise, the retrieved value is used to open the key store.
Environment variable: | string |
|
|
The key used to retrieve the key store alias password.
If the selected credential provider does not contain the key, the alias password is not retrieved. Otherwise, the retrieved value is used to access the alias
Environment variable: | string |
|
|
List of the trusted cert paths (Pem format).
Environment variable: | list of path | |
|
Path to the trust store file (P12 / PFX format).
Environment variable: | path | required ⚠️ Required |
|
Password of the trust store. If not set, the password must be retrieved from the credential provider.
Environment variable: | string | |
|
Alias of the trust store.
Environment variable: | string | |
|
Provider of the trust store.
Environment variable: | string | |
|
Path to the trust store file (JKS format).
Environment variable: | path | required ⚠️ Required |
|
Password of the trust store. If not set, the password must be retrieved from the credential provider.
Environment variable: | string | |
|
Alias of the key in the trust store.
Environment variable: | string | |
|
Provider of the trust store.
Environment variable: | string | |
|
Enforce certificate expiration. When enabled, the certificate expiration date is verified and the certificate (or any certificate in the chain) is rejected if it is expired.
Environment variable: | ignore: Ignore the expiration date. warn: Log a warning when the certificate is expired. reject: Reject the certificate if it is expired. | warn |
|
The name of the "credential" bucket (map key → passwords) to retrieve from the A credential provider offers a way to retrieve the key store password as well as alias password. Note that the credential provider is only used if the passwords are not set in the configuration.
Environment variable: | string | |
|
The name of the bean providing the credential provider.
The name is used to select the credential provider to use. The credential provider must be exposed as a CDI bean and with the If not set, the default credential provider is used.
Environment variable: | string | |
|
The key used to retrieve the trust store password. If the selected credential provider does not contain the configured key, the password is not retrieved. Otherwise, the retrieved value is used to open the trust store.
Environment variable: | string |
|
|
Sets the ordered list of enabled cipher suites. If none is given, a reasonable default is selected from the built-in ciphers.
When suites are set, it takes precedence over the default suite defined by the
Environment variable: | list of string | |
|
Sets the ordered list of enabled TLS protocols.
If not set, it defaults to Note that setting an empty list, and enabling TLS is invalid. You must at least have one protocol. Also, setting this replaces the default list of protocols.
Environment variable: | list of string |
|
|
The timeout for the TLS handshake phase. If not set, it defaults to 10 seconds.
Environment variable: |
| |
|
Enables the Application-Layer Protocol Negotiation (ALPN). Application-Layer Protocol Negotiation is a TLS extension that allows the client and server during the TLS handshake to negotiate which protocol they will use for communication. ALPN enables more efficient communication by allowing the client to indicate its preferred application protocol to the server before the TLS connection is established. This helps in scenarios such as HTTP/2 where multiple protocols may be available, allowing for faster protocol selection.
Environment variable: | boolean |
|
|
Sets the list of revoked certificates (paths to files). A Certificate Revocation List (CRL) is a list of digital certificates that have been revoked by the issuing Certificate Authority (CA) before their scheduled expiration date. When a certificate is compromised, no longer needed, or deemed invalid for any reason, the CA adds it to the CRL to inform relying parties not to trust the certificate anymore.
Two formats are allowed: DER and PKCS#7 (also known as P7B). When using the DER format, you must pass DER-encoded CRLs. When using the PKCS#7 format, you must pass PKCS#7
Environment variable: | list of path | |
|
If set to This is useful for testing, but should not be used in production.
Environment variable: | boolean |
|
|
The hostname verification algorithm to use in case the server’s identity should be checked. Should be
If set to If not set, the configured extension decides the default algorithm to use. For example, for HTTP, it will be "HTTPS". For TCP, it can depend on the protocol. Nevertheless, it is recommended to set it to "HTTPS" or "LDAPS".
Environment variable: | string | |
|
When configured, the server will reload the certificates (from the file system for example) and fires a
This property configures the period to reload the certificates. IF not set, the certificates won’t be reloaded automatically. However, the application can still trigger the reload manually using the The fired event is used to notify the application that the certificates have been updated, and thus proceed with the actual switch of certificates.
Environment variable: | ||
|
The path to the key file (in PEM format: PKCS#8, PKCS#1 or encrypted PKCS#8).
Environment variable: | path | required ⚠️ Required |
|
The path to the certificate file (in PEM format).
Environment variable: | path | required ⚠️ Required |
|
When the key is encrypted (encrypted PKCS#8), the password to decrypt it.
Environment variable: | string | |
|
The path to the key file (in PEM format: PKCS#8, PKCS#1 or encrypted PKCS#8).
Environment variable: | path | required ⚠️ Required |
|
The path to the certificate file (in PEM format).
Environment variable: | path | required ⚠️ Required |
|
When the key is encrypted (encrypted PKCS#8), the password to decrypt it.
Environment variable: | string | |
|
The order of the key/cert files, based on the names in the By default, Quarkus sorts the key using a lexicographical order. This property allows you to specify the order of the key/cert files.
Environment variable: | list of string | |
|
Path to the key store file (P12 / PFX format).
Environment variable: | path | required ⚠️ Required |
|
Password of the key store. When not set, the password must be retrieved from the credential provider.
Environment variable: | string | |
|
Alias of the private key and certificate in the key store.
Environment variable: | string | |
|
Password of the alias in the key store. If not set, the password will be retrieved from the credential provider.
Environment variable: | string | |
|
Provider of the key store.
Environment variable: | string | |
|
Path to the keystore file (JKS format).
Environment variable: | path | required ⚠️ Required |
|
Password of the key store. When not set, the password must be retrieved from the credential provider.
Environment variable: | string | |
|
Alias of the private key and certificate in the key store.
Environment variable: | string | |
|
Password of the alias in the key store. When not set, the password may be retrieved from the credential provider.
Environment variable: | string | |
|
Provider of the key store.
Environment variable: | string | |
|
Enables Server Name Indication (SNI). Server Name Indication (SNI) is a TLS extension that allows a client to specify the hostname it is attempting to connect to during the TLS handshake. This enables a server to present different SSL certificates for multiple domains on a single IP address, facilitating secure communication for virtual hosting scenarios. With this setting enabled, the client indicate the server name during the TLS handshake, allowing the server to select the right certificate.
When configuring the keystore with PEM files, multiple CRT/Key must be given. When configuring the keystore with a JKS or a P12 file, it selects one alias based on the SNI hostname. In this case, all the keystore password and alias password must be the same (configured with the
Environment variable: | boolean |
|
|
The name of the "credential" bucket (map key → passwords) to retrieve from the A credential provider offers a way to retrieve the key store password as well as alias password. Note that the credential provider is only used if the passwords are not set in the configuration.
Environment variable: | string | |
|
The name of the bean providing the credential provider.
The name is used to select the credential provider to use. The credential provider must be exposed as a CDI bean and with the If not set, the default credential provider is used.
Environment variable: | string | |
|
The key used to retrieve the key store password. If the selected credential provider does not support the key, the password is not retrieved. Otherwise, the retrieved value is used to open the key store.
Environment variable: | string |
|
|
The key used to retrieve the key store alias password.
If the selected credential provider does not contain the key, the alias password is not retrieved. Otherwise, the retrieved value is used to access the alias
Environment variable: | string |
|
|
List of the trusted cert paths (Pem format).
Environment variable: | list of path | |
|
Path to the trust store file (P12 / PFX format).
Environment variable: | path | required ⚠️ Required |
|
Password of the trust store. If not set, the password must be retrieved from the credential provider.
Environment variable: | string | |
|
Alias of the trust store.
Environment variable: | string | |
|
Provider of the trust store.
Environment variable: | string | |
|
Path to the trust store file (JKS format).
Environment variable: | path | required ⚠️ Required |
|
Password of the trust store. If not set, the password must be retrieved from the credential provider.
Environment variable: | string | |
|
Alias of the key in the trust store.
Environment variable: | string | |
|
Provider of the trust store.
Environment variable: | string | |
|
Enforce certificate expiration. When enabled, the certificate expiration date is verified and the certificate (or any certificate in the chain) is rejected if it is expired.
Environment variable: | ignore: Ignore the expiration date. warn: Log a warning when the certificate is expired. reject: Reject the certificate if it is expired. | warn |
|
The name of the "credential" bucket (map key → passwords) to retrieve from the A credential provider offers a way to retrieve the key store password as well as alias password. Note that the credential provider is only used if the passwords are not set in the configuration.
Environment variable: | string | |
|
The name of the bean providing the credential provider.
The name is used to select the credential provider to use. The credential provider must be exposed as a CDI bean and with the If not set, the default credential provider is used.
Environment variable: | string | |
|
The key used to retrieve the trust store password. If the selected credential provider does not contain the configured key, the password is not retrieved. Otherwise, the retrieved value is used to open the trust store.
Environment variable: | string |
|
|
Sets the ordered list of enabled cipher suites. If none is given, a reasonable default is selected from the built-in ciphers.
When suites are set, it takes precedence over the default suite defined by the
Environment variable: | list of string | |
|
Sets the ordered list of enabled TLS protocols.
If not set, it defaults to Note that setting an empty list, and enabling TLS is invalid. You must at least have one protocol. Also, setting this replaces the default list of protocols.
Environment variable: | list of string |
|
|
The timeout for the TLS handshake phase. If not set, it defaults to 10 seconds.
Environment variable: |
| |
|
Enables the Application-Layer Protocol Negotiation (ALPN). Application-Layer Protocol Negotiation is a TLS extension that allows the client and server during the TLS handshake to negotiate which protocol they will use for communication. ALPN enables more efficient communication by allowing the client to indicate its preferred application protocol to the server before the TLS connection is established. This helps in scenarios such as HTTP/2 where multiple protocols may be available, allowing for faster protocol selection.
Environment variable: | boolean |
|
|
Sets the list of revoked certificates (paths to files). A Certificate Revocation List (CRL) is a list of digital certificates that have been revoked by the issuing Certificate Authority (CA) before their scheduled expiration date. When a certificate is compromised, no longer needed, or deemed invalid for any reason, the CA adds it to the CRL to inform relying parties not to trust the certificate anymore.
Two formats are allowed: DER and PKCS#7 (also known as P7B). When using the DER format, you must pass DER-encoded CRLs. When using the PKCS#7 format, you must pass PKCS#7
Environment variable: | list of path | |
|
If set to This is useful for testing, but should not be used in production.
Environment variable: | boolean |
|
|
The hostname verification algorithm to use in case the server’s identity should be checked. Should be
If set to If not set, the configured extension decides the default algorithm to use. For example, for HTTP, it will be "HTTPS". For TCP, it can depend on the protocol. Nevertheless, it is recommended to set it to "HTTPS" or "LDAPS".
Environment variable: | string | |
|
When configured, the server will reload the certificates (from the file system for example) and fires a
This property configures the period to reload the certificates. IF not set, the certificates won’t be reloaded automatically. However, the application can still trigger the reload manually using the The fired event is used to notify the application that the certificates have been updated, and thus proceed with the actual switch of certificates.
Environment variable: |
To write duration values, use the standard java.time.Duration format. See the Duration#parse() Java API documentation for more information.
You can also use a simplified format, starting with a number:
- If the value is only a number, it represents time in seconds.
-
If the value is a number followed by
ms, it represents time in milliseconds.
In other cases, the simplified format is translated to the java.time.Duration format for parsing:
-
If the value is a number followed by
h,m, ors, it is prefixed withPT. -
If the value is a number followed by
d, it is prefixed withP.
1.4. The registry API Copy linkLink copied to clipboard!
While extensions automatically use the TLS registry, you can also access the TLS configuration programmatically through the registry API.
To access the TLS configuration, inject the TlsConfigurationRegistry bean. You can retrieve a named TLS configuration by calling get("<NAME>") or the default configuration by calling getDefault().
The TlsConfiguration object contains the keystores, truststores, cipher suites, protocols, and other properties. It also provides a way to create an SSLContext from the configuration.
You can also use the TlsConfiguration object to configure the Vert.x client or server, such as KeyCertOptions, TrustOptions, and so on.
1.5. Registering a certificate from an extension Copy linkLink copied to clipboard!
This section is only for extension developers. An extension can register a certificate in the TLS registry. This is useful when an extension needs to provide a certificate to the application or provides a different format.
To register a certificate in the TLS registry by using the extension, the processor extension must produce a TlsCertificateBuildItem composed of a name and a CertificateSupplier.
TlsCertificateBuildItem item = new TlsCertificateBuildItem("named",
new MyCertificateSupplier());
TlsCertificateBuildItem item = new TlsCertificateBuildItem("named",
new MyCertificateSupplier());
The certificate supplier is a runtime object generally retrieved by using a recorder method.
An example of a certificate supplier:
1.6. Startup checks Copy linkLink copied to clipboard!
When an application that uses the TLS extension starts, the TLS registry performs several checks to ensure the configuration is correct:
- Keystores and truststores are accessible.
- Aliases are available and accessible in the keystores and truststores.
- Certificates are valid.
- Cipher suites and protocols are valid.
- Certificate Revocation Lists (CRLs) are valid.
If any of these checks fail, the application will not start.
1.7. Reloading certificates Copy linkLink copied to clipboard!
The TlsConfiguration obtained from the TLSConfigurationRegistry includes a mechanism for reloading certificates. The reload method refreshes the keystores, truststores, and CRLs, typically by reloading them from the file system.
The reload operation is not automatic and must be triggered manually. Additionally, the TlsConfiguration implementation must support reloading, as is the case for the configured certificate.
The reload method returns a boolean indicating whether the reload was successful. A value of true means the reload operation was successful, not necessarily that there were updates to the certificates.
After a TlsConfiguration has been reloaded, servers and clients using this configuration may need to perform specific actions to apply the new certificates.
The preferred approach for informing clients and servers about the certificate reload is to fire a CDI event of type io.quarkus.tls.CertificateUpdatedEvent. To do so, inject a CDI event of this type and fire it when a reload occurs.
An example of manually reloading a TLS configuration and notifying components by firing a CertificateUpdatedEvent and reacting to it:
1.7.1. Periodic reloading Copy linkLink copied to clipboard!
The TLS registry includes a built-in mechanism for periodically checking the file system for changes and reloading certificates. The reload-period property specifies the interval for reloading certificates and emits a CertificateUpdatedEvent each time certificates are reloaded.
To configure periodic certificate reloading:
quarkus.tls.reload-period=1h quarkus.tls.key-store.pem.0.cert=tls.crt quarkus.tls.key-store.pem.0.key=tls.key
quarkus.tls.reload-period=1h quarkus.tls.key-store.pem.0.cert=tls.crt quarkus.tls.key-store.pem.0.key=tls.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow For each named configuration, you can set a specific reload period:
quarkus.tls.http.reload-period=30m quarkus.tls.http.key-store.pem.0.cert=tls.crt quarkus.tls.http.key-store.pem.0.key=tls.key
quarkus.tls.http.reload-period=30m quarkus.tls.http.key-store.pem.0.cert=tls.crt quarkus.tls.http.key-store.pem.0.key=tls.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Impacted servers and clients might need to listen to the CertificateUpdatedEvent to apply the new certificates. This is automatically handled for the Quarkus HTTP, REST, gRPC, and WebSocket servers, as well as the management interface if enabled. On the client side, Quarkus REST Client automatically handles certificate update events.
In Quarkus dev mode, when files are touched, it will trigger the CertificateUpdatedEvent much more frequently.
1.8. Working with OpenShift serving certificates Copy linkLink copied to clipboard!
When running your application in OpenShift, you can use the OpenShift serving certificates to generate and renew TLS certificates automatically. The Quarkus TLS registry can use these certificates and Certificate Authority (CA) files to handle HTTPS traffic and validate certificates securely.
1.8.1. Acquiring a certificate Copy linkLink copied to clipboard!
To have OpenShift generate a serving certificate, annotate an existing Service object. The generated certificate will be stored in a secret, which you can then mount in your pod.
The following snippet uses an example Service object with an annotation for generating a TLS certificate.
View the configuration of the Service object:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To generate a certificate, add his annotation to your already created OpenShift
service:oc annotate service hero-service \ service.beta.openshift.io/serving-cert-secret-name=my-tls-secretoc annotate service hero-service \ service.beta.openshift.io/serving-cert-secret-name=my-tls-secretCopy to Clipboard Copied! Toggle word wrap Toggle overflow The annotation
service.beta.openshift.io/serving-cert-secret-nameinstructs OpenShift to generate a certificate and store it in a secret namedmy-tls-secret.Mount the secret as a volume in your pod by updating your Deployment configuration:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Define a volume to mount the secret. Use the same name as the secret declared above.
- 2
- Set up the keystore with the paths to the certificate and private key. This can be configured by using environment variables or configuration files. This example uses environment variables. OpenShift serving certificates always create the
tls.crtandtls.keyfiles. - 3
- Mount the secret in the container. Ensure that the path matches the one used in the configuration (here
/etc/tls). - 4
- Configure the port to serve HTTPS.
- Deploy your application to use the certificate generated by OpenShift. This will make the service available over HTTPS.
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.
This configures the default keystore for the Quarkus HTTP server, which allows the server to use the certificate. For information about using this certificate in a named configuration, see Referencing a TLS configuration.
1.8.2. Trusting the Certificate Authority (CA) Copy linkLink copied to clipboard!
Prerequisites
Now that your service uses a certificate issued by OpenShift, configure your client applications to trust this certificate. To do so, create a ConfigMap that holds the CA certificate, and then configure the pod to mount it. The following steps use a Quarkus REST client as an example, but the same approach applies to any client.
Start by defining an empty ConfigMap, which will be populated with the CA certificate:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
service.beta.openshift.io/inject-cabundleannotation is used to inject the CA certificate into the ConfigMap. Note that the ConfigMap initially has no data — it is empty. During its processing, OpenShift injects the CA certificate into the ConfigMap in theservice-ca.crtfile.Mount the ConfigMap by adding a volume and mounting it in your Deployment configuration:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the REST client to use this CA certificate.
Consider the following REST client interface:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Configure the base URI and the configuration key. The name must be in the format
<service-name>.<namespace>.svc. Otherwise, the certificate will not be trusted. Ensure that theconfigKeyis also configured.
Configure the REST client to trust the CA certificate generated by OpenShift:
quarkus.rest-client.hero.tls-configuration-name=my-service-tls quarkus.tls.my-service-tls.trust-store.pem.certs=/deployments/tls/service-ca.crt
quarkus.rest-client.hero.tls-configuration-name=my-service-tls1 quarkus.tls.my-service-tls.trust-store.pem.certs=/deployments/tls/service-ca.crt2 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Configure the
heroREST client with the TLS configuration namedmy-service-tls. - 2
- Set up the
my-service-tlsTLS configuration, specifically the truststore with the CA certificate. Ensure the path matches the one used in the Kubernetes Deployment configuration. The file is always namedservice-ca.crt.
1.8.3. Certificate renewal Copy linkLink copied to clipboard!
OpenShift automatically renews the serving certificates it generates. When the certificate is renewed, the secret is updated with the new certificate and private key.
To ensure your application uses the new certificate, you can use the periodic reloading feature of the Quarkus TLS registry.
By setting the reload-period property, the TLS registry will periodically check the keystores and truststores for changes and reload them if needed:
quarkus.tls.reload-period=24h
quarkus.tls.reload-period=24h
- Optionally, implement a custom mechanism to reload the certificates when the secret is updated. See Reloading certificates for more information.
1.9. Quarkus CLI commands and development Certificate Authority Copy linkLink copied to clipboard!
The TLS registry provides Quarkus CLI commands to generate a development Certificate Authority (CA) and trusted certificates. This avoids having to use self-signed certificates locally.
The following snippet shows the description of the quarkus tls command, containing two sub-commands:
In most cases, you generate the Quarkus Development CA once and then generate certificates signed by this CA. The Quarkus Development CA is a Certificate Authority that can be used to sign certificates locally. It is only valid for development purposes and only trusted on the local machine. The generated CA is located in $HOME/.quarkus/quarkus-dev-root-ca.pem, and installed in the system truststore.
1.9.1. Understanding self-signed versus CA-signed certificates Copy linkLink copied to clipboard!
When developing with TLS, you can use two types of certificates:
- Self-signed certificate: The certificate is signed by the same entity that uses it. It is not trusted by default. This type of certificate is typically used when a Certificate Authority (CA) is unavailable or when a simple setup is needed. It is not suitable for production and is intended only for development.
- CA-signed certificate: The certificate is signed by a Certificate CA, a trusted entity. This certificate is trusted by default and is the standard choice for production environments.
While you can use a self-signed certificate for local development, it has limitations. Browsers and tools like curl, wget, and httpie typically do not trust self-signed certificates, requiring manual import of the CA in your operating system.
To avoid this issue, use a development CA to sign certificates and install the CA in the system truststore. This ensures that the system trusts all certificates signed by the CA. Quarkus simplifies the generation of a development CA and the certificates that are signed by this CA.
1.9.2. Generate a development CA Copy linkLink copied to clipboard!
The development CA is a Certificate Authority that can be used to sign certificates locally. Note that the generated CA is only valid for development purposes and can only be trusted on the local machine.
To generate a development CA:
quarkus tls generate-quarkus-ca --install \
--renew \
--truststore
quarkus tls generate-quarkus-ca --install \
--renew \
--truststore
- 1
--installinstalls the CA in the system truststore. Windows, Mac, and Linux (Fedora and Ubuntu) are supported. However, depending on your browser, you might need to import the generated CA manually. Refer to your browser’s documentation for more information. The generated CA is located in$HOME/.quarkus/quarkus-dev-root-ca.pem.- 2
--renewrenews the CA if it already exists. When this option is used, the private key is changed, so you need to regenerate the certificates signed by the CA. If the CA expires, it will automatically renew without requiring the--renewoption.- 3
--truststorealso generates a PKCS12 truststore containing the CA certificate.
When installing the certificate, your system might ask for your password to install the certificate in the system truststore or ask for confirmation in a dialog on Windows.
On Windows, run as administrator from an elevated terminal to install the CA in the system truststore.
1.9.3. Generating a trusted (signed) certificate Copy linkLink copied to clipboard!
Prerequisites
After installing the Quarkus Development CA, generate a trusted certificate. This certificate will be signed by the Quarkus Development CA and trusted by your system.
quarkus tls generate-certificate --name my-cert
quarkus tls generate-certificate --name my-certCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command generates a certificate signed by the Quarkus Development CA, which your system will trust if properly installed or imported.
The certificate is stored in
./.certs/. Two files are generated:
-
$NAME-keystore.p12: Contains the private key and the certificate. It is password-protected. $NAME-truststore.p12: Contains the CA certificate, which you can use as a truststore, for example, for testing.Additional options are available:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A
.envfile is also generated when generating the certificate, making the Quarkus dev mode aware of these certificates.Run your application in dev mode to use these certificates:
./mvnw quarkus:dev ... INFO [io.quarkus] (Quarkus Main Thread) demo 1.0.0-SNAPSHOT on JVM (powered by Quarkus 999-SNAPSHOT) started in 1.286s. Listening on: http://localhost:8080 and https://localhost:8443
./mvnw quarkus:dev ... INFO [io.quarkus] (Quarkus Main Thread) demo 1.0.0-SNAPSHOT on JVM (powered by Quarkus 999-SNAPSHOT) started in 1.286s. Listening on: http://localhost:8080 and https://localhost:8443Copy to Clipboard Copied! Toggle word wrap Toggle overflow Open the Dev UI by using HTTPS:
https://localhost:8443/q/devor by issuing acurlrequest:curl https://localhost:8443/hello Hello from Quarkus REST%
curl https://localhost:8443/hello Hello from Quarkus REST%Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantQuarkus generates a self-signed certificate if the Quarkus Development CA is not installed.
1.9.4. Generating a self-signed certificate Copy linkLink copied to clipboard!
Even if the Quarkus Development CA is installed, you can generate a self-signed certificate:
quarkus tls generate-certificate --name my-cert --self-signed
quarkus tls generate-certificate --name my-cert --self-signed
This generates a self-signed certificate that the Quarkus Development CA does not sign.
1.9.5. Uninstalling the Quarkus Development CA Copy linkLink copied to clipboard!
Uninstalling the Quarkus Development CA from your system depends on your OS.
1.9.5.1. Deleting the CA certificate on Windows Copy linkLink copied to clipboard!
List the CA certificate on Windows by using the Powershell terminal with administrator rights:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Delete the stored CA certificate and replace
$Serial_Numberwith the serial number of the CA certificate:> certutil -delstore -user -v Root $Serial_Number
> certutil -delstore -user -v Root $Serial_NumberCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.9.5.2. Deleting the CA certificate on Linux Copy linkLink copied to clipboard!
On Fedora:
sudo rm /etc/pki/ca-trust/source/anchors/quarkus-dev-root-ca.pem sudo update-ca-trust
sudo rm /etc/pki/ca-trust/source/anchors/quarkus-dev-root-ca.pem sudo update-ca-trustCopy to Clipboard Copied! Toggle word wrap Toggle overflow On Ubuntu:
sudo rm /usr/local/share/ca-certificates/quarkus-dev-root-ca.pem sudo update-ca-certificates
sudo rm /usr/local/share/ca-certificates/quarkus-dev-root-ca.pem sudo update-ca-certificatesCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.9.5.3. Deleting the CA certificate on Mac Copy linkLink copied to clipboard!
On Mac:
sudo security -v remove-trusted-cert -d /Users/clement/.quarkus/quarkus-dev-root-ca.pem
sudo security -v remove-trusted-cert -d /Users/clement/.quarkus/quarkus-dev-root-ca.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow