后量子迁移配置指南
适用于 Cloudflare、nginx、Caddy、Apache、HAProxy、AWS 与 OpenSSH 的验证配置(遵循 NIST FIPS 203/204 与 BSI 指南)。
Cloudflare 边缘与源站
预计耗时: 5 分钟在所有开启代理的端点立即启用 X25519MLKEM768 混合 TLS。
Cloudflare 已在代理记录边缘默认终止 X25519MLKEM768。回源链路请区分认证(Full Strict / Authenticated Origin Pulls)与密钥交换:检查 Automatic Key Exchange 与源站 ML-KEM 支持(或使用后量子 Cloudflare Tunnel)。
# 1. Cloudflare Dashboard -> SSL/TLS -> Edge Certificates:
# - Minimum TLS Version: TLS 1.2 (or TLS 1.3)
# - Always Use HTTPS: ON
# - Enable HSTS (max-age >= 31536000)
#
# 2. Cloudflare -> Origin (separate authentication from key exchange):
# - Encryption mode: Full (Strict) (+ optional Authenticated Origin Pulls for mTLS auth)
# - SSL/TLS -> Overview -> Origin connection & post-quantum encryption:
# verify Automatic Key Exchange is ON and enable ML-KEM on your origin
# (OpenSSL 3.5+ / Go 1.24+), or connect via a post-quantum Cloudflare Tunnel.
# - Docs: https://developers.cloudflare.com/ssl/origin-configuration/automatic-key-exchange/
openssl s_client -connect yourdomain.com:443 -servername yourdomain.com -groups X25519MLKEM768 </dev/null 2>/dev/null | grep -E "Protocol|Cipher|Negotiated TLS1.3 group|Peer temp key|Server Temp Key"
curl -s https://isitpqc.com/api/v1/scan?domain=yourdomain.com | jq '{grade, key_exchange: .tls.key_exchange}'
nginx (OpenSSL 3.5+)
预计耗时: 15–30 分钟在反向代理上直接启用 NIST FIPS 203 X25519MLKEM768。
将主机 OpenSSL 升级至 3.5+(原生支持 ML-KEM),并在 ssl_ecdh_curve 中将 X25519MLKEM768 置于传统曲线之前。
# Requires nginx built with OpenSSL 3.5+ (or BoringSSL / AWS-LC)
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ecdh_curve X25519MLKEM768:SecP256r1MLKEM768:SecP384r1MLKEM1024:X25519:prime256v1:secp384r1;
ssl_prefer_server_ciphers off;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# nginx -t && systemctl reload nginx
openssl s_client -connect yourdomain.com:443 -servername yourdomain.com -groups X25519MLKEM768 </dev/null 2>/dev/null | grep -E "Protocol|Cipher|Negotiated TLS1.3 group|Server Temp Key|Peer temp key"
Caddy (Go 1.24+)
预计耗时: 10 分钟基于 Go 1.24+ 编译的 Caddy 默认启用原生 X25519MLKEM768。
Caddy 使用 Go 标准库 crypto/tls。升级至使用 Go 1.24+ 构建的 Caddy 版本即可自动开启 X25519MLKEM768。
# Verify Go runtime version inside Caddy:
# caddy build-info | grep go
yourdomain.com {
tls {
protocols tls1.2 tls1.3
}
header Strict-Transport-Security "max-age=31536000; includeSubDomains"
reverse_proxy 127.0.0.1:8080
}
caddy version && openssl s_client -connect yourdomain.com:443 -servername yourdomain.com -groups X25519MLKEM768 </dev/null 2>/dev/null | grep -E "Protocol|Cipher|Negotiated TLS1.3 group|Temp Key"
Apache httpd (OpenSSL 3.5+)
预计耗时: 20–30 分钟通过 mod_ssl + OpenSSL 3.5+ 启用混合 ML-KEM 密钥交换。
确保 mod_ssl 链接至 OpenSSL 3.5+,并在 SSLOpenSSLConfCmd Groups 中优先配置 X25519MLKEM768。
# Requires Apache httpd with mod_ssl linked against OpenSSL 3.5+
SSLProtocol -all +TLSv1.2 +TLSv1.3
SSLOpenSSLConfCmd Groups X25519MLKEM768:SecP256r1MLKEM768:X25519:prime256v1
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
# apachectl configtest && systemctl reload apache2
openssl s_client -connect yourdomain.com:443 -servername yourdomain.com -groups X25519MLKEM768 </dev/null 2>/dev/null | grep -E "Protocol|Cipher|Negotiated TLS1.3 group|Temp Key"
HAProxy 3.2+ (OpenSSL 3.5+)
预计耗时: 15 分钟在负载均衡器上实现高吞吐混合 ML-KEM 终止。
使用链接 OpenSSL 3.5+(或 AWS-LC)的 HAProxy 3.2+,并在 ssl-default-bind-curves 首位配置 X25519MLKEM768。
global
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
ssl-default-bind-curves X25519MLKEM768:SecP256r1MLKEM768:X25519:P-256
frontend https_in
bind :443 ssl crt /etc/haproxy/certs/ alpn h2,http/1.1
http-response set-header Strict-Transport-Security "max-age=31536000; includeSubDomains"
haproxy -vv | grep -iE 'OpenSSL|AWS-LC|curves'
AWS CloudFront 与 ALB
预计耗时: 10 分钟在负载均衡器与 CDN 启用基于 AWS-LC 的混合 ML-KEM 策略。
在 AWS ALB 监听器上选择支持后量子密钥交换的 TLS 1.3 安全策略,并在 CloudFront 开启现代 TLS。
# AWS ALB: switch HTTPS listener to a Post-Quantum TLS 1.3 security policy
aws elbv2 modify-listener \
--listener-arn arn:aws:elasticloadbalancing:REGION:ACCOUNT:listener/app/... \
--ssl-policy ELBSecurityPolicy-TLS13-1-2-PQ-2025-09
# CloudFront: set MinimumProtocolVersion to TLSv1.2_2021 or TLSv1.3_2025
curl -s https://isitpqc.com/api/v1/scan?domain=yourdomain.com | jq '{grade, key_exchange: .tls.key_exchange}'
OpenSSH (macOS 与 Linux)
预计耗时: 2 分钟修正 macOS 默认优先级,使 SSH 协商 mlkem768x25519-sha256。
macOS 的 /etc/ssh/crypto.conf 将传统 ECDH 排在后量子 KEX 之前。请在 ~/.ssh/config 顶部及服务端 sshd_config 中显式指定 KexAlgorithms。
# Add to the VERY TOP of ~/.ssh/config (OpenSSH 9.9+ / 10+):
# '^' prepends PQ hybrid KEX ahead of macOS defaults while keeping fallbacks.
Host *
KexAlgorithms ^mlkem768x25519-sha256,[email protected]
# On Linux servers (/etc/ssh/sshd_config.d/99-pqc.conf):
# KexAlgorithms mlkem768x25519-sha256,[email protected],curve25519-sha256
# Verify negotiated KEX:
ssh -v yourserver true 2>&1 | grep "kex: algorithm"
ssh -G example.com | grep '^kexalgorithms '
反向代理 / 边缘卸载
预计耗时: 15 分钟无需改动业务代码即可立即保护旧版源站。
若源站暂无法升级至 OpenSSL 3.5+ 或 Go 1.24+,可在前端部署现代反向代理(Cloudflare、Caddy、nginx、HAProxy)终止 TLS 1.3 + X25519MLKEM768。
# Verify whether yourdomain.com negotiates X25519MLKEM768 with OpenSSL 3.5+ / 4.0+:
openssl s_client -connect yourdomain.com:443 -servername yourdomain.com -groups X25519MLKEM768 </dev/null 2>/dev/null | grep -E "Protocol|Cipher|Negotiated TLS1.3 group|Peer temp key|Server Temp Key"
# Query structured JSON diagnostics via IsItPQC API:
curl -s https://isitpqc.com/api/v1/scan?domain=yourdomain.com | jq '{domain, grade, score, tls, pq_support}'
curl -s https://isitpqc.com/api/v1/scan?domain=yourdomain.com | jq '{grade, kex: .tls.key_exchange, hsts: .infrastructure.hsts}'
代码库密码学资产清查 (CBOM)
迁移前先全面梳理代码仓、Terraform、Docker 与 VPN 中的 RSA、ECDSA/ECDH、DH、SHA-1、MD5 和 AES-128。
# Run in your repository root to list classical crypto usage:
rg -n --hidden --glob '!.git' \
'\b(RSA|RS256|ES256|PS256|ECDSA|ECDH|ECDHE|FFDHE|DHE|secp256r1|prime256v1|ed25519|curve25519|SHA-1|SHA1|MD5|AES-128|TLSv1\.[01]|ssl_ecdh_curve|KexAlgorithms)\b' .
常见问题(后量子 TLS 与 PQC)
IsItPQC 实际检测哪些项目?
IsItPQC 向目标域名 443 端口发起真实 TLS 1.3 握手,探测 NIST FIPS 203 后量子密钥交换组(X25519MLKEM768、SecP256r1MLKEM768、SecP384r1MLKEM1024、MLKEM1024),同时检查证书算法、旧版 TLS 1.0/1.1、HSTS 与 CDN 栈。
为什么 2026 年底必须尽快迁移到 ML-KEM?
2026 年 12 月 NSA/CISA 的 AI 密码学风险警报及八大科技巨头联合声明指出,应立即启用混合 ML-KEM,以防止今日被记录的加密流量未来被破解。
什么是混合密钥交换 X25519MLKEM768?
它将传统 X25519 与后量子 ML-KEM-768 结合,攻击者必须同时攻破两种算法才能恢复会话密钥。
获得 A+ 是否意味着整个公司 100% 抗量子?
不是。A+ 代表公开 HTTPS 边缘已做好混合 PQC 防护。内部 SSH、VPN、数据库与代码库仍需建立 CBOM 并分阶段迁移。
如何在 nginx、Caddy、HAProxy 或 Cloudflare 上启用后量子 TLS?
使用 Cloudflare 代理或基于 Go 1.24+ 构建的 Caddy 默认已支持 X25519MLKEM768。对于 nginx、Apache 或 HAProxy 3.2+,请升级至 OpenSSL 3.5+ 并将 X25519MLKEM768 置于 TLS 密钥组首位。可在修复指南页面直接复制对应配置。
IsItPQC 提供公开 JSON API 或实时状态徽章吗?
提供。访问 GET https://isitpqc.com/api/v1/scan?domain=example.cn 获取结构化 JSON,访问 GET https://isitpqc.com/api/v1/leaderboard 获取实时基准数据,或将 https://isitpqc.com/badge/example.cn.svg 嵌入 README 文档。