Skip to content

feat(edge): post-quantum key exchange on the nginx edge and cloudflared - #219

Open
Yoshiofthewire wants to merge 2 commits into
masterfrom
feat/pqc-edge-groups
Open

Yoshiofthewire wants to merge 2 commits into
masterfrom
feat/pqc-edge-groups

Conversation

@Yoshiofthewire

Copy link
Copy Markdown
Member

In one line: The nginx edge and cloudflared now use hybrid post-quantum key exchange (X25519MLKEM768), and cloudflared can no longer fall back to a classical http2 tunnel.

What changed

  • The nginx edge offers X25519MLKEM768:X25519:prime256v1 (ssl_ecdh_curve). Hybrid clients get X25519MLKEM768, X25519 and P-256 clients still connect, and clients offering only other groups (P-384, say) are refused.
  • TestNginxContainer reads the pinned image's OpenSSL from nginx -V and fails below 3.5. The pinned image runs 3.5.9. It then asserts the group each handshake negotiates.
  • cloudflared's generated config (both Cloudflare edges) sets post-quantum: true and protocol: quic. The pinned cloudflared 2026.10.0 does not refuse --post-quantum with http2 on its own: it logged Initial protocol http2. So pinning QUIC is what closes the fallback.
  • On upgrade the nginx edge reloads in place: the hash moves on the DaemonSet's metadata, not its pod template, so the TestRenderGolden nginx hash moved on purpose. cloudflared is recreated.
  • Docs (docs/edge.md, internal/edge/AGENTS.md) and a CHANGELOG entry with the upgrade impact.

Review this

  • internal/edge/connector.go: QUIC only. A network that blocks outbound UDP 7844 now keeps the tunnel down instead of carrying it over classical http2. That is the intended trade, but it is a behaviour change for operators.
  • internal/edge/nginxconf.go: the one TLS setting that now differs from NPM's. If an image ever ships OpenSSL below 3.5, nginx rejects the file and the pods stay unready. The test catches that before release.
  • Safe to skip: the golden hash line in internal/kube/golden_test.go.

Checked (Major and K80, at this head):

  • TestNginxContainer, TestCloudflaredIngressContainer, TestCloudflaredDirectContainer and TestCloudflaredPostQuantum: all PASS on Major (Docker, under kslot).
  • go vet ./..., go vet -tags e2e,goolm ./... and go test -race -count=1 -p 2 ./...: PASS (kjob on k80, exit 0).
  • make notes-check, go mod tidy -diff and gofmt: PASS.
  • Mutations, each failing where it should:
    • ssl_ecdh_curve removed: P-384 is negotiated, so the test FAILs.
    • Old nginx-unprivileged:1.25.4-alpine image: FAILs with "image runs OpenSSL 3.1".
    • post-quantum/protocol removed: both the unit test and the e2e test FAIL.

Not checked

  • Group order is unproven. Reordering to X25519:X25519MLKEM768:… still negotiates X25519MLKEM768 with Go's client. OpenSSL 3.5 treats a colon list as one preference tuple and follows the client's key shares, so no test can see the order.
  • A live Cloudflare connection (the fixtures are offline).
  • NPM's own TLS: NPM keeps its image's defaults.
  • The rest of make e2e (the kind suites): CI runs it.

Decided for you: I put QUIC-only in the generated config rather than as a flag, and I did not add an http2 opt-out. Nginx keeps classical X25519 and P-256 for older clients, as spec B specifies. PG18 ssl_groups is not in this PR: #217 is still open, and the change goes to the root thread to route.

You need to: nothing. Do not merge until CI, the security reviewer and the PR Reviewer Guide are clean.

Detail

Spec B (ky-primitives docs/pqc-stack-plan), wave W0, rows 3 and 4.

Probe with the pinned cloudflared 2026.10.0, offline, using post-quantum: true in the config and --protocol http2 on the command line:

INF Settings: map[... post-quantum:true pq:true protocol:http2]
INF Initial protocol http2

So the binary accepts the pair. The new e2e step starts the tunnel offline with the generated file and requires post-quantum:true, protocol:quic and Initial protocol quic in its log.

Pinned nginx image, nginx -V:

built with OpenSSL 3.5.8 25 Aug 2026 (running with OpenSSL 3.5.9 29 Sep 2026)

Handshake cases in TestNginxContainer (Go client):

Client offers Result
Go default X25519MLKEM768
X25519MLKEM768 only X25519MLKEM768
X25519 only X25519
P-384 only refused

🤖 Generated with Claude Code

Yoshiofthewire and others added 2 commits November 25, 2026 22:08
The nginx edge sets ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1, and
TestNginxContainer checks the pinned image runs OpenSSL 3.5 or later, that a
hybrid client negotiates X25519MLKEM768, X25519 still connects and P-384 is
refused.

cloudflared's generated configuration sets post-quantum: true and
protocol: quic, so the tunnel never falls back to http2, which has no PQ
mode. The pinned cloudflared 2026.10.0 does not refuse that pair itself.

Spec B (ky-primitives pqc-stack-plan) W0, rows 3 and 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪

🧪 PR contains tests

⚡ No major issues detected


Advisory only: this comment never gates the pull request.
gpt-6.1-sol using pr-agent on behalf of Yoshi

@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Security review - cleared

Detail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kyquickstart-219, where it is readable by the operator and expires seven days after the last post.


gpt-6.1-sol using security-audit on behalf of Yoshi

@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Autonomous review - 1/1 personas cleared

  • security: cleared

Merging remains a human decision; this bot never approves.


gpt-6.1-sol using security-audit on behalf of Yoshi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant