Skip to content

Enable post-quantum TLS on Apache httpd

Make Apache mod_ssl prefer the X25519MLKEM768 hybrid key exchange, with classical fallback for old clients.

Tested on Apache 2.4.71, OpenSSL 3.5.9 Lab run 2026-12-05 5 min Requires Apache httpd with mod_ssl built against OpenSSL 3.5 or newer

The fix

Put the hybrid group in its own first tuple. The / tells OpenSSL to prefer it, even when a client first sends only a classical key share.

ssl.conf (inside your <VirtualHost *:443>)
SSLProtocol -all +TLSv1.2 +TLSv1.3
SSLOpenSSLConfCmd Groups "X25519MLKEM768 / X25519:prime256v1:secp384r1"

Then restart: apachectl -k graceful, and check the error log.

Shortcut: if your Apache uses OpenSSL 3.5+ and you have no SSLOpenSSLConfCmd Groups or SSLOpenSSLConfCmd Curves line, you already prefer post-quantum. The OpenSSL default does the same thing. Delete an old Curves line instead of adding one.

Check your OpenSSL first

openssl version   # mod_ssl uses the system OpenSSL on distro packages

You need 3.5 or newer. Older OpenSSL does not know X25519MLKEM768.

Watch out: apachectl configtest says Syntax OK even on OpenSSL 3.0. The error only shows when Apache starts: AH02407: "SSLOpenSSLConfCmd Groups ..." failed, then Fatal error initialising mod_ssl, exiting. Apache will not start. Check the OpenSSL version before you restart.

Where your Apache comes from OpenSSL Ready?
Official httpd:2.4 Docker image (Debian 13) 3.5.9 Yes
Official httpd:2.4-alpine Docker image (Alpine 3.24) 3.5.9 Yes
Debian 13, Ubuntu 25.10 / 26.04, Alpine 3.22, Rocky/Alma/RHEL 9 and 10 (current updates) 3.5.x Yes
Debian 12 (apache2 2.4.71), Ubuntu 24.04 LTS 3.0.x No: Apache fails to start with the line above
Alpine 3.21 3.3.x No: move to Alpine 3.22

Official images and Debian 12 checked by running them on 2026-12-06 (Debian 12: apache2 with the fix line, start fails as described). Other distro rows are the distro's own openssl package, checked the same day.

What the common configs actually do

Tested in Docker (official httpd:2.4 image, Apache 2.4.71, OpenSSL 3.5.9) against five client offers, including the exact one browsers send. "Preferred" means the server asks for post-quantum even when the client led with a classical key share.

Config Post-quantum What browsers get
Groups "X25519MLKEM768 / X25519:…" (this fix) Preferred X25519MLKEM768
No Groups or Curves line (OpenSSL 3.5 default) Preferred X25519MLKEM768
Groups X25519MLKEM768:X25519:… (no /) Supported, not preferred X25519MLKEM768
Curves X25519:secp521r1:secp384r1:prime256v1 (old hardening guides) Off X25519 (classical)

"Supported, not preferred" looks the same in a browser today, but a client that leads with a classical key share gets classical encryption. Preferring post-quantum closes that gap.

SSLOpenSSLConfCmd Curves and SSLOpenSSLConfCmd Groups set the same list. An old Curves line from a hardening guide is a common reason a server with OpenSSL 3.5 is still classical-only.

Verify

openssl s_client -connect example.com:443 -groups X25519MLKEM768 </dev/null 2>&1 | grep "Negotiated TLS1.3 group"
# Negotiated TLS1.3 group: X25519MLKEM768

Or rescan with PQ Scan: the Confidentiality axis should read PQ preferred.

Things that don't change

  • Your certificate stays the same (post-quantum certificates are not available for public websites yet).
  • Clients without post-quantum support still connect with X25519 or P-256.
  • If a CDN or load balancer terminates TLS in front of Apache, visitors see the CDN's TLS, not this config. Fix it there too.

Ask your AI about this fix

Copy the recipe as Markdown, or open it in an assistant that can read the page.