Rust 反向代理支持 HTTP/3 与后量子混合 TLS

原标题:Show HN: PQCrypta Proxy: Rust proxy with HTTP/3, QUIC, hybrid post-quantum TLS
58AI 研判分

PQCrypta Proxy 是一个用 Rust 编写的生产级反向代理,支持 HTTP/3、QUIC、WebTransport,并提供 X25519MLKEM768 混合后量子密钥交换、ML-DSA-87 证书与加密客户端问候(ECH)。它把后量子 TLS 与零停机热重载、ACME 自动化打包进单一代理,为关注“先收集后解密”风险的团队提供了可落地的迁移路径。

报道正文

本文目录2 个章节

PQCrypta Proxy

Production-ready HTTP/3/QUIC/WebTransport reverse proxy with hybrid Post-Quantum Cryptography (PQC) TLS support.

Highlights

  • Full-Featured Proxy: Domain-based routing, custom header injection, per-route timeouts, security headers, CORS, redirects
  • Three TLS Modes: Terminate, Re-encrypt, and Passthrough (SNI-based)
  • Modern Protocols: HTTP/1.1, HTTP/2, HTTP/3 (QUIC), WebTransport
  • Post-Quantum Ready: Hybrid PQC key exchange (X25519MLKEM768) via OpenSSL 3.5+ with native ML-KEM; RFC 8879 certificate compression to claw back the handshake bytes ML-KEM adds; ML-DSA-87 (FIPS 204) server certificates per SNI; PQC downgrade detection reading the negotiated group off the connection
  • Encrypted Client Hello: Server-side ECH (RFC 9849) on TCP and QUIC, with rotating HPKE keys published in the DNS HTTPS record: a post-quantum X-Wing config first, so the inner ClientHello is not exposed to harvest-now-decrypt-later, and an X25519 one for the clients that implement only that
  • Zero Downtime: Hot reload configuration and TLS certificates; environment-specific config overlay (--env)
  • ACME Automation: Automatic Let's Encrypt certificate provisioning, renewal timed by the CA's renewal information (ARI, RFC 9773), IP address identifiers (RFC 8738) so a client connecting by address can authenticate it, and Certificate Transparency log submission
  • OCSP Stapling: verified responses for every served certificate, stapled on every listener
  • Prometheus Metrics: Comprehensive metrics for TLS, connections, requests, backends, and WAF blocks
  • WAF: Pattern-based request inspection for injection and traversal attacks (SQLi, XSS, path traversal, NoSQLi, SSRF, CMDi, XXE, deserialization) in detect or block mode, and beside it the OWASP Core Rule Set itself, run in-process by a pure-Rust SecLang engine that passes every stage of CRS's own regression corpus ([waf.crs]); false positives tuned by path and host — covers OWASP A01/A03/A08/A10 attack patterns; categories requiring architectural or supply-chain controls (A02, A04, A05, A06, A09) are handled at other layers. Scanner/reconnaissance probe paths (.git, .env, .aws, wp-login.php, terraform state, SSH keys, CI/CD files, etc.) are blocked at path level before pattern scanning, preventing automated scanner traffic from reaching backends and polluting error-rate metrics
  • Advanced Security: JA3/JA4 fingerprinting on TCP and QUIC with replay and drift detection, circuit breaker, GeoIP blocking, DB-synced IP blocklists, WebTransport origin validation, 0-RTT replay protection, a proof-of-work challenge in place of a heuristic block
  • Structured Audit Logging: Async JSON audit log for admin actions, auth failures, WAF blocks, IP blocks, rate limit hits, PQC downgrades, config reloads
  • Structured Access Logging: Per-request JSON or text logs with latency, bytes, upstream, and client IP
  • Enterprise Load Balancing: 11 algorithms, session affinity, health-aware routing, per-backend retry policies, per-backend circuit breaker overrides, canary / percentage traffic splitting with sticky assignment and auto-rollback, traffic shadowing / mirroring
  • Multi-Dimensional Rate Limiting: Composite keys, JA3/JA4-based, JWT-verified, adaptive ML anomaly detection; optional Redis backend distributes counters across all proxy instances
  • Zero-Trust Primitives: Per-route HMAC proof-of-possession (method, path+query, timestamp, a required nonce and the body's Content-Digest signed, the body held to it; each nonce accepted once), internal route mTLS auto-enforcement, zero-trust mode startup validation (includes admin HMAC requirement), admin proof-of-possession, trusted_internal_cidrs deprecation
  • OpenTelemetry Distributed Tracing: W3C TraceContext + B3 propagation on all transports, OTLP HTTP/JSON export, configurable sampling, access-log trace-ID correlation

All Features Implemented

FeatureStatusDescription
Load Balancing✅11 algorithms with session affinity and health-aware routing
Circuit Breaker✅Backend health monitoring with auto-recovery
Advanced Rate Limiting✅Multi-dimensional: IP, JA3/JA4, JWT, headers, composite keys on all paths (TCP + QUIC/HTTP3); optional Redis backend for distributed cross-instance coordination
Connection Rate Limiting✅Per-IP cap on new connections per second (connection_rate_limit, connections_per_second), separate from max_connections_per_ip which caps concurrency — a client that opens and closes as fast as it can never trips a concurrency limit. It counts from 10 s after start (the connections queued across a restart arrive together and say nothing about a client); the startup attestation probes it against the live engine once that grace has ended, in a line of its own
Per-Route Security Policy✅[routes.security] overrides applied before the global checks: WAF on/off and mode, rate limits, JA3 and JA4 allowlists, mTLS, HMAC request signing, plus skip_bot_blocking for routes that serve automated clients
DoS Protection✅Connection limits, request validation
GeoIP Blocking✅Country-based blocking (MaxMind DB)
JA3/JA4 Fingerprinting✅TLS client fingerprint detection and classification on every transport — HTTP/1.1, HTTP/2 and HTTP/3. Over QUIC the ClientHello arrives inside encrypted Initial CRYPTO frames, so the vendored rustls/noq forks surface it through HandshakeData and it is parsed by the same extractor the TCP paths use. The JA4 transport marker is q over QUIC and t over TCP
Priority Hints✅RFC 9218 on HTTP/3: each response is scheduled on its QUIC stream by the client's Priority header, the origin's priority response header (which wins), and PRIORITY_UPDATE frames the client sends later (which win over both); more urgent first, whole (non-incremental) responses one at a time in request order, incremental ones interleaved. HTTP/1.1 and HTTP/2 carry the priority header only
Request Coalescing✅Identical cache misses collapse onto one fetch inside the response cache ([http3] coalescing_*): the first GET fetches, the rest wait up to coalescing_max_wait_ms and are answered from what it stored, or fetch for themselves when it could not be kept. Keyed and answered by the cache's own rules (host, path, query; a request with a co

(注:更多技术实现细节与完整 API 文档请查阅原项目 README)