Canonical: https://ai-release.org/guides/poshagovoe-rukovodstvo-kak-vklyuchit-postkvantovyy-obme.html · Markdown · JSON · Updated: 2026-12-06
ssl_conf_command directive, a TLS certificate for <your-domain>, and a way to reach port 443 from a test machineX25519MLKEM768 on TLS 1.3, configured in /etc/nginx/conf.d/pq.conf.X25519MLKEM768 in the negotiated key exchange, so you can prove the setting is live.openssl list -kem-algorithms lists ML-KEM), so you know whether the failure — if any — is in the library or in nginx.openssl version -a
openssl list -kem-algorithms | grep -i ml-kem
sudo nginx -V 2>&1 | tr ' ' '\n' | grep -i openssl
openssl s_client -connect <your-domain>:443 -tls1_3 -groups X25519MLKEM768 </dev/null 2>/dev/null | grep -E "Protocol|Group|Server Temp Key"Details and checks are in the steps below.

apt paths (/etc/nginx/conf.d/). On RHEL-family systems the equivalent include directory is usually /etc/nginx/conf.d/ as well — verify with nginx -V.ssl_conf_command directive (it passes arbitrary OpenSSL configuration commands into the SSL context). If nginx -V does not show your OpenSSL 3.5 build, you must rebuild nginx against it — see Step 2.<your-domain>. Replace <your-domain> with the DNS name in your certificate, e.g. nginx.example.com.build-essential, libpcre2-dev, zlib1g-dev).If nginx runs on a self-hosted or home box and you also plan to put other services behind it, the layout described in How to add AI to your home server: self-hosted services guide keeps ports and reverse-proxy rules in one place.
Example: on Ubuntu, sudo apt install build-essential libpcre2-dev zlib1g-dev gives you the toolchain needed for an nginx source build.
What to do: check the library version, list the KEM algorithms, and run a local loopback handshake that forces the hybrid group.
Why: a huge share of "it doesn't work" cases are simply an old library. If the library has no ML-KEM, no nginx directive will produce it. Testing on 127.0.0.1 first isolates the library from nginx configuration.
openssl version -a
openssl list -kem-algorithms | grep -i ml-kemExpected: the version line reports OpenSSL 3.5.x, and the second command prints ML-KEM entries (for example ML-KEM-768). If the second command prints nothing, the provider is missing — see Troubleshooting.
Now create a throwaway certificate and run a local TLS 1.3 server limited to the hybrid group:
openssl req -x509 -newkey rsa:2048 -nodes -days 1 \
-keyout /tmp/server.key -out /tmp/server.crt -subj "/CN=localhost"
openssl s_server -accept 4433 -cert /tmp/server.crt -key /tmp/server.key \
-tls1_3 -groups X25519MLKEM768In a second terminal:
openssl s_client -connect 127.0.0.1:4433 -tls1_3 -groups X25519MLKEM768 </dev/null 2>/dev/null \
| grep -E "Protocol|Group|Server Temp Key"How to check: the client output contains a line with X25519MLKEM768 (typically a Server Temp Key: or Group: line) and Protocol: TLSv1.3. Press Ctrl+C in the s_server terminal when done. This works because both sides are the same 3.5 library, so the group is guaranteed to be offered.

What to do: verify which OpenSSL nginx is actually linked against, rebuild nginx if needed, then add one config file.
Why: nginx does not use the openssl binary; it links the library at build time. A system nginx can be linked to 3.0 while /usr/local/bin/openssl reports 3.5 — the openssl s_client test passes, the browser handshake does not.
Check the linkage:
nginx -V 2>&1 | tr ' ' '\n' | grep -i openssl
ldd "$(command -v nginx)" | grep -i sslIf both show 3.5, skip the rebuild. Otherwise build nginx against the 3.5 tree:
cd /usr/local/src
tar xf nginx-<nginx-version>.tar.gz && cd nginx-<nginx-version>
./configure --with-http_ssl_module \
--with-openssl=/usr/local/src/openssl-3.5.x \
--with-openssl-opt=shared
make -j"$(nproc)" && sudo make install<nginx-version> is the release you downloaded; --with-openssl= points at the OpenSSL 3.5 source directory. Check your nginx release notes for the exact configure flags you need — the directive set depends on the build.
Now the server block. Create /etc/nginx/conf.d/pq.conf:
server {
listen 443 ssl;
server_name <your-domain>;
ssl_certificate /etc/nginx/ssl/<your-domain>.crt;
ssl_certificate_key /etc/nginx/ssl/<your-domain>.key;
ssl_protocols TLSv1.3 TLSv1.2;
ssl_prefer_server_ciphers off;
# Offer the hybrid post-quantum group first, classical groups as fallback
ssl_conf_command Groups X25519MLKEM768:X25519:P-256;
location / {
return 200 "pq-ok\n";
add_header Content-Type text/plain;
}
}The Groups list is an OpenSSL setting, not an nginx one — ssl_conf_command is the pipe that hands it to the SSL context. Keeping X25519 and P-256 in the list means clients without ML-KEM still connect, just classically.
Load it:
sudo nginx -t && sudo systemctl reload nginxHow to check: sudo nginx -t prints syntax is ok and test is successful. Then curl -s https://<your-domain>/ returns pq-ok. If you see unknown directive "ssl_conf_command", your nginx is too old — see Troubleshooting.

What to do: handshake against the live server with the hybrid group forced, and inspect what was negotiated.
Why: a reload proves the config parsed; only the handshake proves the group was offered and accepted.
openssl s_client -connect <your-domain>:443 -servername <your-domain> -tls1_3 \
-groups X25519MLKEM768 </dev/null 2>/dev/null \
| grep -E "Protocol|Group|Server Temp Key|Cipher"How to check: success looks like Protocol: TLSv1.3 plus a line naming X25519MLKEM768 (for example Server Temp Key: X25519MLKEM768). If the output shows only X25519 or P-256, the server did not offer the hybrid group — the library linked into nginx is not 3.5, or the directive was not applied to that server block.
Run this checklist before you call it done:
openssl version -a reports 3.5.xopenssl list -kem-algorithms lists ML-KEMnginx -V and ldd both show the 3.5 librarynginx -t passes after adding ssl_conf_command Groups ...s_client shows Protocol: TLSv1.3 and X25519MLKEM768openssl s_client -connect <your-domain>:443 -groups X25519)| What to verify | Command | Expected |
|---|---|---|
| Library has ML-KEM | openssl list -kem-algorithms | ML-KEM entries |
| nginx linkage | nginx -V | built with OpenSSL 3.5.x |
| Server offers hybrid | openssl s_client ... -groups X25519MLKEM768 | X25519MLKEM768 in output |
| Fallback works | openssl s_client ... -groups X25519 | handshake succeeds |
Problem. nginx refuses to start with an unknown directive
nginx: [emerg] unknown directive "ssl_conf_command" in /etc/nginx/conf.d/pq.conf:11ssl_conf_command, so the parser stops at that line.nginx -v to see the release, upgrade nginx from your distribution or build the newer source tree as shown in Step 2, then re-run sudo nginx -t. As a temporary measure, comment the line out — nginx will then negotiate whatever groups its linked OpenSSL offers by default.Problem. Config loads, but the handshake still shows a classical group
Server Temp Key: X25519, 253 bits where you expected X25519MLKEM768libssl (the nginx -V line may even say built with OpenSSL 3.5.x while ldd points to a 3.0 libssl.so), or the ssl_conf_command line sits in a different server block than the one serving <your-domain>.ldd "$(command -v nginx)" | grep -i ssl, confirm the library path is the 3.5 one, then sudo systemctl restart nginx (a reload keeps old libraries mapped) and re-run the Step 3 command. Also confirm grep -rn ssl_conf_command /etc/nginx/ hits the block that matches your server_name.Problem. Browser or old client fails while s_client succeeds
sslv3 alert handshake failure on the client sideopenssl s_client -connect <your-domain>:443 -tls1_2 — if that succeeds, the fallback path is fine and only the TLS 1.3-capable clients get ML-KEM. If you need to serve TLS 1.2 clients, keep TLSv1.2 in ssl_protocols and keep classical groups in the Groups list, as in the Step 2 config.While you are in the host's patch routine, note that the same discipline — verifying what is actually running rather than what is installed — applies to OS updates; the mechanics for Windows hosts are covered in How to Enable Hotpatch Updates on Windows Server: Step-by-Step Guide.
You now have nginx serving TLS 1.3 with X25519MLKEM768 offered first and classical groups as fallback, verified end to end with openssl s_client. Next, re-run the Step 3 command after every nginx upgrade, because a distro update can silently relink nginx against an older OpenSSL and drop the hybrid group.
What is X25519MLKEM768?
It is a hybrid key-exchange group: a classical X25519 exchange combined with ML-KEM-768, a post-quantum KEM. The handshake stays secure if either half is broken, which is why it is deployed as a hybrid rather than ML-KEM alone.
Does enabling it break old clients?
No, provided you keep classical groups in the Groups list and TLSv1.2 in ssl_protocols. Legacy clients simply negotiate X25519 or P-256; only TLS 1.3 clients that also support ML-KEM get the hybrid group.
Why does openssl s_client show ML-KEM but my browser does not?
The browser must support the same group and must use TLS 1.3. If s_client succeeds and the browser does not, the limitation is on the client side — check the browser's TLS key-exchange support in its release notes.
Do I need to change my certificate?
No. ML-KEM here affects key exchange only; your existing RSA or ECDSA certificate and key are used unchanged. Post-quantum signatures are a separate topic — check the OpenSSL 3.5 documentation for what your build supports.
Status: practical guide. Some statements come from vendors; verify in your environment.
Time to complete: 30–45 minutes (plus nginx rebuild time if your package links an older OpenSSL) Difficulty: Intermediate
Machine data: Citation Map JSON · JSON-LD · Semantic Embeddings — separate stage.
| Entity | Type | Role |
|---|---|---|
| как включить ML-KEM в OpenSSL | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| постквантовый TLS настройка nginx | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| X25519MLKEM768 проверка handshake | продукт/модель | упоминается в заголовке, TL;DR или разделах гайда |
| openssl 3.5 quantum safe | продукт/модель | упоминается в заголовке, TL;DR или разделах гайда |
| Linux | платформа/технология | упоминается в заголовке, TL;DR или разделах гайда |
No independent confirmation is provided; source claims and editorial conclusions are separated below.
| Source | Type | Role |
|---|---|---|
| No external links | — | — |
Cite as: AI Release. Пошаговое руководство: как включить постквантовый обмен ключами ML-KEM (X25519MLKEM768) в OpenSSL 3.5 и nginx. ai-release.org.