Nginx Post-Quantum Key Exchange

Turn on hybrid X25519MLKEM768 key exchange between Cloudflare and your Centmin Mod Nginx origin, with steps for each branch and OS.

Table of Contents

Overview

Post-quantum key exchange protects HTTPS traffic recorded today from being decrypted later by a quantum computer (“harvest now, decrypt later”). The hybrid group X25519MLKEM768 combines classical X25519 with ML-KEM-768 (NIST FIPS 203), so a connection stays protected as long as either part holds.

Cloudflare already uses it between visitors’ browsers and Cloudflare. This page covers the other leg: the connection from Cloudflare to your Centmin Mod Nginx origin server.

Visitor’s browser
TLS 1.3, X25519MLKEM768 On by default
Cloudflare edge
TLS 1.3, post-quantum hybrid This page
Centmin Mod Nginx origin
The two TLS legs of a request through Cloudflare. Cloudflare covers the first one by default; this page covers the second.

Status as of December 5, 2026

  • The NGINX_PQ_GROUPS setting and the nginx_crypto_check.sh pq report are new in 141.00beta01 (run cmupdate first). They will also be in the upcoming 142.00stable and 150.00beta01 releases, which are cut from 141.00beta01.
  • 132.00stable and 140.00beta01 do not have them: on those branches the steps are done by hand. See Which branch are you on?
  • EL9 option B has not yet been tested by Centmin Mod, and a Cloudflare to origin post-quantum connection has not yet been observed in Centmin Mod’s own tests.

This page replaces the October 2023 blog post How to enable Cloudflare Post-Quantum X25519Kyber768 key exchange support in Centmin Mod Nginx, which switched nginx to BoringSSL for the draft X25519Kyber768Draft00 group. Most of that is no longer needed, and settings from it now break nginx (Step 2). The full write-up is on the Centmin Mod blog: How To Enable Cloudflare Post-Quantum (X25519MLKEM768) Key Exchange in Centmin Mod Nginx.

Video Explainer

A 3 minute 24 second overview: harvest now, decrypt later, what changed since 2023, the two TLS legs, the OS table, the five steps and quick answers. The captions are part of the video picture, so they show on every player. The video shows the 141.00beta01 steps (the pq report and NGINX_PQ_GROUPS); on 132.00stable and 140.00beta01, follow the written steps below.

Download the video (MP4, 7 MB, 1080p).

What Changed Since 2023

  • The standard hybrid X25519MLKEM768 (X25519 combined with ML-KEM-768) replaces the draft X25519Kyber768Draft00 group. Browsers, OpenSSL, AWS-LC and BoringSSL support it, and current OpenSSL and AWS-LC no longer know the draft at all. Cloudflare prefers X25519MLKEM768, and selects the draft only for an origin whose only post-quantum group is the draft.
  • You no longer need BoringSSL. A TLS library with post-quantum key exchange enabled is enough: the system OpenSSL 3.5 on EL10.1+, the same on EL9.7+ once the groups are enabled, or AWS-LC.
  • Cloudflare chooses the origin key exchange for you with Automatic key exchange. The old “post-quantum preferred” setting (the origin_post_quantum_encryption API call) is deprecated: its value only applies until Automatic key exchange selects a preference for the zone or a compliance requirement is set.

Which Branch Are You On?

The setup depends on your Centmin Mod branch. This command prints it, followed by the build number (for example 140.00beta01.b541):

cat /etc/centminmod-release
What you get 141.00beta01 140.00beta01 132.00stable
NGINX_PQ_GROUPS setting Yes No No
nginx_crypto_check.sh pq report Yes No No
EL10.1+ On by default EL10 not supported EL10 not supported
EL9.7+ Option A (managed), B or C Option B or C (by hand) Option B or C (by hand)
EL9 before 9.7 Update to 9.7+, or AWS-LC Update to 9.7+, or AWS-LC Update to 9.7+
EL8 AWS-LC 5.15.0 AWS-LC 5.12.0 No: AWS-LC is turned off on this branch
Tested by Centmin Mod AlmaLinux 8.10, 9.9, 10.3 Not tested Not tested

Steps 1, 2, 4 and 5 are the same on every branch. Step 3 has one section per branch: 141.00beta01 and 132.00stable / 140.00beta01.

Requirements

Post-quantum key exchange to the origin depends on the TLS library nginx uses. With Centmin Mod’s default library for each OS:

OS Default nginx TLS library Post-quantum to origin
EL10.1+ (AlmaLinux / Rocky Linux 10) System OpenSSL 3.5 Yes, out of the box
EL10.0 System OpenSSL 3.2 No: update the OS (dnf update; new installs do this first), or use AWS-LC
EL9.7+ (AlmaLinux / Rocky Linux 9) System OpenSSL 3.5 Yes, after Step 3
EL9 before 9.7 System OpenSSL 3.0 / 3.2 No: update the OS to 9.7+, or use AWS-LC (140.00beta01 and 141.00beta01)
EL8 (AlmaLinux / Rocky Linux 8) System OpenSSL 1.1.1 With AWS-LC (140.00beta01 and 141.00beta01)
CentOS 7 Source-built OpenSSL 1.1.1w No: AWS-LC is not available on CentOS 7

EL10 is supported only by 141.00beta01. Centmin Mod tested this setup on 141.00beta01 with nginx 1.31.10 on AlmaLinux 10.3 and 9.9 (system OpenSSL), and with AWS-LC 5.15.0 on AlmaLinux 8.10, 9.9 and 10.3. Rocky Linux should behave the same but was not tested.

The table assumes the default library. These nginx builds have no post-quantum key exchange on any OS: quicTLS (NGINX_QUIC_SUPPORT='y') and a source-built OpenSSL 1.1.1 (OPENSSL_SYSTEM_USE='n' with the default OPENSSL_VERSION='1.1.1w'). LibreSSL (LIBRESSL_SWITCH='y') and a source-built OpenSSL 3.5 have not been tested. AWS-LC (AWS_LC_SWITCH='y') has it, and takes priority over quicTLS.

You Also Need

  • The site proxied through Cloudflare (orange cloud) with SSL/TLS mode Full, Full (strict) or Strict (SSL-Only Origin Pull). Flexible mode does not use TLS to the origin.
  • TLS 1.3 on the origin. Centmin Mod’s default ssl_protocols TLSv1.2 TLSv1.3; has it.
  • ssl_prefer_server_ciphers on; in each HTTPS vhost if nginx uses AWS-LC, so that clients sending an X25519 key share first are moved onto post-quantum. Centmin Mod’s vhost templates set it on all three branches.

AWS-LC’s default key exchange list includes X25519MLKEM768 and includes the common classical groups, but not X448, P-521 or the ffdhe groups that the EL9 line below keeps. That only matters for unusual clients.

Lua users (ORESTY_LUANGINX='y', off by default): on 140.00beta01 and 141.00beta01, Lua modules build with AWS-LC (tested with AWS-LC 5.15.0 on AlmaLinux 9.9), but ssl_client_hello_by_lua* server-name and extension calls are not supported with AWS-LC. Test on a staging server first.

Sites reached through Cloudflare Tunnel (cloudflared) are not covered: the tunnel has its own connection to Cloudflare, with its own post-quantum settings.

Step 1: Check Your Server

141.00beta01: the pq Report

For a quick local report, run:

/usr/local/src/centminmod/tools/nginx_crypto_check.sh pq

It changes nothing. It shows the TLS library nginx runs with, the system crypto policy, FIPS mode, the NGINX_PQ_GROUPS line if there is one, and any ssl_ecdh_curve or ssl_conf_command settings nginx loads. On EL9 it also checks the library, crypto policy and FIPS conditions for NGINX_PQ_GROUPS='y' (menu option 4 checks the rest of the Option A list when it runs), and on EL10 it says whether HTTPS sites get post-quantum key exchange. On 132.00stable and 140.00beta01 the script has no pq mode: use the checks below.

All Branches: Check the TLS Library

See which TLS library nginx runs with:

/usr/local/sbin/nginx -V 2>&1 | grep -E -o 'built with.*|running with[^)]*|--with-openssl=[^ ]*'

When a running with part is shown, it is the library nginx loads; otherwise read built with.

  • OpenSSL 3.5.x and no --with-openssl= means the system OpenSSL 3.5. To confirm, ldd /usr/local/sbin/nginx | grep libssl should show /lib64/libssl.so.3 or /usr/lib64/libssl.so.3.
  • OpenSSL with --with-openssl=... means a source-built OpenSSL.
  • LibreSSL means LibreSSL (its builds also show --with-openssl=...).
  • AWS-LC means AWS-LC.

This describes the installed binary. If the OS was updated since nginx last started (for example from EL9.6 to 9.7, or EL10.0 to 10.1), restart nginx with nginx -t && ngxrestart, not a reload, so the running server loads the new library too. If nginx -t fails, fix the config first (Step 2): a restart with a failing config leaves nginx stopped.

All Branches: Test a Handshake on the Origin

Test a site directly on the origin, not through Cloudflare. Use an OpenSSL 3.5 or newer client: the system openssl on EL9.7+ and EL10.1+, or a recent OpenSSL on another machine. The system openssl on EL8 and older EL9 cannot do this test. Replace example.com with a site on the server and ORIGIN_IP with the server’s IP address. Do not connect to the hostname: it resolves to Cloudflare, so you would test Cloudflare instead of your server. For an IPv6 address use -connect '[2001:db8::1]:443'.

pq_probe() {
  out=$(mktemp) || return 1
  echo | timeout 10 openssl s_client -connect ORIGIN_IP:443 -servername example.com \
    -tls1_3 -groups "$1" > "$out" 2>&1; echo "groups=$1 exit=$?"
  grep -E 'Negotiated TLS1.3 group|Peer Temp Key|alert|connect:' "$out"; rm -f "$out"
}
pq_probe X25519MLKEM768
pq_probe X25519

The second run is a classical control.

  • Negotiated TLS1.3 group: X25519MLKEM768 on the first run: the origin supports post-quantum key exchange.
  • Peer Temp Key: X25519, 253 bits on the second run: the server works over TLS 1.3. A classical handshake prints this line instead of a Negotiated TLS1.3 group line.
  • alert handshake failure on the first run while the control works: the server refused post-quantum key exchange. If the control fails too, the cause is something else (protocols or ciphers): check the vhost and the nginx error log.
  • connect: lines, exit=124 (timeout), or no group or alert line at all: the test is inconclusive because no handshake completed (wrong IP, port, firewall or client). To see the full output, replace the grep -E ... "$out" command in the function with cat "$out".

Certificate verification messages (for example with a Cloudflare Origin CA certificate) do not matter here and are left out. If you use Cloudflare Authenticated Origin Pulls (ssl_verify_client on), the group line still counts even if the request is later refused for the missing client certificate.

To check what a client gets when it sends a classical key share first, use -groups X25519:X25519MLKEM768: a server set up as this page describes answers X25519MLKEM768. Add -trace to see the HelloRetryRequest it uses to ask for the post-quantum key share.

Step 2: Remove Old 2023 and 2024 Settings

Do this before rebuilding nginx in Step 3. If you followed the 2023 blog post, its 2024 update or an earlier version of the Nginx page on this site, look for leftover settings:

grep -rn -E 'ssl_ecdh_curve|ssl_conf_command' /usr/local/nginx/conf/
grep -n -E 'BORINGSSL_SWITCH|AWS_LC_SWITCH|LIBRESSL_SWITCH|NGINX_QUIC_SUPPORT|OPENSSL_SYSTEM_USE' \
  /usr/local/src/centminmod/inc/custom_config.inc /etc/centminmod/custom_config.inc \
  /usr/local/src/centminmod/inc/z_custom.inc 2>/dev/null

Matches under /usr/local/nginx/conf/acmevhostbackup/ are backup copies that nginx does not load; you can ignore them. To see only the files nginx loads, including any outside /usr/local/nginx/conf:

nginx -T | grep -E '^# configuration file|ssl_ecdh_curve|ssl_conf_command'

If the config test fails, this prints only nginx’s error, which names the file and line. Centmin Mod reads the three config files in the order listed, so a later one wins (inc/z_custom.inc only exists if you created it). Copy any file you change to a directory outside /usr/local/nginx/conf first, then:

  1. Remove every ssl_ecdh_curve line that names X25519Kyber768Draft00, in nginx.conf and in every vhost. That group no longer exists in current OpenSSL or AWS-LC, and nginx checks the line in every HTTPS vhost: nginx -t fails with SSL_CTX_set1_curves_list(...) failed.
  2. Remove ssl_ecdh_curve X25519MLKEM768:X25519; lines too. That list leaves out P-256 and P-384, so clients that only support those curves cannot connect, and with OpenSSL it keeps clients that send an X25519 key share first on X25519.
  3. Remove ssl_conf_command lines that set Groups or Curves, or set ECDHParameters to a list of groups: they override ssl_ecdh_curve. If you plan to use AWS-LC, remove every ssl_conf_command line: nginx built with AWS-LC rejects that directive (“not supported on this platform”). A group list you set on purpose for other reasons (for example a compliance rule) is yours to keep; Step 3 then does not apply to that server.
  4. In /etc/centminmod/custom_config.inc, set the library switches you do not want explicitly to 'n' rather than deleting them. Centmin Mod reads inc/custom_config.inc first, so a deleted line can leave an older 'y' in effect. Also check that inc/z_custom.inc, if you have one, does not set them back. To go back to the system OpenSSL on EL9 or EL10:
    OPENSSL_SYSTEM_USE='y'
    BORINGSSL_SWITCH='n'
    AWS_LC_SWITCH='n'
    LIBRESSL_SWITCH='n'
    NGINX_QUIC_SUPPORT='n'
    To switch to AWS-LC instead (EL8, or by choice; 140.00beta01 and 141.00beta01 only), set AWS_LC_SWITCH='y' with BORINGSSL_SWITCH='n' and LIBRESSL_SWITCH='n'. Set only one library switch to 'y'. BoringSSL is no longer needed, and it has no OCSP stapling in nginx.

On 141.00beta01, the NGINX_PQ_GROUPS setting manages one exact line ending in # centminmod-pq-groups: leave that line as it is. A changed copy of it counts as your own setting.

Check and apply the config changes:

nginx -t && ngxreload

If you changed a library switch, rebuild nginx with centmin menu option 4 (Step 3) and check the result with the Step 1 nginx -V command. Fix any nginx -t error first. On 141.00beta01, Centmin Mod’s automatic nginx updates (tools/autoupdate.sh) stop before rebuilding when the current config fails nginx -t.

Where ssl_ecdh_curve applies

nginx takes the key exchange list from the listener’s default_server (or the first server on that IP and port), not from the vhost the visitor asked for. A setting in another vhost on the same listener does not change the key exchange, but nginx -t still checks it. Set it at the http {} level, or in the default_server vhost, or not at all.

Step 3 on 141.00beta01

Run cmupdate first so the server has the current 141.00beta01 code, then follow the section for your OS. On 132.00stable or 140.00beta01, skip to Step 3 on 132.00stable and 140.00beta01.

EL10

Nothing to do with the default system OpenSSL on EL10.1+: the default system crypto policy prefers X25519MLKEM768, and nginx’s default ssl_ecdh_curve auto follows it. Leave ssl_ecdh_curve unset. If you set the system policy to DEFAULT:NO-PQ or another policy on purpose, nginx follows that too.

On EL10, NGINX_PQ_GROUPS defaults to 'y' and only reports: it never adds the line there (it only removes one left over from EL9, see below). After menu option 4 and a new install, Centmin Mod prints one line, for example:

NGINX_PQ_GROUPS: EL10 post-quantum key exchange for HTTPS: on: the system crypto policy DEFAULT offers ML-KEM groups, first X25519MLKEM768

When it says off, not checked or unknown, the line gives the reason: for example an older OpenSSL (EL10.0), a TLS library without post-quantum support such as quicTLS, or a crypto policy without the groups. When it says set by the nginx config, an ssl_ecdh_curve or ssl_conf_command setting in your nginx config replaces the default key exchange list (Step 2). A line left over from the EL9 setting (after an EL9 to EL10 upgrade) is removed. Set NGINX_PQ_GROUPS='n' in /etc/centminmod/custom_config.inc to turn the report off.

EL9

EL9.7 and newer ship OpenSSL 3.5, but the default system crypto policy leaves the post-quantum groups out. If you just updated from an older EL9, restart nginx with nginx -t && ngxrestart, not a reload, so it loads the new OpenSSL library. Then choose one option.

Option A: For Nginx Only, Managed by Centmin Mod (Recommended)

Tested on AlmaLinux 9.9. Set this in /etc/centminmod/custom_config.inc (it is off by default):

NGINX_PQ_GROUPS='y'

Then update Centmin Mod and rebuild nginx with centmin menu option 4 (the same nginx version is fine):

cmupdate && centmin

Menu option 4 adds one marked line to the http {} block of /usr/local/nginx/conf/nginx.conf, directly after the include /usr/local/nginx/conf/ssl_include.conf; line:

ssl_ecdh_curve X25519MLKEM768:?SecP256r1MLKEM768:?SecP384r1MLKEM1024/?X25519:?secp256r1:?X448:?secp521r1:?secp384r1:?ffdhe2048:?ffdhe3072:?ffdhe4096:?ffdhe6144:?ffdhe8192; # centminmod-pq-groups

The / splits the list into two preference groups: the post-quantum hybrids first, then every classical group the EL9 default policy allows, in the same order. Clients that support a post-quantum hybrid get one (usually X25519MLKEM768), even when they send an X25519 key share first. Clients that do not support one keep working as before.

It only adds the line when all of these hold, and prints the reason when it skips:

  • nginx runs with the system OpenSSL 3.5 or newer;
  • the system crypto policy is exactly DEFAULT, its group list is the known EL9 default, and FIPS mode is off;
  • the policy files match what the system generates (update-crypto-policies --check), and /etc/crypto-policies/local.d has no OpenSSL override;
  • no other ssl_ecdh_curve or group-setting ssl_conf_command exists in the config nginx loads, and nginx -t passes;
  • nginx.conf is a regular file, not a symlink, and has exactly one stock include /usr/local/nginx/conf/ssl_include.conf; on a line of its own, directly in its http {} block;
  • NGINX_ALLOWOVERRIDE is 'y' (the default);
  • nginx accepts the new line in a test config, and your full config with the line passes nginx -t before nginx.conf is replaced. If a test fails, nginx.conf is left unchanged. Before each change, a copy of nginx.conf is saved in /usr/local/nginxbackup/pq-groups/ (the default backup directory; menu option 4 prints the path).

If it skips because of a customised nginx.conf, use option C. A commented-out copy of the line counts as “leave it off”: menu option 4 does not add it again. A changed copy of the line, or one moved to another file, is treated as yours: menu option 4 reports it and leaves it alone, so you need to fix or remove it yourself. If you used option C before, remove that line first.

At the next menu option 4 it removes the line again if you set NGINX_PQ_GROUPS='n', switch nginx to another library, upgrade to EL10, change the system policy, or an OS update changes the default group list. It does this even with NGINX_ALLOWOVERRIDE='n', so that nginx -t keeps passing. A removal only sticks once menu option 4 finishes successfully, so rerun menu option 4 after any such change.

Before turning on FIPS mode

Set NGINX_PQ_GROUPS='n', run menu option 4, and check with the grep below that the line is gone. FIPS mode needs a reboot, and RHEL’s FIPS policy does not allow X25519MLKEM768, so nginx may not start with the line in place.

Check it worked:

grep -n centminmod-pq-groups /usr/local/nginx/conf/nginx.conf

It should print the line exactly as above, not commented out. Then repeat the Step 1 handshake test.

Option B: System-Wide (Not Yet Tested by Centmin Mod)

Switch the server’s crypto policy to the post-quantum sub-policy. This changes every program on the server that follows the system policy, not only nginx: PHP, curl, dnf and other TLS clients send larger post-quantum key shares, and the policy also enables post-quantum signature algorithms. Only for EL9.7 or newer, with nginx on the system OpenSSL 3.5 (Step 1) and no ssl_ecdh_curve or group-setting ssl_conf_command left (Step 2). Do not use it on a server with FIPS, FUTURE or a custom policy.

The commands only act on an unmodified DEFAULT policy with FIPS off and no local OpenSSL overrides in /etc/crypto-policies/local.d (other files there are normal), and change the policy back if nginx fails afterwards:

fips=$(cat /proc/sys/crypto/fips_enabled) || fips=unknown
policy=$(update-crypto-policies --show) || policy=unknown
if [ "$policy" = DEFAULT ] && [ "$fips" = 0 ] && update-crypto-policies --check >/dev/null \
   && locald=$(ls -A /etc/crypto-policies/local.d) && ! printf '%s\n' "$locald" | grep -q '^opensslcnf' \
   && nginx -t; then
  if ! update-crypto-policies --set DEFAULT:PQ; then
    echo "update-crypto-policies --set DEFAULT:PQ failed; check: update-crypto-policies --show"
  elif nginx -t && ngxrestart; then
    echo "Changed the system policy to DEFAULT:PQ"
  else
    echo "nginx failed with DEFAULT:PQ: changing the policy back to DEFAULT"
    if update-crypto-policies --set DEFAULT && nginx -t && ngxrestart; then
      echo "Policy is DEFAULT again and nginx was restarted"
    else
      echo "RECOVERY FAILED: check update-crypto-policies --show and systemctl status nginx"
    fi
  fi
else
  echo "Not changed: policy=$policy fips=$fips, the policy files were edited or have local OpenSSL overrides, or nginx -t failed"
fi

Then repeat the Step 1 test. Red Hat recommends a reboot so that every running service picks up a policy change. Undo it with update-crypto-policies --set DEFAULT, then nginx -t && ngxrestart (or reboot).

Option C: By Hand

Only when nginx runs with the system OpenSSL 3.5 or newer (Step 1; OpenSSL 3.0 to 3.4 reject the line) and no other ssl_ecdh_curve or group-setting ssl_conf_command exists (Step 2). This block checks that the policy is an unmodified DEFAULT with FIPS off, no local OpenSSL overrides in /etc/crypto-policies/local.d, and the EL9 default group list the line repeats, checks nginx -t, and makes a backup. Continue only if it prints backup made:

f=/usr/local/nginx/conf/nginx.conf
el9='*X25519:secp256r1:X448:secp521r1:secp384r1:ffdhe2048:ffdhe3072:ffdhe4096:ffdhe6144:ffdhe8192'
if policy=$(update-crypto-policies --show) && [ "$policy" = DEFAULT ] \
   && fips=$(cat /proc/sys/crypto/fips_enabled) && [ "$fips" = 0 ] \
   && update-crypto-policies --check >/dev/null \
   && locald=$(ls -A /etc/crypto-policies/local.d) && ! printf '%s\n' "$locald" | grep -q '^opensslcnf' \
   && groups=$(grep -E '^[[:space:]]*Groups[[:space:]]*=' /etc/crypto-policies/back-ends/opensslcnf.config) \
   && [ "$(printf '%s\n' "$groups" | sed -E 's/^[[:space:]]*Groups[[:space:]]*=[[:space:]]*//; s/[[:space:]]+$//')" = "$el9" ] \
   && nginx -t && b=$(mktemp /root/nginx.conf.before-pq.XXXXXX) && cp -p "$f" "$b" && cmp -s "$f" "$b"; then
  echo "backup made. To undo right after the edit, run: cp -p $b $f && nginx -t && ngxreload"
else
  echo "Stop: the policy is not an unmodified DEFAULT, FIPS is on, local.d has OpenSSL overrides, the group list is not the EL9 default, nginx -t failed, or the backup failed"
fi

Note the undo command it prints. It copies the whole saved file back, so use it only before you make any other change to nginx.conf; later, delete the added line instead. Then add this line to the http {} block of nginx.conf, next to the include /usr/local/nginx/conf/ssl_include.conf; line (not inside a server {} block, and not in ssl_include.conf, which HTTPS vhosts also include). It has no # centminmod-pq-groups marker, so Centmin Mod leaves it alone:

ssl_ecdh_curve X25519MLKEM768:?SecP256r1MLKEM768:?SecP384r1MLKEM1024/?X25519:?secp256r1:?X448:?secp521r1:?secp384r1:?ffdhe2048:?ffdhe3072:?ffdhe4096:?ffdhe6144:?ffdhe8192;

Run nginx -t && ngxreload, then repeat the Step 1 test. That test is the real check: nginx -t only checks the line once an HTTPS vhost exists, and a reload that nginx rejects keeps the old settings (look in the nginx error log). If nginx -t fails or Step 1 does not show X25519MLKEM768, run the undo command the block printed.

Remove the option C line before changing the TLS library

The line applies to every HTTPS site on the server, including sites not behind Cloudflare. Remove the whole line before you switch nginx to AWS-LC, BoringSSL, LibreSSL or quicTLS, restore an older nginx binary with tools/nginx-binary-backup.sh, change the system policy, or turn on FIPS mode. AWS-LC rejects the line (the others are untested), so on a server with HTTPS vhosts menu option 4’s nginx -t fails and rolls the upgrade back, and with FIPS on nginx may not start.

EL8

EL8’s system OpenSSL 1.1.1 cannot do post-quantum key exchange. Build nginx with AWS-LC (141.00beta01 builds AWS-LC 5.15.0). Add to /etc/centminmod/custom_config.inc:

AWS_LC_SWITCH='y'

Or, with PERSISTENT_CONFIG_MENU='y' set, use centmin menu option 7, option 5: it writes the same setting but does not rebuild. Then run centmin again and rebuild nginx with menu option 4. Check with the Step 1 nginx -V command:

built with OpenSSL 1.1.1 (compatible; AWS-LC 5.x) (running with AWS-LC 5.x)

AWS-LC supports X25519MLKEM768 by default; no ssl_ecdh_curve line is needed. It also works on EL9 and EL10 if you prefer it to the system OpenSSL. The standard AWS-LC build is not a FIPS-validated module: on servers that need FIPS, keep the system OpenSSL.

Step 3 on 132.00stable and 140.00beta01

These branches have no NGINX_PQ_GROUPS setting and no pq report, and they do not support EL10. The steps below change only nginx.conf, the OS crypto policy or the TLS library switch, not Centmin Mod’s code. Centmin Mod ran its tests on 141.00beta01, so confirm the result with the Step 1 handshake test.

EL9.7 and Newer

The system OpenSSL 3.5 can do post-quantum key exchange once the groups are enabled. If you just updated from an older EL9, restart nginx with nginx -t && ngxrestart. Then use one of these 141.00beta01 EL9 options, which work the same way here:

  • Option C: by hand: adds the same ssl_ecdh_curve line to nginx.conf yourself, after the safety checks in that block.
  • Option B: system-wide (not yet tested by Centmin Mod): switches the crypto policy to DEFAULT:PQ.

Option A (NGINX_PQ_GROUPS) needs 141.00beta01. With option C nothing removes the line for you: remove it yourself before you switch nginx to another TLS library (for example AWS-LC on 140.00beta01), restore an older nginx binary with tools/nginx-binary-backup.sh, change the system policy, or turn on FIPS mode. Otherwise nginx -t fails, or nginx may not start with FIPS on.

EL9 Before 9.7

The system OpenSSL 3.0 or 3.2 has no post-quantum key exchange. Update the OS to 9.7 or newer with dnf update, restart nginx with nginx -t && ngxrestart, and follow EL9.7 and newer. On 140.00beta01 you can use AWS-LC instead, as for EL8 below.

EL8

140.00beta01: AWS-LC 5.12.0

Build nginx with AWS-LC, as on 141.00beta01; 140.00beta01 builds AWS-LC 5.12.0. Add to /etc/centminmod/custom_config.inc:

AWS_LC_SWITCH='y'

Or, with PERSISTENT_CONFIG_MENU='y' set, use centmin menu option 7, option 5, which writes the same setting. Then rebuild nginx with centmin menu option 4 and check with the Step 1 nginx -V command that it shows AWS-LC. AWS-LC 5.12.0’s default key exchange list includes X25519MLKEM768, the same as 5.15.0, so no ssl_ecdh_curve line is needed. Centmin Mod has not tested this on 140.00beta01: run the Step 1 handshake test from an OpenSSL 3.5 client on another machine, because EL8’s own openssl cannot do it. AWS-LC also works on EL9 if you prefer it to the system OpenSSL. The standard AWS-LC build is not a FIPS-validated module.

132.00stable: No Post-Quantum Option on EL8

132.00stable turns AWS-LC off on every OS (its centmin.sh forces AWS_LC_SWITCH='n'), and EL8’s OpenSSL 1.1.1 has no post-quantum key exchange. There is no supported way to do it on this branch. Your options:

  • Switch to the 140.00beta01 beta branch with cmupdate update-beta (see Updating Centmin Mod), then follow the 140.00beta01 steps above.
  • Wait for the upcoming 142.00stable, which is cut from 141.00beta01.
  • Leave the origin leg on classical key exchange for now. The visitor to Cloudflare leg is post-quantum either way for browsers that support it.

BoringSSL (BORINGSSL_SWITCH='y') is not covered here: Centmin Mod has not tested it for this, and nginx built with BoringSSL has no OCSP stapling.

Step 4: Cloudflare Settings

In the Cloudflare dashboard for your domain, go to SSL/TLS → Overview → Origin connection & post-quantum encryption:

  1. Turn Automatic key exchange on. It is on by default, but check it. Cloudflare scans active origins about once a month (the first scan can start several weeks after the setting is turned on), learns that they support X25519MLKEM768, and then leads with it when it connects. The change rolls out to your traffic in stages and can be rolled back by Cloudflare, so there is no fixed deadline: check again after a few weeks.
  2. Leave Compliance requirements as they are. If you have none, leave both options unticked.

The Post-quantum hybrid compliance option

It makes Cloudflare offer only hybrid post-quantum key exchanges, such as X25519MLKEM768, on its TLS 1.3 connections to your origins and to every destination your Workers fetch() over TLS 1.3. Anything that supports none of them then fails with a 525 error. Only tick it when every origin and Worker destination in the zone supports X25519MLKEM768. If you already require FIPS, keep it, and check with Cloudflare’s documentation that the combination leaves an allowed key exchange.

One preference per zone. Cloudflare picks a single key exchange preference for the whole zone, weighted by traffic across all of the zone’s origins. If one zone (for example example.com) has subdomains on several servers and the busy ones cannot do post-quantum, the zone may stay on classical key exchange even for your post-quantum-ready server. Upgrade the other origins too, or put the post-quantum-ready sites in their own zone.

HTTP/3 does not matter here: Cloudflare connects to origins over TCP.

Step 5: Check What Cloudflare Uses

https://example.com/cdn-cgi/trace shows kex=X25519MLKEM768 when your browser reached Cloudflare with post-quantum key exchange. That is the visitor leg only. To see the Cloudflare to origin leg, look at the origin.

Option 1: A Temporary Check Page

Add this to the HTTPS server {} block of the vhost, for example /usr/local/nginx/conf/conf.d/example.com.ssl.conf:

  location = /pq-check-temp {
    default_type text/plain;
    add_header Cache-Control "no-store, private" always;
    return 200 "ssl_curve=$ssl_curve\nssl_protocol=$ssl_protocol\npeer=$realip_remote_addr\ncf_ray=$http_cf_ray\n";
  }

Run nginx -t && ngxreload, then request it through Cloudflare with a unique query string, and look at the headers too:

curl -sS -D - "https://example.com/pq-check-temp?t=$(date +%s)"

The result came from your origin when the headers show cf-cache-status as DYNAMIC, BYPASS, MISS or EXPIRED, or no cf-cache-status at all. HIT, STALE, UPDATING or REVALIDATED means Cloudflare served a stored copy, for example because a cache rule ignores the query string: exclude this path from caching, or use Option 3.

Illustrative output once Cloudflare uses post-quantum key exchange to your origin:

ssl_curve=X25519MLKEM768
ssl_protocol=TLSv1.3
peer=162.158.x.x
cf_ray=8f1a2b3c4d5e6f70-SYD

ssl_curve is the key exchange of the connection that served the request. Check that peer is a Cloudflare IP: that is the address that actually connected, even with the Cloudflare real IP include enabled (cf_ray is a request header anyone can send). $realip_remote_addr needs nginx’s realip module, which Centmin Mod builds by default (NGINX_REALIP='y'); if nginx -t reports an unknown variable, use $remote_addr. Cloudflare reuses its origin connections, so a change can take a while to show.

With nginx’s default header inheritance, the add_header line hides the vhost’s other add_header headers for this one URL only. Remove the location afterwards and run nginx -t && ngxreload.

Option 2: The JSON Access Log

Centmin Mod’s nginx.conf defines a main_json log format (see JSON access logging). Servers installed since October 2023 log ssl_curve (the group used), ssl_curves (the groups the client offered) and ssl_protocol in it. Menu option 4 does not add these fields to an existing nginx.conf, so check first. This should print a number above 0:

grep -c '^[^#]*"ssl_curve":' /usr/local/nginx/conf/nginx.conf

If it prints 0, use Option 1 or Option 3 instead. HTTPS vhosts created by Centmin Mod have a commented #access_log ... main_json line: uncomment it (or add one like it to an older vhost), run nginx -t && ngxreload, and request a page through Cloudflare. JSON log entries are buffered, so allow a few minutes. Count the groups used for requests that carried a Cloudflare CF-Ray header:

grep -h '"http_cf_ray": *"[^"]' /home/nginx/domains/example.com/log/access.json \
  | grep -o '"ssl_curve": *"[^"]*"' | sort | uniq -c

No output means the log has no entries from Cloudflare yet. A No such file error means the path is wrong: use the file named in the vhost’s access_log ... main_json line. The counts are per request: many requests can share one connection. They also include any direct request that sends its own CF-Ray header, and the log cannot tell them apart: main_json records $remote_addr, which the Cloudflare real IP include replaces with the visitor’s address. Use Option 1 or Option 3 to see who made the connection.

Older nginx versions log a post-quantum group as a number such as 0x11ec instead of X25519MLKEM768. On OpenSSL, ssl_curves on a new TLS 1.3 connection shows the groups the client offered. If Cloudflare’s entries list no MLKEM group (or 0x11ec), Cloudflare is not offering post-quantum to your origin yet (see Troubleshooting). An empty ssl_curves means unknown: with AWS-LC it is always empty.

Option 3: Cloudflare Logpush

Logpush (all plans, with usage-based pricing) has an OriginTLSKeyExchangeGroup field in the HTTP requests dataset: the key exchange of each origin connection. UNK means it could not be determined or no origin connection was made (for example a cache hit), and NONE means RSA key exchange or no TLS.

Troubleshooting

Cloudflare Still Connects with X25519

  • Check that Automatic key exchange is on (Step 4), then allow several weeks: Cloudflare scans origins about once a month and then rolls the change out in stages.
  • Check the zone’s other origins: one preference covers the whole zone.
  • Check the SSL/TLS mode is Full, Full (strict) or Strict, and that the origin offers TLS 1.3.
  • On OpenSSL, check ssl_curves in the JSON log (Step 5, Option 2). If Cloudflare’s offer has no MLKEM group (or 0x11ec), nothing on the origin can change the result.

A Post-Quantum Test Handshake Fails on EL9

First check Step 1: nginx may still run an older OpenSSL (restart it after an OS update), use a library without post-quantum support, or have an ssl_ecdh_curve or ssl_conf_command setting that replaces the group list (Step 2). With nginx on the system OpenSSL 3.5 and none of those, alert handshake failure on EL9 while the classical control works means the system crypto policy leaves the post-quantum groups out. Do Step 3 for EL9 on your branch: 141.00beta01 or 132.00stable / 140.00beta01.

nginx -t Fails with SSL_CTX_set1_curves_list(...) failed

An ssl_ecdh_curve line names a group the TLS library does not know: usually X25519Kyber768Draft00 (Step 2, in any vhost), or the Step 3 EL9 line while nginx uses AWS-LC or an OpenSSL older than 3.5. OpenSSL 3.3 and 3.4 also reject that line, because its first group, X25519MLKEM768, is required and they do not know it.

nginx -t Fails with "ssl_conf_command" directive is not supported on this platform

nginx is built with AWS-LC, which does not support ssl_conf_command. Remove those lines.

nginx -t Fails with "ssl_ecdh_curve" directive is duplicate

There are two ssl_ecdh_curve lines at the http {} level, for example one in nginx.conf and one in an included file. Keep one.

With AWS-LC, a Client Sending an X25519 Key Share First Stays on X25519

Check that the vhost has ssl_prefer_server_ciphers on;. AWS-LC only moves such clients onto post-quantum when the server’s order applies. Clients that offer only post-quantum groups get one either way.

FAQ

Does Post-Quantum Key Exchange Slow Nginx Down?

The client’s X25519MLKEM768 key share adds about 1.2 KB to the TLS ClientHello, and when a HelloRetryRequest is needed the handshake takes one more round trip. It only affects new connections, and Cloudflare reuses its origin connections.

Do I Need a Post-Quantum Certificate?

No. This page covers key exchange, which protects recorded traffic. Certificates (authentication) stay as they are.

Is the Visitor to Cloudflare Leg Already Post-Quantum?

Yes, for browsers that support it: Cloudflare uses post-quantum key exchange with visitors by default. https://example.com/cdn-cgi/trace shows kex=X25519MLKEM768 for your own browser. The steps on this page only change the Cloudflare to origin leg.

When Do 132.00stable and 140.00beta01 Get NGINX_PQ_GROUPS?

The NGINX_PQ_GROUPS setting and the pq report will be in the upcoming 142.00stable and 150.00beta01 releases, which are cut from 141.00beta01. Until then, use the by-hand steps for your branch.

Resources

Need help?

Ask in the community forums about post-quantum TLS, Cloudflare and Nginx configuration.