SSL certificates can be valid for at most 199 days. By 15-03-2027 the limit becomes 99 days, for DigiCert certificates from 24-02-2027. Read more →

Post-quantum TLS on Linux: Nginx, Apache and HAProxy

Hybrid key exchange with X25519MLKEM768 protects traffic against being collected now and decrypted later with a quantum computer. You enable it in the web server configuration, and the certificate does not need to be replaced for it.

Nginx, Apache and HAProxy must run with OpenSSL 3.5 or later. Nginx and HAProxy call the groups curves.

What your distribution can do

Check the OpenSSL version first. The table covers Nginx, Apache and HAProxy from the distribution packages:

Bash
openssl version
DistributionOpenSSLX25519MLKEM768What you do
Debian 123.0 Source: Debian: openssl package versions (opens in a new tab)NoUpgrade to Debian 13.
Debian 133.5 Source: Debian: openssl package versions (opens in a new tab)YesSet the groups in the web server.
Ubuntu 22.04 LTS3.0 Source: Ubuntu: openssl package versions (opens in a new tab)NoUpgrade to Ubuntu 26.04 LTS.
Ubuntu 24.04 LTS3.0 Source: Ubuntu: openssl package versions (opens in a new tab)NoUpgrade to Ubuntu 26.04 LTS.
Ubuntu 26.04 LTS3.5 Source: Ubuntu: openssl package versions (opens in a new tab)YesSet the groups in the web server.
RHEL 93.5 from RHEL 9.7 Source: Red Hat: RHEL 9.7 release notes (opens in a new tab)Yes, from 9.7Update to 9.7 or later and set the groups in the web server.
RHEL 103.5 from RHEL 10.1 Source: Red Hat: Interoperability of RHEL 10 post-quantum cryptography (opens in a new tab)Yes, from 10.1Update to 10.1 or later and set the groups in the web server. In FIPS mode only SecP256r1MLKEM768 and SecP384r1MLKEM1024 work.

How to enable it

The lines allow TLS 1.3 and TLS 1.2 with ECDHE and AEAD. The groups are in two sets separated by /: the three hybrids first, then P-384 and P-521 as fallback. The server picks a hybrid group whenever the client supports one of them.

Test the clients first

A client that only supports X25519 or P-256, TLS 1.0 or 1.1, or CBC ciphers cannot connect with these lines. Test the applications and clients that use the server.

  1. Save a copy of the configuration file. This is Nginx; for Apache and HAProxy it is their configuration file:
    Bash
    sudo cp -an /etc/nginx/nginx.conf /etc/nginx/nginx.conf.before-pqc
  2. Add the lines for your server as shown below. If the lines are already there, change them instead of adding new ones.
  3. Test the configuration and reload with the command under your server.
  4. Test the server from outside with testssl.sh.

Nginx

Put the lines in the http block. They apply to every server block without settings of its own:

nginx.conf
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
# Hybrid groups first, then P-384 and P-521
ssl_ecdh_curve X25519MLKEM768:SecP256r1MLKEM768:SecP384r1MLKEM1024/secp384r1:secp521r1;
Bash
sudo nginx -t && sudo systemctl reload nginx

Apache

Put the lines in the server configuration or in <VirtualHost>:

Apache
SSLProtocol -all +TLSv1.2 +TLSv1.3
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305
# Hybrid groups first, then P-384 and P-521
SSLOpenSSLConfCmd Groups X25519MLKEM768:SecP256r1MLKEM768:SecP384r1MLKEM1024/secp384r1:secp521r1
Bash
sudo apachectl configtest && sudo apachectl graceful

HAProxy

Put the lines in the global section. They apply to every bind line without settings of its own:

haproxy.cfg
global
    ssl-default-bind-options ssl-min-ver TLSv1.2
    ssl-default-bind-ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305
    # Hybrid groups first, then P-384 and P-521
    ssl-default-bind-curves X25519MLKEM768:SecP256r1MLKEM768:SecP384r1MLKEM1024/secp384r1:secp521r1
Bash
sudo haproxy -c -f /etc/haproxy/haproxy.cfg && sudo systemctl reload haproxy

Traefik

Traefik uses Go instead of OpenSSL. Built with Go 1.24 or later, Traefik uses X25519MLKEM768 when curvePreferences is not set; traefik version shows the Go version. If you have a list in the dynamic configuration, X25519MLKEM768 must be in it. That requires Traefik 3.5 or later:

Traefik
tls:
  options:
    default:
      minVersion: VersionTLS12
      cipherSuites:
        - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
        - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
        - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
        - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
        - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
        - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
      curvePreferences:
        - X25519MLKEM768
        - CurveP384
        - CurveP521

Test with testssl.sh

Test from outside with testssl.sh (opens in a new tab). Download the latest version, at least 3.2.4, from the releases on GitHub (opens in a new tab) and unpack it. testssl.sh runs in Bash on Linux, macOS and WSL.

Run the command from the unpacked directory and replace www.example.com with the hostname your clients use:

Bash
./testssl.sh --fs www.example.com

--fs limits the test to the key exchange. The hybrid group is listed under KEMs offered. This is the line for www.fairssl.dk:

 KEMs offered                 X25519MLKEM768 

Look for the hybrid group you enabled. None means the test found no hybrid group. With the lines for Nginx, Apache and HAProxy, Elliptic curves offered: shows secp384r1 and secp521r1.

Undo

Put the copy from step 1 back, test the configuration and reload:

Bash
sudo cp -a /etc/nginx/nginx.conf.before-pqc /etc/nginx/nginx.conf
sudo nginx -t && sudo systemctl reload nginx

Key type in the ACME client

The key type of the certificate is chosen in the ACME client on each server. Based on what we know today, we recommend RSA 3072-bit keys, or ECC 384 if you need faster performance.

How to set the key type is described in the lego guide for Linux, the lego guide for macOS and the simple-acme guide for Windows.