Preparing for a post-quantum world with NGINX Gateway Fabric

—

by

in , , , ,
The NGINX Gateway Fabric logo is in the top right of the graphic, followed by the blog title Preparing for a post-quantum world with NGINX Gateway Fabric. There is an illustration on the right side of the graphic with two people in front of a giant whiteboard-screen.

On 2 December 2026, the NSA advised operators of US National Security Systems to “immediately accelerate” their move to post-quantum cryptography. The same day, Amazon, Anthropic, Apple, Cloudflare, Google, Microsoft, OpenAI and Oracle published a joint statement backing that guidance and urging organisations to move to NIST’s post-quantum standards as soon as possible.

That week, the question we kept hearing from platform teams running NGINX Gateway Fabric was simple: what do we have to change?

For traffic coming into a Kubernetes cluster through NGINX Gateway Fabric, probably nothing to turn post-quantum key exchange on. But there is one setting that can quietly turn it off, and we got it wrong ourselves while writing this post.

What the warnings do and don’t say

In a separate joint statement, the Office of the National Cyber Director, the NSA and CISA said that frontier AI companies had disclosed discoveries affecting the security of some cryptography in use today. They also said their current assessment is that these advances don’t present an “immediate and widespread threat”.

So nobody has announced that TLS is broken. The concern that makes this urgent for web traffic is harvest now, decrypt later. Someone records your encrypted traffic today and decrypts it once they have a capable enough quantum computer. If your traffic carries health records, financial data or anything else that has to stay confidential for years, the clock has already started.

The standards are ready. NIST published FIPS 203 (ML-KEM), FIPS 204 (ML-DSA) and FIPS 205 (SLH-DSA) in August 2024.

Where post-quantum TLS comes from

NGINX doesn’t implement the cryptography itself. It uses OpenSSL. OpenSSL 3.5, released in April 2025, changed its default TLS settings to prefer a hybrid key exchange called X25519MLKEM768. A hybrid combines two mechanisms:

  • X25519, the elliptic-curve key agreement most TLS 1.3 connections already use;
  • ML-KEM-768, the post-quantum key encapsulation mechanism from FIPS 203.

The session key is derived from both, so an attacker has to break both to read the traffic. If ML-KEM turns out to have a flaw, you still have X25519’s protection. It only works with TLS 1.3.

NGINX Gateway Fabric’s data plane image is built on Alpine Linux, which ships OpenSSL 3.5. On the build we tested, a Gateway that didn’t set any key exchange groups negotiated X25519MLKEM768 with an OpenSSL 3.5 client:

$ kubectl exec -n <namespace> deploy/<gateway-name>-nginx -c nginx -- nginx -V 2>&1 | grep -i openssl
built with OpenSSL 3.5.9 29 Sep 2026

$ openssl s_client -connect <gateway-address>:443 -servername app.example.com \
    </dev/null 2>/dev/null | grep -E 'group|Temp Key'
Negotiated TLS1.3 group: X25519MLKEM768

Chrome 131 and later and Firefox 135 and later offer X25519MLKEM768, as do clients built on OpenSSL 3.5 or later or Go 1.24 or later, so most browser traffic gets it without anyone changing anything.

All of this is open source NGINX and open source NGINX Gateway Fabric. No commercial licence is needed.

Two other connections get the same treatment by default:

  • NGINX to your backends. When a Service is reached over TLS, for example with a BackendTLSPolicy, NGINX acts as the client using the same OpenSSL defaults. We put a TLS backend behind the NGF NGINX image, and the backend logged X25519MLKEM768 for NGINX’s connection. That only works if the backend’s own TLS stack supports the hybrid group.
  • The control plane to the Kubernetes API server. The NGINX Gateway Fabric controller is written in Go. NGINX Gateway Fabric 2.9.1 requires Go 1.27 or later to build, and Go has offered X25519MLKEM768 by default since 1.24. Kubernetes 1.33 and later versions are built with a Go version that supports it too.

Why the gateway is the right place to do this

When TLS terminates at the gateway, the gateway’s OpenSSL chooses the key exchange from whatever each client offers. The application teams behind it don’t need to rebuild their images with a newer OpenSSL, change their HTTPRoutes or replace their certificates. Key exchange is separate from the certificate, so existing RSA and ECDSA certificates keep working. Our test Gateway used an ordinary ECDSA certificate and needed no changes.

The things that decide the outcome are the data plane image and the Gateway configuration. The platform team already owns both, and both are tracked in Git with the rest of the cluster configuration.

This only covers what the gateway terminates. TLS passthrough listeners hand the encrypted connection straight to the backend, so the application’s own TLS stack handles the key exchange there.

The setting that can switch it off

NGINX Gateway Fabric 2.7 added the nginx.org/ssl-ecdh-curve listener option, which sets the list of key exchange groups NGINX offers. To show it in this post, we first put it on a listener for app.example.com and changed it to a classical-only value. Nothing changed. The client still negotiated X25519MLKEM768, and the Gateway status gave no hint that the setting had been ignored.

The cause is in how OpenSSL handles virtual hosts. OpenSSL copies the list of key exchange groups when the connection opens. That happens before NGINX reads the server name the client asked for (SNI), so the list comes from the default server for that port. Switching to the right virtual host later changes the certificate, but not the groups. The NGINX maintainers have documented this in nginx trac #2542.

In NGINX Gateway Fabric, the default server is the HTTPS listener without a hostname. If a Gateway only has listeners with a hostname, NGINX Gateway Fabric generates a default server that rejects handshakes and sets no groups, so OpenSSL’s defaults apply. Either way, the option is ignored on every listener that has a hostname. On a listener without one, it applies to every hostname on the port.

That second case is where post-quantum gets switched off. Many older TLS hardening guides recommend a list like prime256v1:secp384r1. Put that on a listener without a hostname, and every hostname on the port falls back to classical key exchange, including hostnames whose own listener asks for the hybrid group. There’s no warning, and the Gateway still reports Programmed.

There’s a subtler cost to setting it at all, even to a list that includes the hybrid group. OpenSSL’s built-in list groups algorithms into tiers. If a client supports X25519MLKEM768 but its first guess was X25519, the server asks it to retry with the hybrid group. A plain colon-separated list, which is all the Gateway option accepts, loses that behaviour, so the server takes the classical group it was offered. In our tests, a client set up that way got X25519MLKEM768 with no option set, and plain X25519 once we set X25519MLKEM768:X25519:prime256v1:secp384r1. Current browsers lead with a hybrid key share, so they aren’t affected. Clients that don’t are downgraded without any error.

Our advice is to leave the option unset unless a policy requires it. The companion post shows how to find this setting across a cluster, and how to set a list that keeps OpenSSL’s tiers if you need one.

What’s still left

Hybrid key exchange protects the confidentiality of the connections described above. Three things are outside it:

  • Backends that can’t do it. NGINX offers the hybrid group to backends by default, but if a backend’s TLS stack doesn’t support it, that connection stays classical. NGINX Gateway Fabric has no setting to require post-quantum key exchange towards backends, so check what your backends support.
  • Certificates. RSA and ECDSA certificates are still classical, so authentication isn’t quantum-resistant yet. Post-quantum signatures (ML-DSA) are the next stage, and publicly trusted post-quantum certificates aren’t available yet.
  • Anything in front of the gateway. If a CDN or a cloud load balancer terminates TLS first, clients negotiate with that, not with NGINX.

Why this was cheap, and why the next part won’t be

Moving key exchange to post-quantum took almost no work with NGINX Gateway Fabric because the decision lives in one shared library, at one layer, run by one team. Upgrading OpenSSL in the data plane image changed it for every application behind the gateway.

Post-quantum certificates will be harder, because they touch certificate authorities, clients and every service that validates a chain. Keeping TLS termination at the gateway won’t remove that work. But it means the gateway side of the change is an image upgrade and a reviewed change to a Gateway resource, rather than a change to every application.

To check your own Gateways, including the commands we ran, how to audit ssl-ecdh-curve across a cluster, and how to measure what real clients negotiate, see the companion post, Post-quantum TLS with NGINX Gateway Fabric: checking it’s on and keeping it on.

Further reading