3.8 Hybrid TLS per Stack
The configuration line, the version that must be linked in, and the command that proves what your server actually negotiated — for each TLS terminator.
3.7 Hybrid TLS explains what X25519MLKEM768 is and why the bytes are ordered ML-KEM first. This page is the operational companion: for each terminator, the version that must be present, the exact configuration line, the failure mode that produces a classical handshake while looking like a success, and the command that settles the argument.
The TLS library decides, not the proxy
X25519MLKEM768 is a TLS 1.3 named group with codepoint 0x11EC (4588). A proxy can only offer groups its cryptographic library implements. That makes the library version the real requirement, and it is the thing most rollouts get wrong: they edit a configuration file against a build that cannot honour it.
- OpenSSL 3.5 and later
- Adds
X25519MLKEM768,SecP256r1MLKEM768andSecP384r1MLKEM1024, and puts the first two in the default group list. Also adds the tiered group-list syntax described below. This is the library behind nginx, Apache httpd and curl on most Linux distributions. - BoringSSL
- Implements the hybrid and is what Envoy links against, including FIPS builds. Envoy includes X25519MLKEM768 in its default ECDH curves for both downstream and upstream connections.
- AWS-LC
- The library HAProxy Technologies ships in HAProxy Enterprise 3.2+ and the Community performance packages. A HAProxy built against stock OpenSSL from a distribution package does not get the hybrid curves, which is why
haproxy -vvis part of the check and not an optional extra. - Go crypto/tls 1.24+
- Enables the group by default. Go 1.26 also enables
SecP256r1MLKEM768andSecP384r1MLKEM1024. Anything that setsCurvePreferencesreplaces the default and must list the hybrid explicitly.GODEBUG=tlsmlkem=0turns it off. - rustls 0.23.27+, GnuTLS 3.8.8+, Node.js 22.20+ and 24.5+
- Each offers the group in its default configuration from these versions. As with Go, an explicit group or curve list replaces the default rather than extending it.
TLS 1.2 has no mechanism for a hybrid group. A client that negotiates TLS 1.2 gets a classical key exchange no matter what the group list says, so ssl_min_proto_version and its equivalents are part of the picture.
Verify before and after
Two checks answer different questions, and you need both. The external handshake proves the server is capable; the log variable proves your real clients are using it.
# 1. What library is this binary actually linked against?
# Checking `openssl version` on the host is not enough.
nginx -V 2>&1 | grep -i openssl
haproxy -vv | grep -i -E 'openssl|aws-lc'
httpd -V 2>&1 | grep -i openssl
envoy --version # BoringSSL-FIPS or OpenSSL
caddy version
# 2. External handshake, hybrid only. A server that cannot do it fails
# with "sslv3 alert handshake failure" / "SSL alert number 40".
openssl s_client -connect example.com:443 -servername example.com \
-tls1_3 -groups X25519MLKEM768 </dev/null 2>/dev/null | grep -E 'group|Temp Key'
# -> Negotiated TLS1.3 group: X25519MLKEM768
# 3. What the server picks when the client offers everything.
openssl s_client -connect example.com:443 -servername example.com \
</dev/null 2>/dev/null | grep -E 'group|Temp Key'
# 4. Confirm the classical path still works for old clients.
openssl s_client -connect example.com:443 -servername example.com \
-tls1_3 -groups X25519 </dev/null 2>/dev/null | grep -E 'group|Temp Key'
# -> Peer Temp Key: X25519, 253 bitsNote the two different output shapes: a hybrid group prints as Negotiated TLS1.3 group:, a classical one as Peer Temp Key:. If forcing the hybrid prints <NULL>, the handshake failed rather than falling back. macOS ships LibreSSL, which does not understand these group names — run the client check from a machine with OpenSSL 3.5+.
For curl, --curves X25519MLKEM768 works only when curl itself is linked against OpenSSL 3.5 or later. HAProxy ships a bssl client for exactly this reason:
curl -sv --curves X25519MLKEM768 https://example.com -o /dev/null 2>&1 | grep 'SSL connection'
# * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / X25519MLKEM768 / ...
printf "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n" | \
bssl s_client -curves SecP256r1MLKEM768 -connect 192.0.2.10:443
# ECDHE group: SecP256r1MLKEM768Colon versus slash: the silent downgrade
OpenSSL 3.5 extended the group-list syntax that nginx ssl_ecdh_curve, Apache SSLOpenSSLConfCmd Groups and others pass straight through. The two separators do different things, and the difference is invisible unless you are logging the negotiated group.
| Separator | Meaning | Effect on a hybrid-capable client that sent only an X25519 share |
|---|---|---|
: | Groups inside one tier | Connects immediately on X25519. Within a tier an existing key share beats preference order, so no retry is sent and the session is classical. |
/ | Starts a new tier (tuple), new in OpenSSL 3.5 | Gets a HelloRetryRequest asking for the hybrid share, and reconnects with X25519MLKEM768. Costs one extra round trip. |
Neither form is wrong. The flat list is the low-latency choice and is what OpenSSL's own default is built to do; the tiered list is the policy choice, for traffic where a classical session is worse than an extra round trip. What is wrong is picking one without knowing which you picked. Group names are case-insensitive in OpenSSL 3.5+.
Why the fallback is silent
Browsers advertise X25519MLKEM768 in supported_groups and usually also attach a plain 32-byte X25519 key_share as a fallback, so that a server without the hybrid can complete in one round trip. A flat-tier server takes that offer. The handshake succeeds, the certificate validates, the padlock appears — and the session key is protected only by X25519. The only place this shows up is the negotiated-group log field, which is why step 2 of a rollout is turning that field on, not editing the group list.
nginx
Requirements: nginx 1.11.0+ for a group list in ssl_ecdh_curve, 1.23.4+ for TLS 1.3 by default, 1.27.5+ for $ssl_curve to print a readable group name instead of a hex codepoint, and — the one that matters — nginx linked against OpenSSL 3.5.0 or later.
# Which OpenSSL is this nginx built with?
# nginx -V 2>&1 | grep -i openssl
http {
ssl_protocols TLSv1.2 TLSv1.3;
# Flat tier: lowest latency, allows a hybrid-capable client that sent
# only an X25519 share to connect classically.
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1:secp384r1;
# Tiered: insists on the hybrid for clients that support it, at the
# cost of one HelloRetryRequest round trip.
# ssl_ecdh_curve X25519MLKEM768/X25519:prime256v1:secp384r1;
# Leave the directive out entirely and OpenSSL 3.5's default list
# applies, which already prefers the hybrid.
log_format pq '$remote_addr [$time_local] "$request" '
'$ssl_protocol $ssl_curve';
access_log /var/log/nginx/pq.log pq;
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/nginx/ssl/example.com.crt;
ssl_certificate_key /etc/nginx/ssl/example.com.key;
}
}
# The origin leg is a separate TLS connection and needs its own setting.
# proxy_ssl_conf_command Groups X25519MLKEM768:X25519;nginx -t && nginx -s reload
# What did real clients actually negotiate? Unknown groups appear in hex;
# 0x11ec is 4588, the IANA codepoint for X25519MLKEM768.
awk '{print $NF}' /var/log/nginx/pq.log | sort | uniq -c | sort -rn
# Find the pinned group lists that are overriding the default.
grep -rn "ssl_ecdh_curve\|ssl_conf_command" /etc/nginx/A flat list must still contain a classical group. If you write ssl_ecdh_curve X25519MLKEM768; alone, a P-256-only client gets alert 40 — and if your certificate is ECDSA, include the curve that matches it.
The setting that actually applies
OpenSSL selects the key exchange group at the very start of the handshake, before SNI is processed. nginx therefore cannot vary groups per server_name: the ssl_ecdh_curve in the default_server block for that port decides the group for every hostname on it. The same directive inside a hostname-specific server block is accepted, appears in nginx -T, and is never used.
# Read the loaded config and find the block that decides groups.
nginx -T 2>/dev/null | grep -nE 'listen .*ssl|ssl_ecdh_curve|server_name '
# 214: listen 443 ssl default_server;
# 217: ssl_ecdh_curve prime256v1:secp384r1; <- this one applies to port 443
# 222: listen 443 ssl;
# 225: ssl_ecdh_curve X25519MLKEM768:X25519; <- never used
# 231: server_name app.example.com;The same asymmetry means ssl_protocols is applied per hostname while groups are not: a hostname pinned to TLS 1.2 gets no hybrid key exchange at all, whatever the port-level group list says.
NGINX Gateway Fabric
The nginx.org/ssl-ecdh-curve listener option needs Gateway Fabric 2.7+. It follows the rule above exactly: it takes effect only on the listener without a hostname, and on a hostname-specific listener it is silently ignored while the Gateway still reports Accepted, Programmed and ResolvedRefs as True.
Two further traps. An explicit list replaces OpenSSL's entire default set, so a list without an MLKEM group switches post-quantum off for the whole port. And the annotation rejects / with UnsupportedValue, so tiered ordering needs a SnippetsPolicy:
apiVersion: gateway.nginx.org/v1alpha1
kind: SnippetsPolicy
metadata:
name: pq-groups
namespace: pqc
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: gw-wild
snippets:
- context: http
value: ssl_ecdh_curve "X25519MLKEM768 / X25519:prime256v1:secp384r1";# Which OpenSSL does the data plane run, and what is actually loaded?
kubectl exec -n pqc deploy/gw-nginx -c nginx -- nginx -V 2>&1 | grep -i openssl
kubectl exec -n pqc deploy/gw-nginx -c nginx -- nginx -T 2>/dev/null \
| grep -nE 'listen .*ssl|ssl_ecdh_curve|server_name '
# Audit every listener in the cluster.
kubectl get gateways -A -o json | jq -r '
.items[] | .metadata as $m | .spec.listeners[]
| select(.tls != null and (.tls.mode // "Terminate") == "Terminate")
| [$m.namespace, $m.name, .name, .port, (.hostname // "<none>"),
(.tls.options["nginx.org/ssl-ecdh-curve"] // "-")] | @tsv'
# Count what real clients negotiated.
kubectl logs -n pqc deploy/gw-nginx -c nginx \
| jq -rR 'fromjson? | .group // empty' | sort | uniq -c | sort -rnApache httpd
mod_ssl exposes OpenSSL's SSL_CONF API through SSLOpenSSLConfCmd, available since httpd 2.4.8 with OpenSSL 1.0.2 or later. The Groups command takes the same OpenSSL 3.5 group-list string, including the tier syntax:
# httpd must be built against OpenSSL 3.5+: httpd -V | grep -i openssl
<VirtualHost *:443>
ServerName example.com
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/example.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/example.com.key
SSLProtocol -all +TLSv1.2 +TLSv1.3
SSLOpenSSLConfCmd Groups X25519MLKEM768/X25519:secp256r1
</VirtualHost>SSLOpenSSLConfCmd is a server-config and virtual-host directive, but group selection still happens before the virtual host is known, so the same default-server reasoning as nginx applies. SSLHonorCipherOrder and SSLCipherSuite do not control groups; do not try to reach the hybrid through them.
HAProxy
Native hybrid support needs HAProxy Enterprise 3.2+ or HAProxy Community 3.3+, and specifically the builds distributed by HAProxy Technologies, because those are the ones linked against AWS-LC. A Community build from your distribution's package manager will parse the curves line and offer nothing. SecP384r1MLKEM1024, the CNSA 2.0-aligned option, needs Enterprise 3.4r1+ or the Community performance packages.
# haproxy -vv must show AWS-LC as the crypto library.
# Option A: internet-facing, hybrid preferred, classical fallback kept.
ssl-default-bind-options ssl-min-ver TLSv1.3 no-tls-tickets
ssl-default-bind-curves X25519MLKEM768:SecP256r1MLKEM768:X25519:P-384:P-256
ssl-default-server-options ssl-min-ver TLSv1.3
ssl-default-server-curves X25519MLKEM768:SecP256r1MLKEM768:X25519:P-384:P-256
# Option B: US national security systems, CNSA 2.0 aligned, no classical fallback.
# ssl-default-bind-ciphersuites TLS_AES_256_GCM_SHA384
# ssl-default-server-ciphersuites TLS_AES_256_GCM_SHA384
# ssl-default-bind-curves SecP384r1MLKEM1024
# ssl-default-server-curves SecP384r1MLKEM1024ssl-default-bind-curves covers the client side and ssl-default-server-curves the backend side. Setting only the first leaves every HAProxy-to-origin connection classical, which is the same one-leg-only mistake as a CDN in front of an unconfigured origin.
Envoy, Envoy Gateway and Istio
Envoy's BoringSSL backend includes X25519MLKEM768 in the default ECDH curves for both downstream and upstream connections, including FIPS builds, and peers without ML-KEM fall back to X25519 or P-256 through normal group negotiation. For current Envoy there is normally nothing to configure.
The version still matters. Envoy Gateway 1.9.2 (Envoy 1.39.5) can negotiate the hybrid but does not offer it by default, using X25519 or P-256 instead; Envoy Gateway 1.10 (Envoy 1.40) makes the hybrid the default. If you are below that line, set it explicitly:
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
common_tls_context:
tls_params:
ecdh_curves:
- X25519MLKEM768
- X25519
- P-256The same ecdh_curves field exists on UpstreamTlsContext. Envoy also exposes a kill switch — the runtime flag envoy.reloadable_features.pqc_default_ecdh_curves, set to false to return to classical defaults. If a rollout broke a middlebox and someone flipped that flag, the group list in your YAML will look correct and the behaviour will not be. Check the runtime layer too. Istio surfaces the same setting through its curve_list and post-quantum cipher-suite options.
Caddy
Caddy 2.10+ built with Go 1.24+ offers the hybrid through crypto/tls with no configuration. The failure mode is the Go one: curves in a tls block, or tls_curves inside a transport http reverse-proxy block, replaces the default list rather than adding to it.
# Nothing to do if you never set curves — verify instead:
# curl -sv --curves X25519MLKEM768 https://example.com -o /dev/null
# If you do pin curves, the hybrid must be listed explicitly.
example.com {
tls /etc/caddy/example.com.crt /etc/caddy/example.com.key {
curves x25519mlkem768 x25519 secp256r1
}
}
# The reverse-proxy leg has its own list.
reverse_proxy backend:8080 {
transport http {
tls_server_name backend.internal
tls_curves x25519mlkem768 x25519
}
}A report of Caddy negotiating plain X25519 usually turns out to be a binary not built with Go 1.24.caddy version and caddy build-info settle it; GODEBUG=tlsmlkem=0 in the environment is the other thing to grep for.
Go, Node and Rust services that terminate their own TLS
cfg := &tls.Config{MinVersion: tls.VersionTLS13}
// Leave CurvePreferences unset, or include tls.X25519MLKEM768 in it.
// Setting it to {tls.X25519, tls.CurveP256} silently opts out.
conn, err := tls.Dial("tcp", "example.com:443", cfg)
if err != nil {
log.Fatal(err)
}
defer conn.Close()
fmt.Println(conn.ConnectionState().CurveID) // Go 1.25+: X25519MLKEM768# Node.js 22.20+ / 24.5+ — the group is in the default list.
# An explicit `groups` or `ecdhCurve` in the TLS options replaces it.
node -e "console.log(require('tls').getCiphers().length)"
# Find the opt-outs in a Go or Node codebase.
grep -rn "CurvePreferences\|tlsmlkem\|ecdhCurve\|groups:" --include='*.go' --include='*.js' .rustls 0.23.27+ offers the group by default; an explicit kex_groups or provider list replaces the default in the same way.
Managed edges and the leg that terminates TLS
Cloudflare negotiates the hybrid with visitors by default, so the browser-facing leg of a site behind it is already protected. That says nothing about the CDN-to-origin leg, which is a separate connection with its own configuration. The same is true of any managed load balancer: find out which component terminates TLS, configure that one, and then check the next hop.
A useful audit question for any estate: how many distinct TLS terminations does one user request pass through? Browser to CDN, CDN to ingress, ingress to service mesh sidecar, sidecar to application, application to database. Each is a separate negotiation and each can be classical while its neighbours are hybrid.
Rollout order
- Inventory the terminations. Every component that ends a TLS connection, including internal ones.
nginx -T,haproxy -vv,httpd -V,envoy --versionandcaddy build-infogive you the library versions in one pass. - Upgrade the library before touching configuration. Nothing else works until the binary is linked against something that implements the group.
- Turn on negotiated-group logging.
$ssl_curvein nginx, the equivalent access-log field elsewhere. Without it you cannot tell a working rollout from a silent downgrade. - Remove the overrides, do not add to them. The commonest reason a modern stack is not hybrid is a pinned group list from an earlier hardening pass. Grep for
ssl_ecdh_curve,Groups,curves,ecdh_curves,CurvePreferences. - Watch error rates, not one manual test. The 1,216-byte key share pushes the ClientHello past a typical 1,500-byte MTU, and software that assumes one
read()returns the whole record breaks. See the ClientHello size problem and tldr.fail. - Decide per hostname whether a classical fallback is acceptable. That is the colon versus slash decision, and it is a policy question, not a technical one. Long-lived confidentiality argues for the slash; latency-sensitive public endpoints argue for the colon.
- Repeat for the origin legs.
proxy_ssl_conf_command,ssl-default-server-curves,UpstreamTlsContext,tls_curvesin a Caddy transport.
Hybrid key exchange fixes confidentiality only. Certificates still use RSA or ECDSA, which is acceptable for now because a signature only has to resist forgery during the handshake and cannot be harvested. Post-quantum certificates are a separate migration with a much larger size impact — see signature budgets and choosing a PQ signature scheme.
Check Your Understanding
Q1. A server is configured with `ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1;`. A browser that supports the hybrid connects, but your access log shows `$ssl_curve` as `X25519`. What happened?
Q2. You set `nginx.org/ssl-ecdh-curve` on an NGINX Gateway Fabric listener that has a hostname. The Gateway reports Accepted, Programmed and ResolvedRefs all True, but the group never changes. Why?
Q3. Which of these must be true before any of the proxy configurations on this page can work?
Sources
- NGINX blog: Post-quantum TLS with NGINX Gateway Fabric — the
default_servergroup-selection rule, the Gateway Fabric 2.7 listener option and its hostname caveat, the SnippetsPolicy workaround for tiered lists, and thenginx -Tand$ssl_curveverification procedure. - Enabling post-quantum TLS in nginx — nginx and OpenSSL version requirements, colon versus slash tier semantics, fallback behaviour,
proxy_ssl_conf_command, and the0x11eccodepoint in logs. - HAProxy blog: post-quantum cryptography and TLS termination — Enterprise 3.2+ / Community 3.3+ requirement, the AWS-LC dependency,
ssl-default-bind-curvesandssl-default-server-curves, the CNSA 2.0 variant, andbssl-based verification. - Envoy documentation: SSL architecture overview — X25519MLKEM768 in the default downstream and upstream ECDH curves including FIPS builds, the
ecdh_curvesfield, and thepqc_default_ecdh_curvesruntime flag. - Qovery advisory, December 1 2026 — Envoy Gateway 1.9.2 / Envoy 1.39.5 does not offer the hybrid by default; Envoy Gateway 1.10 / Envoy 1.40 does.
- Apache mod_ssl documentation —
SSLOpenSSLConfCmd, available since httpd 2.4.8 with OpenSSL 1.0.2+, passing commands to OpenSSL'sSSL_CONFAPI. - goodtls.com and the Caddy community thread on post-quantum — Caddy 2.10+ defaults,
curvesreplacing rather than extending the default list, andGODEBUG=tlsmlkem=0. - Enabling post-quantum TLS on Linux —
openssl list -tls1_3 -tls-groupsandopenssl list -kem-algorithmsfor checking what a local OpenSSL build supports. - RFC 10024 — the codepoints, key-share sizes and component ordering for the three PQ/T hybrid groups.
Version behaviour changes quickly in this area. Every claim above is attributed; re-check the linked source before relying on a version boundary. For how the handshake itself is constructed, see 3.7 Hybrid TLS and a field-by-field transcript.