Post-Quantum Verified

Migration guide

Enable the hybrid group X25519MLKEM768 on nginx

Make nginx, built against OpenSSL 3.5 or later, offer the hybrid post-quantum key-exchange group X25519MLKEM768 with ssl_ecdh_curve, then verify it with openssl s_client.

Documentation only Last reviewed 2026-12-04

How this guide was validated. Drafted from the cited sources and not run here: nginx is not installed on the lab machine. The group string X25519MLKEM768:X25519 was lab-tested as an ecdhCurve value on Node.js v24.13.1 (OpenSSL 3.5.5), and the verify step was run against that server with OpenSSL 3.6.2 and 4.1.0 s_client (see verify-tls-key-exchange). That shows OpenSSL 3.5 accepts the group list. It does not show nginx behaves the same.

Applies to

  • nginx with ssl_ecdh_curve (1.11.0 or later for multiple curves) built against OpenSSL 3.5 or later
  • TLS 1.3 enabled (default since nginx 1.23.4)

Before you start

  • nginx built against OpenSSL 3.5 or later. Run nginx -V and look at the "built with OpenSSL" line. A distribution package may link a different OpenSSL than the one installed on the system.
  • TLS 1.3 enabled. The nginx default for ssl_protocols is TLSv1.2 TLSv1.3 (TLSv1.3 default since 1.23.4).
  • A way to test from an OpenSSL 3.5+ client (see verify-tls-key-exchange).
  • A maintenance window and a copy of the current configuration.

Steps

  1. Check what nginx is built against
    Hybrid groups exist only in OpenSSL 3.5 and later. If nginx is built with an older OpenSSL, the directive below cannot help. Upgrade nginx or its OpenSSL first.
    nginx -V

    Expect: The output includes a "built with OpenSSL" line. It must show 3.5 or later.

  2. Check whether you already offer it
    ssl_ecdh_curve defaults to auto, which uses the list built into the OpenSSL library. In OpenSSL 3.5 the default group list starts with X25519MLKEM768, so an unchanged nginx on OpenSSL 3.5 may already negotiate it. Run the verify step before changing anything. If you do not need to change the config, stop here.
  3. Set the group list explicitly (only if needed)
    Put the directive in the http or server block. List the hybrid group first, then classical groups so older clients still connect. When the directive is set, nginx documents that it sets the list of curves the server supports, so also list the curve used by any ECDSA certificate (prime256v1 here).
    ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1:secp384r1;

    Expect: The line sits inside http {} or server {}. nginx -t reports it is OK.

  4. Test the configuration and reload
    nginx -t checks syntax. A reload starts new workers with the new configuration and shuts down old ones gracefully.
    nginx -t
    nginx -s reload

    Expect: nginx -t reports that the syntax is ok and the test is successful. Reload returns without error.

Verify

  1. Check the negotiated group from an OpenSSL 3.5+ client
    Run from a different machine or from the host itself, against your own endpoint.
    openssl s_client -connect example.com:443 -servername example.com </dev/null 2>&1 | grep -E "Negotiated TLS1.3 group|Peer Temp Key"

    Expect: "Negotiated TLS1.3 group: X25519MLKEM768". This is the line seen against a hybrid server on OpenSSL 3.6.2 and 4.1.0 in the lab. Also confirm an older client still connects, for example with -groups X25519, which should show "Peer Temp Key: X25519, 253 bits".

Roll back

  1. Remove the directive and reload
    Delete the ssl_ecdh_curve line you added (or restore the saved copy of the configuration). The default, auto, returns. Then test and reload.
    nginx -t
    nginx -s reload

    Expect: Same successful test and reload. The verify step then shows whatever your OpenSSL default negotiates.

What this guide does not cover

  • Not run on nginx here. Treat the exact behaviour (including how nginx reports a bad group name) as unconfirmed until you run nginx -t on your build.
  • A key-exchange result says nothing about authentication: the certificate and its signature are a separate question, and certificate signatures are not made post-quantum by this change.
  • Only the connection between the client and this nginx is covered. If nginx proxies to an upstream, that leg is configured separately (proxy_pass TLS settings) and is not changed here.
  • A CDN or load balancer in front of nginx terminates the client connection itself. See cdn-edge-and-origin.
  • Some middleboxes handle the larger hybrid ClientHello badly. Test from the networks your users are on and keep the classical fallback in the list.
  • Clients that do not offer the hybrid group will use a classical group. That is expected.

Sources

Only change systems you own or are authorized to change. Have a person approve each change and keep a rollback.