Show HN: PQCrypta Proxy: Rust proxy with HTTP/3, QUIC, hybrid post-quantum TLS
Summary
PQCrypta Proxy is a production-ready Rust reverse proxy supporting HTTP/3, QUIC, WebTransport and hybrid post-quantum TLS (X25519MLKEM768, ML-DSA-87, ECH with X-Wing), plus ACME automation, WAF with OWASP CRS, and Prometheus metrics.
View Cached Full Text
Cached at: 11/25/26, 12:44 AM
PQCrypta/pqcrypta-proxy
Source: https://github.com/PQCrypta/pqcrypta-proxy
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-Digestsigned, 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_cidrsdeprecation - OpenTelemetry Distributed Tracing: W3C TraceContext + B3 propagation on all transports, OTLP HTTP/JSON export, configurable sampling, access-log trace-ID correlation
All Features Implemented
| Feature | Status | Description |
|---|---|---|
| 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 cookie only from an entry the origin stated to be cacheable) |
| Early Hints (103) | ✅ | A page load’s preload/preconnect Link headers as a 103 ahead of the backend’s answer, on HTTP/3 and HTTP/2 (HTTP/2 through the vendored hyper’s InformationalSender, vendor/hyper); on HTTP/1.1, which browsers do not read a 103 on, the same Link headers on the final response |
| Compression | ✅ | Brotli/gzip/deflate/zstd |
| Security Headers | ✅ | HSTS, CSP, CORS, Alt-Svc; CORS headers injected on 429 rate-limit responses so browsers surface the status code instead of a misleading CORS error |
| Alt-Svc on every transport | ✅ | RFC 7838 section 3: each Alt-Svc header replaces a client’s cached alternatives, so every response, over TCP and over QUIC alike, names h3 on every UDP port that serves it, the connection in use among them, and a browser keeps the same set whichever connection carried the page |
| PQC TLS | ✅ | X25519MLKEM768 hybrid key exchange (NIST Level 3) + ML-DSA-87 server certificates (NIST Level 5, FIPS 204) |
| Background Cleanup | ✅ | Auto-cleanup of expired entries |
| ACME Automation | ✅ | Let’s Encrypt HTTP-01/DNS-01; one individual cert per domain with atomic writes and immediate hot-reload; IP addresses beside a domain (RFC 8738, shortlived profile); renewal in the CA’s ARI window (RFC 9773) with replaces |
| OCSP Stapling | ✅ | For every certificate served (each domain’s and its ML-DSA companion’s) whose certificate names a responder: the response is verified with OpenSSL (signature by the issuer or a responder it certified for OCSP signing, the certificate it is about, thisUpdate/nextUpdate), stapled by both the rustls and the OpenSSL listeners while it is good, and refreshed halfway through its validity; a must-staple certificate (RFC 7633) without one is reported |
| Prometheus Metrics | ✅ | TLS, connection, request, backend, and error metrics |
| PROXY Protocol v2 | ✅ | Client IP preservation for downstream proxies |
| Access Logging | ✅ | Per-request logging in JSON or text format with configurable file output |
| WebTransport Origin Validation | ✅ | SR-02 cross-origin blocking with configurable allowlist |
| WebTransport Per-Origin Rate Limiting | ✅ | Max sessions per origin, streams per session, datagrams/sec enforced |
| IP Blocklists (DB-synced) | ✅ | Live-synced IP/fingerprint/country blocklists from application database |
| Per-Route Timeouts | ✅ | Per-route timeout overrides independent of global defaults |
| Custom Header Injection | ✅ | Inject arbitrary headers per route before forwarding to backends |
| Multiple Listener Ports | ✅ | Primary port plus any number of additional ports via additional_ports |
| WebTransport Operations | ✅ | JSON operation routing over streams (encrypt/decrypt/keygen/health/ping/speedtest); QUIC-native speed test server with datagram RTT probing, stream throughput download/upload, packet-loss measurement, MTR-based hop traceroute with GeoIP annotation, and per-client info lookup |
| WAF | ✅ | Pattern-based injection and traversal inspection — SQLi, XSS, path traversal, NoSQLi, SSRF, CMDi, XXE, deserialization; covers OWASP A01/A03/A08/A10 attack patterns. The OWASP Core Rule Set beside it ([waf.crs]), run by a pure-Rust SecLang engine, its verdict joining the native one. Exclusions by path, and optionally host, per category or rule. Scanner probe blocking: path-level block for .git, .env, .aws, wp-login.php, terraform state, SSH keys, CI/CD files and the other reconnaissance targets of its PQW-PROBE-* rules |
| Audit Logger | ✅ | Structured JSON audit log, one line an event: admin actions and refused admin requests, WAF blocks and detections, address blocks, rate-limit refusals and classical handshakes (each once per address in an interval), configuration and TLS reloads. A bounded queue and one writer thread: under a flood the events it cannot keep are counted and the count is written (events_dropped). The file is created 0640 and reopened after a rotation |
| JA3/JA4 Replay Detection | ✅ | One fingerprint that is not a browser’s or a known crawler’s arriving from replay_min_networks client networks (IPv4 /24, IPv6 /48) within replay_window_secs: warned and audited once a window; replay_action = "block" also blocks each address |
| JA3/JA4 Drift Detection | ✅ | One client network presenting a different JA4 on most of its connections (distinct fingerprints / connections ≥ drift_threshold after drift_min_connections): a client rotating its fingerprint. A browser keeps one JA4 per transport, so a NAT of many people scores low. drift_action as above |
| Classical Key-Exchange Policy | ✅ | pqc.downgrade_action decides what a connection whose key exchange is classical gets, on every listener (OpenSSL and rustls over TCP, HTTP/3, extended CONNECT, the WebTransport server): allow serves it, log serves it and records it in the audit log, block answers every request (or session) on it 421. The group is the one each handshake negotiated |
| Response Cache (RFC 9111) | ✅ | Optional RFC 9111-compliant HTTP cache with Cache-Control parsing, ETag/If-None-Match, Last-Modified/If-Modified-Since, Vary header support, a store bounded by size (keys and headers counted with bodies) with S3-FIFO eviction and a periodic expiry sweep, and configurable path/host exclusions. HEAD responses are never stored — their body is empty by definition, and a stored empty body made the hit path report the resource as zero-length |
| HTTP/3 Client Conformance Suite | ✅ | A public service that makes the server misbehave on purpose so a client library can find out how it copes: 59 anomalies, each citing the RFC clause it exercises — reserved frame types, a duplicated SETTINGS identifier, a control stream opening with the wrong frame, an unknown QUIC frame type, a Stateless Reset, a path-MTU black hole, refused 0-RTT. Every test binds its own UDP port, because anomalies like supported_versions are endpoint-wide and one port is the whole test; the vhost serves the catalogue, reports and badge. Verdicts are asymmetric by class — ignoring a reserved HTTP/3 frame is a pass and ignoring a reserved QUIC frame is a failure, since QUIC reserves no ignorable frame types (RFC 9000 §12.4). A failure requires positive evidence that the client read the anomaly: silence on a unidirectional control stream, or a window that closes with nothing observed, is inconclusive — a rejection whose CONNECTION_CLOSE was lost looks exactly like no rejection at all. A run that never puts the client in the situation under test records inconclusive too, never a pass and never a failure. An anomaly is also emitted at the moment that makes the answer unambiguous: the mid-connection GOAWAY goes out once the client’s request is in flight and names the stream after it, because sent at connection setup it races that request, and RFC 9114 §5.2 makes a client that reads it first correct to close and reconnect — measured that way the test scored a conformant client as having failed to recover. Machine-readable catalogue, JSON reports and an SVG badge; h3-conformance drives any client from CI. TLS tier added 2026-09-17: six ports whose anomaly is the key exchange itself rather than a malformed byte — hybrid-only (forcing the HelloRetryRequest round trip that post-quantum deployments break on), classical-only against a hybrid offer (discretionary: the report says which policy the client took, because no RFC yet mandates a post-quantum floor), and a ClientHello too large for one Initial packet, judged from a count of the client’s Initials so a client that never sent a large one is reported unexercised rather than credited. Two more are now emitted through a key_share_impairment hook in vendor/rustls-fixed, which exists because a correct TLS implementation has no code path that produces either: a ServerHello naming a group the client never offered, payload left exactly as generated so that an abort can only be over RFC 8446 §4.1.3 and not over a share that would not parse; and a hybrid share with one bit flipped early in the ML-KEM ciphertext and the X25519 tail untouched, where a client that still completes has silently downgraded itself to the classical half alone. What is judged on the first is the abort and not the alert value — RFC 9001 §4.8 expressly lets a QUIC endpoint replace any alert with a generic one — and a handshake that ends with no CONNECTION_CLOSE at all is inconclusive rather than a failure. The third, a GREASE named group, was withdrawn before it judged anything: as built it put the reserved value in the ServerHello key_share, which is illegal under §4.1.3 whatever the value is, so it scored every conformant client as a failure for doing the right thing |
| Cache Purge (admin API) | ✅ | GET /cache reports entries and bytes held; POST /cache/purge drops them — everything, or narrowed by ?host=, ?prefix=, ?host=&prefix= for one path prefix on one host, or ?host=&path= for one exact URL across every method. Exists because a deploy that changes generated output otherwise leaves the edge serving the old body until max-age expires, and the alternative was restarting the proxy. path= without host=, or with prefix=, is refused rather than silently widened or ignored. Audit-logged with scope and target |
| Single Shared Response Cache | ✅ | One cache instance per process rather than one per listener. There were five — one per HTTP listener variant and one per QUIC port — so the same URL was cached separately for h2 and h3 and for each port, and a purge would have cleared one while the others served the old body. The key is METHOD|host|path, with no port or protocol in it, so sharing is what the key already assumed |
| Correct HEAD Semantics (RFC 9110 §9.3.2) | ✅ | A HEAD response carries the header fields a GET would have. Backends serving chunked send no Content-Length, and the proxy no longer synthesizes content-length: 0 from the empty buffered body — which had been telling every link checker, uptime monitor, CDN probe and security scanner that every dynamic page was empty. Fixed on all three transports (HTTP/1.1, HTTP/2 and the separate HTTP/3 implementation) |
| Per-Backend Connection Pool | ✅ | Per-host idle timeout, max idle connections, max total connections, and acquire timeout for the HTTP/1.1 backend pool. A reused connection the backend closes just as a request is written (its keep-alive timeout racing the reuse) no longer turns into a 502: an idempotent request (RFC 9110 §9.2.2) with a replayable body is sent again on another connection; a POST is not, since its first copy may have been acted on |
| Per-Backend Retry | ✅ | retries, retry_backoff_ms (doubling) and retry_on per backend, on TCP and HTTP/3: a connection that could not be made is retried for any method; a 5xx or a timeout only for a method that may be repeated with a body that can be resent |
| Per-Backend Circuit Breaker | ✅ | Per pool server: cb_failure_threshold failures open it; after cb_half_open_delay_secs one trial request at a time goes through, and cb_success_threshold successes close it (a trial that fails opens it for another delay); the server then ramps back up in slow start |
| 0-RTT Replay Protection | ✅ | Bounded nonce store (strict/session/none); a replayed or unverifiable ClientHello’s early data is declined and the handshake completes without it |
| QUIC Retry | ✅ | Optional RFC 9000 source-address validation (enable_quic_retry); Retry token echoed before handshake, anti-spoofing at +1 RTT |
| Certificate Transparency | ✅ | Submits new certs via POST /ct/v1/add-chain after ACME issuance, to logs chosen from the live CT log list: one per operator whose shard holds the expiry |
| QUIC Connection Migration | ✅ | Configurable enable/disable of QUIC connection migration (enable_quic_migration) |
| Per-Route Security Policy | ✅ | Per-route mTLS requirement, JA3 and JA4 allowlists, rate limit override, WAF mode, 0-RTT control |
| Body Size Limit | ✅ | Global max_request_body_bytes enforced (default 50 MB); 413 on excess |
| Config Schema Versioning | ✅ | version field in config; warns if absent, errors if version > current |
| Config Conflict Validation | ✅ | Startup validation catches conflicting settings (PQC+passthrough, 0-RTT non-safe, mTLS without CA) |
| Environment Config Overlay | ✅ | --env <name> flag loads config.<name>.toml overlay merged on top of base config |
| CIDR Blocklist Support | ✅ | Blocklist files now match full subnet ranges (e.g. 192.0.2.0/24); previously only host addresses were matched |
| Session Affinity TTL | ✅ | Sticky session maps evict stale entries after configurable TTL; header affinity uses its own dedicated map |
| Proactive Backend Health Checks | ✅ | Background probes on each backend’s own interval: a GET for the pool’s health_check_path (or a backend’s health_check) over its own transport, healthy on a 2xx, or a TCP connect without a path. Failing pool servers leave rotation until they answer; the admin API and metrics report the last answer without asking again |
| Enforced Backend Request Timeout | ✅ | Per-backend/pool-server timeout_ms bounds the forwarded request itself (not just connection setup) — a hung backend returns 504 Gateway Timeout instead of holding the client connection open indefinitely |
| Configurable GeoIP Block Duration | ✅ | geoip_block_duration_secs in [security] (default 24 h); previously blocks were permanent with no expiry |
| Configurable WebTransport Port | ✅ | webtransport_port in [server] replaces the hardcoded port 4433 for the dedicated WebTransport server |
| Dynamic Alt-Svc Header | ✅ | Alt-Svc value built from udp_port + additional_ports instead of a hardcoded constant; alt_svc_ports overrides that list where a bound port does not actually serve HTTP/3 |
| TCP-Only Hosts | ✅ | tcp_only_hosts in [server] — listed hostnames receive Alt-Svc: clear, evicting cached QUIC upgrades so browsers always connect via TCP/TLS; a request for one that arrives over HTTP/3 anyway (coalesced onto another name’s connection) gets 421 Misdirected Request, which browsers retry on a new connection — TCP |
| HTTP/1.1-Only Hosts | ✅ | http11_only_hosts in [server] — listed hostnames negotiate HTTP/1.1 only (no h2 ALPN); browsers open an independent TCP connection per fetch() stream instead of coalescing onto one HTTP/2 pipe, eliminating head-of-line blocking on parallel speed test streams |
| Secrets out of the configuration | ✅ | Every secret setting takes { credential = "name" } (a systemd credential, encrypted at rest under the TPM2 and/or host key with LoadCredentialEncrypted=) or { file = "/path" }, read at start and on every reload; the configuration itself holds none |
| Admin Loopback Enforcement | ✅ | require_loopback = true (default) aborts startup when admin API is bound to a non-loopback address |
| Shared Security State | ✅ | Every listener — QUIC and all three TCP paths — shares one SecurityState. Blocked IPs, rate limiter counters, the fingerprint corpus and DB-synced blocklists are visible across all of them. The TCP listeners previously each constructed their own, so an IP blocked on one was not blocked on another and the admin API could not clear it |
| Audit Events at Their Source | ✅ | Each event is recorded where it happens: the admin API (actions, refused requests), the security layer (WAF verdicts, address blocks), the rate limiter, the TLS provider (every reload, whatever asked for it), the configuration reload handler and the handshake policy |
| Cryptographically Secure Admin Token | ✅ | Ephemeral admin tokens use OsRng instead of thread_rng |
zero_trust_mode | ✅ | Startup validation enforcing mTLS, no plaintext backends, no CIDR trust, and admin HMAC proof-of-possession |
| Per-Route HMAC Signing | ✅ | X-Request-Signature, hex HMAC-SHA256 of METHOD\nPATH_AND_QUERY\nTIMESTAMP\nNONCE\nCONTENT_DIGEST, the last the request’s Content-Digest field (RFC 9530, with a sha-256 member) or empty; the body is held to that digest as it is forwarded (a request without the field has no body), so neither request nor body can be changed. A required X-Request-Nonce (8–128 characters) is bound into the signature and accepted once within the window, so a signed request cannot be replayed |
| Internal Route Auto-mTLS | ✅ | internal = true routes default to requiring client certificate |
| Admin HMAC Proof-of-Possession | ✅ | Optional per-request HMAC signature (method, path+query, timestamp, nonce and the body’s SHA-256 signed) alongside the bearer token; the X-Admin-Nonce (8–128 characters) is required and accepted once within the window |
trusted_internal_cidrs Deprecation | ✅ | Startup warning directing operators to cert-based trust |
| OpenSSL Subprocess Env Sanitisation | ✅ | All openssl subprocesses clear the environment before execution (env_clear()) to prevent PATH/LD_PRELOAD injection |
| Hot Reload | ✅ | Configuration and TLS certificates reloaded at runtime without dropping connections or restarting: routes, security, the WAF, admin credentials, pools and every listener’s per-request settings; a change to a setting bound at startup (ports, listener kinds, process-wide services) is named in a warning |
| Log Rotation (SIGHUP) | ✅ | SIGHUP reopens all log file handles in-place; compatible with logrotate postrotate — no restart required |
| TLS 1.3 Default | ✅ | TLS 1.3 minimum by default on all listeners (min_version = "1.3"); configurable to allow TLS 1.2 via min_version in [tls] |
| Certificate Compression (RFC 8879) | ✅ | The certificate chain is sent compressed to any client that offers compress_certificate. Measured on pqcrypta.com: 3,435 bytes to 2,376 with zlib (1.45:1), about 1 KB off every full handshake — which roughly offsets what the X25519MLKEM768 key share adds. Both TLS stacks are covered, and they need different treatment: on the OpenSSL TCP listener it takes SSL_CTX_set1_cert_comp_preference and SSL_CTX_compress_certs (the preference alone reports success and changes nothing on the wire), while rustls on QUIC/HTTP-3 needs only its brotli/zlib crate features. zlib on TCP because these OpenSSL builds carry -DZLIB and nothing else; brotli and zlib on the QUIC side |
| Delegated Credentials (RFC 9345) | ✅ | Under a certificate that allows it (the DelegationUsage extension and the digitalSignature key usage), the proxy mints delegated credentials itself: short-lived keys the certificate’s key signs for, which then sign the handshake in its place. ML-DSA-87, ML-DSA-65 and ECDSA P-256 ones, each valid for a day and replaced every six hours, with keys that exist only in memory; a client that offers the delegated_credential extension gets the first it accepts, so a post-quantum client gets an ML-DSA CertificateVerify under an ECDSA certificate. Served by rustls, so over QUIC; see Delegated Credentials |
| Request IDs | ✅ | request_id_header in [server] sends one ID per request to the backend and back to the client on every transport; a well-formed client ID (≤128 visible ASCII chars) is kept, anything else replaced with 128 random bits in hex; off by default |
| Server Identity Concealment | ✅ | Backend Server header replaced by server_header in [server] (default pqcrypta, no version); an empty value passes the backend’s through |
| JWT Rate Limiting | ✅ | Per-subject rate limiting with HMAC-SHA256 signature verification; unsigned sub claims rejected; non-HMAC algorithms blocked |
| Log Injection Prevention | ✅ | Newlines and control characters stripped from all user-controlled fields before writing to access and audit logs |
| NEL (Network Error Logging) | ✅ | Network Error Logging headers with configurable policy for client-side error reporting |
| Backend Certificates Always Verified | ✅ | No option turns backend certificate verification off: tls_cert pins a self-signed backend or a private CA, and tls_skip_verify is refused at config load |
| SSRF Protection | ✅ | Link-local and loopback backend addresses rejected; RFC1918 logged with warning; WAF SSRF pattern set active |
| Admin Brute-Force Lockout | ✅ | Per-IP and global lockout with exponential back-off (5 min base, up to 30 min) on repeated auth failures |
| Connection Draining | ✅ | A pool server a reload removes takes no new sessions, keeps the ones it has until connection_draining.timeout_secs, then leaves the pool; requests in flight on it finish. By hand: POST /pools/{pool}/servers/{id}/drain (and undrain, healthy, unhealthy) on the admin API |
| Passive Health and Failover | ✅ | A pool member a request cannot reach leaves rotation at once (its health check, which first runs as the pool is built, puts it back) and the request goes to another member, on TCP and HTTP/3 alike: nothing was sent, so whatever its method |
| Canary Rollouts | ✅ | A member made the canary through the admin API steps through canary.ramp_percent while its error rate holds and is promoted at the end (auto_promote), the members it replaces draining: blue/green deployments with automatic rollback |
| Request Queuing | ✅ | Every algorithm honours each pool server’s max_connections; a request that finds every server up but full waits for the first place given back, up to queue.timeout_ms, with at most queue.max_size waiting (per pool: queue_max_size, queue_timeout_ms) |
| Slow Start | ✅ | A pool server that recovers (its health check, its breaker) or joins on a reload ramps from initial_weight_percent to its weight over duration_secs: through its weight for the weighted and hashing algorithms, and for the others by being passed over in proportion to its ramp |
| Connection Pool | ✅ | Per-backend connection pool with configurable max idle, max total, acquire timeout, and idle timeout |
| Session Affinity Modes | ✅ | Sticky sessions via IP hash, custom header, or Set-Cookie with configurable SameSite attribute |
| Path Regex Routing | ✅ | Per-route regex pattern matching with ReDoS prevention (pattern size-limited) |
| Path Canonicalisation | ✅ | Every transport routes and forwards on one canonical path: RFC 3986 dot segments resolved, percent-encoded ones included (resolve_dot_segments), repeated slashes merged (merge_slashes), case folded (normalize_paths). The WAF still inspects the raw path, so a traversal attempt is detected as one |
| Certificate Compression | ✅ | RFC 8879 on both stacks: zlib over TCP via OpenSSL’s SSL_CTX_compress_certs, brotli or zlib over QUIC/HTTP-3 where rustls builds the list from crate features. certificate_compression = "auto" | "off" in [tls], default auto. Worth 1,051 bytes off every full handshake on a four-certificate Let’s Encrypt chain |
| PQC Session Tickets | ✅ | Each TLS 1.3 ticket carries its own ML-KEM-1024 encapsulation; the resumption state is sealed with an AES-256-GCM key derived from it via HKDF-SHA384 (pqc_session_tickets, session_ticket_lifetime_secs) |
| TLS Key Permission Checks | ✅ | Validates private key file permissions at startup; configurable strict mode aborts on insecure permissions |
| Malicious Fingerprint Blocking | ✅ | Classification consults the operator database at fingerprint_db_path first, then the built-in table of observed fingerprints (data/fingerprints/builtin.json), matching JA3 then JA4 (block_malicious, block_scanners). Authorised pentest_bypass_ips are classified but never banned |
| Proof-of-Work Challenge | ✅ | [security.challenge]: a page load from an address a heuristic blocked gets an ALTCHA proof-of-work interstitial instead of a 403, and the pass it earns (a __Host- cookie bound to the browser’s network and User-Agent) lets it through; operator and database blocks stand; [routes.security] challenge = true asks every page load on a route |
| Server-Timing Header | ✅ | Per-request Server-Timing header with proxy latency breakdown for performance visibility |
| Accept-CH Header | ✅ | Accept-CH client hints advertisement for adaptive content delivery |
| Graceful Shutdown Drain | ✅ | Configurable drain timeout polls active connections at 100 ms intervals; exits as soon as connections reach zero |
| Weighted Load Balancing | ✅ | Per-server weight (1–1000) with smooth weighted round-robin for proportional traffic distribution |
| Canary / Traffic Splitting | ✅ | Percentage-based canary routing with sticky cookie assignment, per-pool auto-rollback on error rate threshold, and live admin control — active on HTTP/1.1, HTTP/2, HTTP/3/QUIC |
| Traffic Shadowing / Mirroring | ✅ | Per-route fire-and-forget copy of requests to a secondary backend; client only sees primary response; all parameters configurable (backend, percent, timeout, marker header) — active on HTTP/1.1, HTTP/2, HTTP/3/QUIC |
| RFC 9111 Response Cache | ✅ | Full Cache-Control parsing (max-age, s-maxage, no-cache, no-store, private, public); ETag/If-None-Match → 304; Last-Modified/If-Modified-Since → 304; Vary header support; TTL-based expiry; a store bounded by size (keys and headers counted with bodies) with S3-FIFO eviction and a periodic expiry sweep — active on HTTP/1.1, HTTP/2, HTTP/3/QUIC |
| Hop-by-Hop Header Stripping | ✅ | HTTP/1.1 connection-specific headers (Transfer-Encoding, Connection, Keep-Alive, Proxy-Connection, Upgrade, TE, Trailer, Proxy-Authenticate, Proxy-Authorization) stripped from backend responses before caching and forwarding — compliant with RFC 9113 §8.2.2 and RFC 9114 §4.2; prevents ERR_QUIC_PROTOCOL_ERROR on HTTP/3/QUIC and stream errors on HTTP/2 |
| OpenTelemetry Distributed Tracing | ✅ | W3C TraceContext (traceparent/tracestate, the W3C Trace Context Recommendation) + B3 multi-header + B3 single-header extraction and injection; composite propagator on all transports (HTTP/1.1, HTTP/2, HTTP/3/QUIC, WebTransport); OTLP HTTP/JSON export; ParentBased(TraceIdRatioBased) sampler; trace IDs in access-log lines |
| Least Response Time Routing | ✅ | Routes requests to the backend with the lowest moving-average response time |
| IP Hash Load Balancing | ✅ | Deterministic backend selection by client IP hash for implicit session stickiness |
| Per-Server Priority | ✅ | Failover priority levels; lower-priority backends only receive traffic when higher-priority ones are unhealthy |
| Per-Server Keep-Alive | ✅ | QUIC keep-alive PINGs every keepalive_interval_secs, so a NAT keeps the path of a connection with a session or tunnel open; a connection with nothing in flight is still closed after max_idle_timeout_secs (HTTP/3 with GOAWAY first), as a TCP connection is |
| DNS Prefetch / Preconnect / Prerender Hints | ✅ | Early Hints Link headers for dns-prefetch, preconnect, modulepreload, and speculative prerender |
| Report-To Header | ✅ | Reporting endpoint configuration injected into responses for NEL and CSP violation delivery |
| Fingerprint Cache TTL | ✅ | JA3/JA4 fingerprint classification cache with configurable max-age and background cleanup |
| QUIC ACK piggybacking & send coalescing | ✅ | Owed ACKs ride on outgoing packets (ack_piggyback) and responses that finish together leave in one transmit (quic_send_coalescing); ack_eliciting_threshold (default 1) governs only ACK-only packets |
| QUIC congestion control: BBRv3 | ✅ | quic_congestion_control (default bbr3, also cubic, new_reno) on the main QUIC listener and the WebTransport endpoint alike: BBRv3 models the path’s bottleneck bandwidth and RTT and paces at that rate, so it fills long or lossy paths that a loss-based controller backs off from at the first random drop, and keeps the bottleneck queue short |
| QUIC ACK Frequency | ✅ | draft-ietf-quic-ack-frequency extension (enable_ack_frequency, default on) — peers may request fewer, batched ACKs, cutting ACK traffic and CPU on high-throughput connections; negotiated, so inert against clients that lack it |
| MASQUE / CONNECT-UDP (RFC 9298) | ✅ | UDP proxying over HTTP/3 Extended CONNECT (:protocol = connect-udp); UDP payloads relayed as HTTP Datagrams (RFC 9297) bound to the request stream; disabled by default with host:port allowlist, client lists by address, network or host name (allowed_clients; private_target_clients for a target on a loopback or private address, which is relayed for nobody else), per-session idle timeout, and per-connection session cap ([masque]) |
| DNS over HTTPS (RFC 8484) | ✅ | A gateway for an authoritative name server on the same host: GET, HEAD and POST over HTTP/1.1, HTTP/2 and HTTP/3; DNS over TCP to the server; Cache-Control from the answer TTLs; RFC 8467 padding on request; zone transfers and other opcodes refused with an Extended DNS Error; loopback-only, off by default ([doh]) |
| Encrypted Client Hello (ECH) | ✅ | Server-side ECH, RFC 9849, with post-quantum HPKE: X-Wing (0x647A) and ML-KEM-768/1024 configs open through libcrux (vendor/pqcrypta-hpke-pq) beside the RFC 9180 DH ones. ech-keygen --kem x-wing and --kem x25519 generate each, and the published list carries X-Wing first, so a client uses it where it can and browsers, which implement X25519 only today, still get ECH. HPKE keypairs generated and rotated by ech-keygen / ech-rotate.timer into /etc/pqcrypta/ech-configs, with previous configs retained so clients holding a cached DNS record still complete. A rotated key is taken up by every listener without a restart: QUIC and each TCP listener rebuild their rustls configs on the TLS reload (ech_config::reloads), and ech-rotate.sh asks for that reload through the admin API, then publishes the new list in DNS with pqcrypta-ech-publish (the self-hosted DNS signer) only once the proxy holds the key. Applies on TCP and QUIC — ECH is a TLS 1.3 extension and QUIC is TLS 1.3, so the same handshake resolves it. An offer holds across a HelloRetryRequest: the retry request confirms the acceptance, and the second ClientHello’s offer, an empty enc sealed at the next sequence number, is opened with the first’s HPKE context, so a client whose first key share the server does not take still gets ECH (RFC 9849 sections 6.1.5, 7.1.1 and 7.2.1); a second offer that is missing, changed or does not open aborts the handshake. The outcome is exposed to backends as x-tls-ech: accepted, not-offered, rejected (the offer named a key this server holds and did not open with it) or unknown-config (it named none: a GREASE offer from a client without this server’s ECH configuration, or a config retired longer ago than any kept). Both rejections get retry_configs. On TCP a ClientHello without ECH stays on the OpenSSL listener, which says not-offered where the node holds ECH keys and not-supported where it holds none |
| Handshake Facts to Backends | ✅ | x-tls-version, x-tls-cipher, x-tls-group, x-tls-alpn, x-tls-ech, x-tls-library (the TLS library that completed the handshake: rustls on QUIC and the ECH/DC listener, OpenSSL on the PQC TCP listener, each with its version) and x-openssl-version (the OpenSSL this build links) injected on all three listener paths, alongside the existing x-ja3-hash / x-ja4-hash / x-client-name / x-client-type / x-client-cert / x-tls-early-data. Every one is stripped from the incoming request before being set, so a caller cannot assert a handshake it did not have |
| Observed Fingerprint Corpus | ✅ | One record per JA4 (a JA3 where no JA4 was computed) with its counts, first and last sighting, the User-Agents on its requests and a bounded sample of its JA3 variants, persisted to /var/lib/pqcrypta-proxy/state/observed.json every 5 minutes and reloaded at startup. A fingerprint seen from two client networks (an IPv4 /24, an IPv6 /48) or on two days is kept for good; a new one waits in a probation segment of 20,000, oldest let go first, so a client that sends a new ClientHello shape with every connection cannot grow the corpus or push anything established out. The JA3 classification cache beside it is a cache, bounded by security.max_tracked_fingerprints. Evidence only — it never feeds classification or blocking |
Features
Reverse Proxy
- Domain-based Routing: Route
api.example.com→ port 3003,example.com→ port 8080 - TLS Termination: Decrypt at proxy, plain HTTP to backend (default)
- TLS Re-encryption: Decrypt at proxy, re-encrypt HTTPS to backend with mTLS support
- TLS Passthrough: SNI-based routing without decryption, switched inside every HTTPS listener’s accept path (same port; limits, block list, idle and shutdown apply)
- HTTP→HTTPS Redirect: Automatic port 80 to 443 redirect server
- Custom Header Injection: Inject arbitrary response or request headers per route before forwarding to backends
- Per-Route Timeout Overrides: Independent timeout configuration per route, overriding global defaults
- Multiple Listener Ports: Primary port plus any number of additional ports (
additional_ports) all supporting QUIC/HTTP3/WebTransport - Path Regex Routing: Per-route regex pattern matching alongside exact and prefix matching; ReDoS prevention via pattern size limit
- Path Canonicalisation:
/x/../dev/,/%2e/dev/and//dev/route as/dev/on HTTP/1.1, HTTP/2, HTTP/3 and WebTransport alike, so a route guarding the canonical path cannot be stepped around by spelling it differently.resolve_dot_segmentsandmerge_slashesin[server](both on by default) are independent ofnormalize_paths(lowercasing); the WAF and HMAC proof-of-possession see the raw request
Security
- WAF: Pattern-based injection and traversal inspection — SQLi, XSS, path traversal, NoSQLi, SSRF, command injection, XXE, insecure deserialization; detect or block mode; custom patterns; body scanning; the OWASP Core Rule Set beside the native rules (
[waf.crs]); exclusions by path and host; covers OWASP A01/A03/A08/A10 attack patterns;X-Forwarded-Forheaders scanned without SSRF patterns (localhost/RFC1918 IPs in XFF are legitimate proxy hops, not SSRF — prevents false positives for clients behind local reverse proxies) - JA3/JA4 TLS Fingerprinting: Detects browsers, bots, scanners, malware based on TLS ClientHello
- JA3/JA4 Replay Detection: one tool’s fingerprint (not a browser’s) from many client networks at once — a distributed campaign
- JA3/JA4 Drift Detection: one client network rotating its TLS fingerprint across its connections — fingerprint evasion
- Malicious Fingerprint Blocking:
block_malicious = truein fingerprint config automatically blocks connections whose JA3/JA4 hash matches a known-malicious entry in the classification database; fingerprint cache with configurable TTL and background cleanup - Classical Key-Exchange Policy:
pqc.downgrade_actiondecides what a connection whose handshake ended on a classical group gets, on every listener:block(421 to every request),log(served, recorded in the audit log), orallow - PQC + Fingerprinting Combined: OpenSSL ML-KEM with ClientHello capture for early blocking
- PQC Session Tickets: rustls installs no ticketer by default, so with
pqc_session_tickets = falsethe proxy issues no TLS 1.3 tickets at all and resumption relies on session storage. When enabled, each ticket encapsulates to the server’s ML-KEM-1024 (FIPS 204) key for a fresh per-ticket secret, derives an AES-256-GCM key from it with HKDF-SHA384, and seals the resumption state with the KEM ciphertext as associated data. The keypair rolls everysession_ticket_lifetime_secs(default 12 h) retaining one previous generation, since the trait requires lifetime to be enforced by key rolling rather than a timestamp inside the ticket. Note the server holds both halves of the keypair: what this changes is the algorithm protecting ticket key material and that each ticket gets an independent secret — it is not a defence against reading server memory - Certificate Compression: RFC 8879, on by default (
certificate_compression = "auto"in[tls];"off"disables it on both stacks). The two stacks enable it in completely different ways — OpenSSL sends an uncompressed chain unless the application calls bothSSL_CTX_set1_cert_comp_preferenceandSSL_CTX_compress_certs, neither of which theopenssloropenssl-syscrates bind, while rustls needs no call at all and populatescert_compressorsfrom thebrotliandzlibcrate features. Only zlib is offered over TCP, because these OpenSSL builds report-DZLIBand nothing else and advertising an algorithm the library cannot produce is worse than offering one fewer. Measured on this deployment: the Certificate message is 3,435 bytes and theCompressedCertificatereplacing it is 2,384, a saving of exactly 1,051 bytes per full handshake — most of what the X25519MLKEM768 key share adds. The setting is read once at startup because both stacks bake it into the TLS context, so changing it needs a restart rather than a config reload - TLS 1.3 Default: TLS 1.3 minimum on all listeners by default (
min_version = "1.3"in[tls]), which is what this deployment runs. TLS 1.2 can be permitted via config for compatibility, but that is a departure from the default posture rather than an equivalent choice — OpenSSL 3.5+ for TCP/TLS, rustls for QUIC/HTTP3 - TLS Key Permission Checks: Private key file permissions validated at startup;
strict_key_permissions = trueaborts if permissions are too permissive - 0-RTT Replay Protection: Bounded two-generation nonce store (strict/session/none modes) — a TLS 1.3 ClientHello (or ticket) seen within the window, or one a full store cannot vouch for, has its early data declined (RFC 8446 §8) and completes a full handshake
- QUIC Retry (source-address validation): Optional RFC 9000 §8.1.2 Retry — a new, unvalidated connection is answered with a Retry token the client must echo before the handshake proceeds, hardening against spoofed-source amplification/DDoS at the cost of one extra round trip per new connection. Configurable via
enable_quic_retryin[server](default off, in which case RFC 9000’s implicit 3× anti-amplification validation is used instead — no per-connection latency). - Circuit Breaker: Per-backend protection from cascading failures; per-backend threshold/delay overrides
- Advanced Rate Limiting: Multi-dimensional limiting (IP, JA3/JA4, JWT-verified subject, headers, composite keys) applied on both TCP (HTTP/1.1, HTTP/2) and QUIC/HTTP3 paths; optional Redis backend distributes counters across all proxy instances
- JWT Rate Limiting: Per-subject limiting with HMAC-SHA256 signature verification before trusting the
subclaim; unsigned tokens and non-HMAC algorithms rejected - Admin Brute-Force Lockout: Per-IP and global lockout with exponential back-off (5 min base, up to 30 min) on repeated admin authentication failures
- NAT-Friendly: JA3/JA4 fingerprints identify clients behind shared corporate IPs
- Adaptive Baseline: ML-inspired anomaly detection learns normal traffic patterns
- DoS Protection: Connection limits, body size enforcement, request validation, auto-blocking
- GeoIP Blocking: Block by country/region using MaxMind GeoLite2 database; configurable block duration via
geoip_block_duration_secs(default 24 h) - SSRF Protection: Link-local (169.254.x.x) and loopback backend addresses rejected at config load; RFC1918 backends log a warning; WAF SSRF pattern set active for path, query, and body inspection;
X-Forwarded-Forexempt from SSRF patterns since proxy hops legitimately insert loopback/RFC1918 IPs into the forwarded chain - Per-Route Security Policy: Per-route mTLS requirement, JA3 and JA4 allowlists, rate limit override, WAF mode override, 0-RTT control
- Security Headers: HSTS, X-Frame-Options, CSP, COEP, COOP, CORP, and more
- CORS Handling: Full CORS support with preflight OPTIONS handling; all rate-limit 429 responses include
Access-Control-Allow-OriginandAccess-Control-Allow-Credentialsheaders when the request Origin matches an allowed origin — prevents browsers from reporting rate-limit errors as CORS failures - Server Identity Concealment: the backend’s
Serverheader is replaced byserver_headerin[server](defaultpqcrypta, no version); an empty value passes the backend’s own header through, as HAProxy and NGINX do by default - Log Injection Prevention: Newlines and all control characters stripped from every user-controlled field before writing to access or audit logs
- Backend Certificates Always Verified:
tls_certpins a self-signed backend or private CA;tls_skip_verifyis refused at config load - IP Blocklists (DB-synced): Live-synced IP, fingerprint, and country blocklists pulled from the application database — supports individual IPs and CIDR subnet ranges (e.g.
192.0.2.0/24); updates without restart. The reload reconciles in both directions: entries added to the synced file are blocked, and database-sourced entries that disappear from it are released from memory on the next reload (60 s), so deactivating a row or clicking unblock in the threat dashboard actually lifts a live block. OnlyDatabaseSyncentries are reconciled — blocks the proxy raised itself (rate limit, WAF,Manualconfig entries) are unaffected. For an immediate release,POST /blocklist/unblock/:ipon the admin API drops the IP (and any CIDR entry covering it) without waiting for the next sync;GET /blocklistshows what the running proxy is actually enforcing, which is the copy that decides whether a request is refused. A synced entry may also name a JA4 client fingerprint ({"ip", "ja4", "expires_at"}): with an address or network it bans that tool from there alone, so the other users of a shared egress address are not refused; without one, everywhere. A verified crawler and an authorised test source are never refused by a fingerprint ban, and every WAF verdict in the audit log carries the client’s JA4.[security] blocklist_filesadds further lists, such as a fleet’s shared bans - ACME Domain Path Sanitization: Domain names validated against RFC 1035 before use in file-system paths — prevents path traversal via config
Load Balancing
- 11 Load Balancing Algorithms:
least_connections(default): Routes to server with fewest active connectionsround_robin: Simple rotation through serversweighted_round_robin: nginx-style smooth weighted distributionrandom: Random server selectionip_hash: Consistent hashing by client IP for sticky sessionsleast_response_time: Routes to fastest responding server (EMA tracking)uri_hash: Affinity by request path (HAProxyuri), the query string left out so cache-busters do not scatter one resource across the pool; each caching backend owns its own slice of the URL spaceurl_param:<name>: Affinity by one query parameter (HAProxyurl_param), for a session identifier carried in the URL; a request without it falls back to round-robinheader:<name>: Affinity by one request header (HAProxyhdr(<name>)): a tenant ID, API key or device ID pins traffic without a cookie; a request without it falls back to round-robinfirst_available: Fills servers in declared order up to each one’smax_connections(HAProxyfirst), keeping spare capacity idle so it can be scaled in; a server with no limit is last in linepower_of_two_choices: Samples two servers at random and takes the less loaded per unit of weight (Envoy’s default, NGINX’srandom two least_conn): near least-connections without its O(n) scan or herd effect
- Backend Pools: Group multiple servers per route for high availability
- Session Affinity: Cookie-based, IP hash, or custom header sticky sessions; each mode uses its own dedicated map with TTL eviction
- Canary / Percentage Traffic Splitting: Route a configurable percentage of new traffic to a canary server while stable servers handle the rest; once assigned, clients receive a sticky
PQCPROXY_CANARYcookie so they stay on the same server for the duration of the experiment; auto-rollback suspends the canary if its sliding-window error rate exceeds a configured threshold; live admin endpoints (GET /canary,POST /canary/suspend/:id,POST /canary/resume/:id,POST /canary/weight/:id) allow runtime inspection and control without restarting the proxy - Traffic Shadowing / Mirroring: Per-route
[routes.shadow]block sends a fire-and-forget async copy of each request to a secondary backend; client only ever sees the primary response and the shadow response is discarded; configurable percentage (0–100), independent timeout, custom marker header name+value, and per-route response logging — zero overhead on routes without shadow configured - Health-Aware Routing: Automatically bypasses unhealthy backends; proactive TCP-connect health checks on configurable interval detect failures before traffic hits them
- Slow Start: a pool server that recovers or joins takes a growing share of requests over
slow_start.duration_secs - Connection Draining: a pool server removed by a reload (or drained through the admin API) takes no new sessions and keeps its own until the drain timeout
- Request Queuing: a request that finds every pool server full waits for a place, up to the queue’s size and time
- Connection Pool: Per-backend connection pool with configurable max idle connections, max total connections, acquire timeout, and idle timeout; idempotent requests that meet a pooled connection the backend closed as they were written are sent again on another connection instead of failing with a 502
- Per-Server Keep-Alive: QUIC keep-alive PINGs keep a NAT’s path open under a session or tunnel; a connection with nothing in flight is closed after
max_idle_timeout_secson every transport - Priority Failover: Primary servers first, then failover to lower priority
HTTP/3 Advanced Features
- Full HTTP/3 Support: Native HTTP/3 via
h3crate with proper header forwarding; hop-by-hop headers (Transfer-Encoding,Connection, etc.) stripped from all backend responses before forwarding or caching — preventsERR_QUIC_PROTOCOL_ERRORper RFC 9114 §4.2 - QUIC v1 and v2: The endpoint speaks QUIC v1 (RFC 9000) and QUIC v2 (RFC 9369), and advertises exactly those in Version Negotiation. The QUIC stack’s default version list also includes the obsolete
draft-29..34, which it cannot actually handshake; the listener overridesEndpointConfig::supported_versionsto[0x00000001, 0x6b3343cf]so VN names only what the server really speaks, plus a reserved GREASE version (RFC 9000 §15). v2 is an anti-ossification revision with the same feature set as v1 — new codepoints, salts and TLS labels — so it adds no capability, only resistance to middleboxes hard-coding “QUIC = v1”. Verified externally rather than asserted: a client offering only0x6b3343cfcompletes a handshake against this endpoint, and its VN packet lists GREASE, v1 and v2. - New address validation tokens after a client moves: when a client’s new address — after a migration or a NAT rebinding — is validated by PATH_RESPONSE, the server sends it NEW_TOKEN frames for that address (RFC 9000 §9.3), as it does for the address the handshake validated, so a client that reconnects from where it moved to skips the Retry round trip. noq-proto’s tests run in CI (
noq-fork). - A first flight sent whole: until a connection has measured its round trip, its pacer lets out the congestion window at once, as RFC 9002 §7.7 allows, rather than one datagram and then one every ~27 ms that a 333 ms initial RTT would set. The server’s handshake flight (certificate chain and an ML-KEM ciphertext) goes in one burst without waiting for the client’s acknowledgement of its first datagram; once the RTT is measured, a slow path’s bursts are still cut to 10 ms of the window. noq-proto’s tests run in CI (
noq-fork). - HTTP/3 peer violations answered as the RFCs name them: a peer that breaks RFC 9114 or RFC 9204 gets the error the section requires. A push stream from a client, a second control or QPACK stream, or a closed critical stream ends the connection with H3_STREAM_CREATION_ERROR or H3_CLOSED_CRITICAL_STREAM. CANCEL_PUSH for a push never promised, or a MAX_PUSH_ID below an earlier one, gets H3_ID_ERROR. A frame with bytes after its fields, or one that ends inside them, gets H3_FRAME_ERROR. An impossible Required Insert Count gets QPACK_DECOMPRESSION_FAILED. An Insert Count Increment or Section Acknowledgment to an encoder that inserts nothing gets QPACK_DECODER_STREAM_ERROR. A malformed request is a stream error, H3_MESSAGE_ERROR, and the connection carries on: a repeated pseudo-header, one after a regular field, one of a response’s in a request, a connection-specific field, or DATA that does not add up to its content-length (answered 400). The vendored
h3fork’s tests, upstream’s integration suite with them, run over noq in CI (h3-fork), and the platform’s HTTP/3 analyzer checks the same rules against the live server. - HTTP/3 GREASE: Every connection carries a reserved SETTINGS identifier, a reserved unidirectional stream type and one reserved frame type (RFC 9114 §7.2.8), so clients that do not ignore unknown extensions show it now rather than when a real extension arrives. The reserved frame goes ahead of the first response’s HEADERS frame, never last on the stream: RFC 9114 §4.1 allows it anywhere, but aioquic before 1.6 loses the end of a stream whose last frame is one it ignores, and its clients (dnspython’s DNS over HTTPS among them) then wait out their timeout for a response they have already received.
- Early Hints (103): Preload CSS/JS resources via Link headers, sent as a 103 before the backend answers over HTTP/3 and HTTP/2, and on the final response over HTTP/1.1 — dns-prefetch, preconnect, modulepreload, and speculative prerender hint types supported. Preload rules are scoped per host/path in
[[http3.preload_resources]]and hot-reload at runtime (preconnect origins + preload rules apply on the next request, no restart). Note: anhrefis only used by the browser when it byte-matches the page URL, so any?v=cache-buster must be included and kept in sync. - Priority Hints: RFC 9218 Extensible Priorities drive HTTP/3 stream scheduling (request header, origin response header, PRIORITY_UPDATE)
- Request Coalescing: identical cache misses wait for one fetch and are answered from the cache it fills
- Alt-Svc Advertisement: Dynamic HTTP/3 upgrade headers on all ports — built from
udp_portandadditional_portsso every listener advertises its actual address, and the same on every transport: over TCP and over QUIC the value lists h3 on every UDP port that serves it, since each Alt-Svc header replaces a client’s cached alternatives (RFC 7838 section 3).alt_svc_portsin[server]replaces the derived list outright, for the case where a bound port does not serve HTTP/3 — a provider filtering inbound UDP/443 upstream, or a port handed to the WebTransport server — since advertising one costs every visitor a QUIC attempt that can only time out. An empty list advertises no HTTP/3 at all, which is the truthful value for a node that serves none.tcp_only_hostsin[server]sendsAlt-Svc: clearfor designated TCP-only origins (and answers421 Misdirected Requestto any request for one that arrives over HTTP/3, so the browser retries it over TCP), as doalt_svc_clear_user_agents(case-insensitive User-Agent substrings: search crawlers and TLS scanners by default) andalt_svc_clear_cidrs(source networks: Cloudflare’s published ranges by default, since Cloudflare Radar sends a generic Chrome UA);alt_svc_max_age_secssetsmaon every advertisement (default 86400). With nothing advertised,x-webtransport-portis not sent either;http11_only_hostsin[server]suppressesh2ALPN entirely so browsers open an independent TCP connection per stream (required for parallel TCP speed tests) - Virtual Host Routing: Proper
:authoritypseudo-header handling for backend routing - Server-Timing: Performance metrics header for browser DevTools (W3C Server Timing)
- NEL (Network Error Logging): Client-side error reporting with configurable policy
- Report-To: Endpoint configuration for NEL and Reporting API
- Accept-CH: Client Hints for responsive content delivery (DPR, Viewport-Width, ECT)
Protocols
- QUIC/HTTP/3: Full HTTP/3 support via QuicListener (h3 + noq crates — noq is n0-computer’s multipath-capable quinn fork; see Multipath QUIC above)
- Multipath QUIC (draft-ietf-quic-multipath): Full multipath support. The QUIC stack is noq (n0-computer’s multipath-capable quinn fork), which implements the complete extension — concurrent, data-carrying paths with per-path packet-number spaces, per-path loss recovery and congestion control, the full lifecycle frame set (ACK_MP/PATH_ABANDON/PATH_STATUS/MAX_PATH_ID/PATHS_BLOCKED), per-path connection-ID spaces, and a scheduler. The concurrent path budget is set by
server.max_concurrent_multipath_paths(default 4;1keeps every connection single-path,0stops the extension being negotiated at all) and path creation/validation/teardown is automatic once negotiated. Peers that do not advertise multipath are unaffected whatever the value. HTTP/3 and WebTransport both run over noq (via the in-treeh3-noqbinding and the noq-portedwtransport). Verify: scan pqcrypta.com at https://pqcrypta.com/http3_quic/ — the Multipath field validates a genuine second data-carrying path. - WebSocket tunnels (
supports_websocketper route): HTTP/1.1 upgrades, HTTP/2 extended CONNECT (RFC 8441) and HTTP/3 extended CONNECT (RFC 9220), relayed to the backend’s own HTTP/1.1 upgrade over its TLS settings with the request’s fields; the backend’s answer is verified and its subprotocol and extensions passed on; idle in both directions closes the tunnel (ws_idle_timeout_secs) - WebTransport: sessions on the HTTP/3 port itself (beside ordinary requests on the same connection: its bidirectional and unidirectional streams and its datagrams are told apart by session and handed to it) and on the dedicated WebTransport port, served by one implementation: each stream and datagram forwarded to the route’s backend (a
tcpbackend relays a stream’s bytes both ways), the speed test at/speedtestand the telemetry wall at/telemetry - WebTransport SNI Certificates: The dedicated WebTransport listener selects the per-domain certificate by SNI from the certs directory (same multi-cert resolver as the HTTPS listeners), so a single node serves WebTransport for every hosted domain with that domain’s own certificate
- WebTransport Origin Validation: SR-02 cross-origin enforcement — configurable
webtransport_allowed_originsallowlist rejects browser sessions from unlisted origins with 403; non-browser clients (no Origin header) always accepted - WebTransport JSON Operations: JSON operation routing over streams — encrypt, decrypt, keygen, health, ping dispatched to backend by operation type; plus a built-in QUIC-native speed test server (
speedtestoperation) providing datagram RTT probing, stream download/upload throughput measurement, packet-loss counting, MTR-based hop traceroute with GeoIP city/ASN/country annotation, and client IP info lookup - Telemetry Wall (
/telemetry): Native WebTransport handler that pushes 6 independent QUIC uni-streams at 20 Hz each (~5 Mbps virtual throughput per channel), demonstrating true QUIC stream isolation. A stats channel pushes RTT, CWND, CPU, and memory at 10 Hz. A control bidi-stream accepts impairment commands (delay, loss, bandwidth cap, jitter, disconnect) scoped to individual channels, leaving others unaffected — the opposite of TCP head-of-line blocking. - QUIC vs TCP Speed Test (
/speedtest): Side-by-side throughput comparison over QUIC and TCP. WebTransport path measures download/upload throughput, datagram RTT, and packet loss. Thetcp_only_hosts+http11_only_hostsconfig options force a parallel HTTP/1.1 connection so the browser opens one TCP stream per fetch rather than coalescing onto HTTP/2 — enabling a true protocol-level comparison. TCP-speedtest responses echo the requestOriginwhen it is inwebtransport_allowed_origins, so the test works from any allowed front-end regardless of allowlist order. - Pentest Suite (
pentests/): 32 automated black-box attack scripts across 12 phases covering WAF bypass, HTTP smuggling (HTTP/1.1 CL.TE, HTTP/2 Rapid Reset, HTTP/3, WebTransport), SSRF, timing oracles, race conditions, and AI/LLM attack surface. Usepentest_bypass_ipsin[security]to skip rate-limiting and auto-block for test runner IPs while keeping the WAF active. - WebTransport in two places: every HTTP/3 listener (
udp_portandadditional_ports) serves WebTransport sessions on the same connections as its requests, and the dedicated WebTransport server serves them onwebtransport_port(default 4433), a port the HTTP/3 listeners skip; one implementation serves both - Shared Security State: Every listener — QUIC and all three TCP paths — shares one security context, so blocked IPs, rate limiter counters, the fingerprint corpus and DB-synced blocklists are consistent across every port and transport, and the admin API’s unblock route reaches all of them
- Configurable WebTransport Port:
webtransport_portin[server]controls the dedicated WebTransport server bind port (default 4433) - X-Forwarded Headers: X-Real-IP, X-Forwarded-For, X-Forwarded-Proto
- Hop-by-Hop Header Stripping: HTTP/1.1 connection-specific headers stripped from backend responses at the proxy layer before any caching or forwarding — safe across HTTP/1.1, HTTP/2, HTTP/3/QUIC, and WebTransport
Operations
- Hot Reload: Configuration and TLS certificate reload without restart
- Environment Config Overlay:
--env <name>CLI flag (orPQCRYPTA_ENV) loadsconfig.<name>.tomland merges it on top of the base config — shared base with environment-specific overrides - Config Conflict Validation: Startup-time validation catches conflicting settings (PQC + passthrough, 0-RTT on non-safe routes without replay protection, mTLS required but no CA cert configured)
- Access Logging: Per-request structured logging in JSON or plain-text format; configurable output file, includes method, path, status, latency, bytes, client IP, and upstream; user-controlled fields sanitized to prevent log injection
- Audit Logging: Async structured JSON audit log for security-relevant events — admin actions, auth failures, WAF blocks/detects, IP blocks, rate limit hits, PQC downgrade events, config and TLS reloads, JA3 replay/drift detections
- Log Rotation via SIGHUP: Sending
SIGHUPto the proxy reopens all log file handles without dropping connections or restarting — compatible with standard logrotatepostrotatehooks (systemctl kill -s HUP pqcrypta-proxy) - Admin API: Health checks, Prometheus metrics, config reload, graceful shutdown, QUIC health, WebTransport health, canary status and live weight/suspend/resume control, live blocklist inspection (
GET /blocklist), manual block (POST /blocklist/block/:ip?duration_secs=N) and immediate unblock (POST /blocklist/unblock/:ip);GET /security/status,/security/geoip/:ip,/security/fingerprintsand/security/threats; rate-limit statistics (GET /ratelimit) and per-client reset (POST /ratelimit/reset/:key) against the one advanced rate limiter every listener, port and protocol shares; loopback enforcement prevents plain-HTTP token exposure on non-loopback interfaces; ephemeral session tokens useOsRngfor cryptographic security; per-IP and global lockout of failing callers with exponential back-off; the token is checked first, so a correct token is never refused by it (a client left on a stale token cannot lock out the rest) - Graceful Shutdown Drain: Configurable drain timeout polls active connections at 100 ms intervals and exits as soon as they reach zero — no unnecessary delay on idle restarts; while it waits it says, every 2 s, what it is waiting for
- Restarts that refuse nothing (systemd socket activation): with the socket unit
pqcrypta-proxy --socket-unit FILEwrites from the configuration, the service manager holds every listening socket across a restart, so a connection that arrives while one process drains and the next starts waits in the kernel and is served, rather than refused; each listener takes the socket bound to its address and binds itself what was not passed - Certificate Transparency: New ACME-issued certs submitted via
POST /ct/v1/add-chainfor public auditability, to the configured logs or, by default, to one log per operator from the live CT log list whose temporal shard holds the certificate’s expiry - Per-Backend Retry: Configurable retry count and exponential backoff per backend; retry on 5xx responses, connect failures, or timeouts
- Cross-Platform: Linux, macOS, and Windows support
Security
One Enforcement Path
The WAF, blocklist, GeoIP check, rate limiters, header-size limit and per-route
policy are implemented once, in SecurityState::evaluate, and both transports
call it. It takes a transport-agnostic view of a request and returns a verdict;
only the rendering differs — axum builds a Response, the HTTP/3 handler builds
an http::Response<()>.
This matters because the HTTP/3 handler previously carried its own copy of the
checks, which omitted the WAF entirely: every rule was bypassable by connecting
over QUIC. Two implementations of one policy drift. When changing a rule, change
evaluate — a new decision variant will not compile until both renderers handle
it. Verify parity after any change:
# both must return 403
curl "https://<host>/?id=1%20UNION%20SELECT%20pw%20FROM%20users"
curl --http3-only "https://<host>/?id=1%20UNION%20SELECT%20pw%20FROM%20users"
TLS Fingerprint Classification
Fingerprints are computed on every transport. On TCP the listener peeks the socket
and parses the ClientHello itself; over QUIC the hello arrives inside encrypted Initial
CRYPTO frames, so the vendored rustls fork captures its wire bytes and the vendored noq
fork surfaces them through HandshakeData. Both feed the same extractor — two
parsers would mean one client classified differently depending on which port it reached,
and a blocklist entry gathered on one silently not applying on the other.
Because a QUIC client legitimately offers a different extension set (QUIC transport
parameters in, others out), the JA4 transport marker distinguishes them: q over QUIC,
t over TCP.
Blocking on the QUIC path happens after the handshake rather than before it. A QUIC server cannot decline earlier — the hello is encrypted under keys derived during the handshake it would be trying to avoid — but the block still lands before any HTTP/3 request is served.
Classification consults the operator database at fingerprint.fingerprint_db_path
first, then the built-in table. Entries are matched by JA3, then JA4.
The built-in table (data/fingerprints/builtin.json, in the operator
database’s format) holds only fingerprints that were observed: each client run
against this proxy and its fingerprint read back (curl, GNU Wget, Python
requests, openssl s_client, nmap’s ssl-enum-ciphers, and Chromium and Firefox
through Playwright, over TCP and QUIC), and browser JA4s from the observed
corpus that share those browsers’ structure and carried one browser’s
User-Agent on at least 97% of thousands of requests (Chrome, Firefox and Apple’s
WebKit). Each entry’s description says which. It names no crawler, since
crawlers are recognised by their operators’ addresses (crawler_verify)
rather than by a fingerprint anyone can present, and condemns no fingerprint
as malicious: sqlmap’s JA3 is the OpenSSL default client’s, which every
Python and curl client shares, so that judgement is the operator’s database’s.
Prefer JA4 when adding a scanner. JA3 hashes the raw cipher/extension order, so a
tool that varies its cipher list between probes produces a different JA3 every
run — two runs of nmap --script ssl-enum-ciphers against this proxy produced two
disjoint sets of 19 JA3 hashes while their JA4 values were identical. An entry
whose hash field holds a JA4 string is matched the same way as a JA3 one.
Collect fingerprints rather than copying them from public lists — a wrong entry
silently blocks real visitors. The proxy logs one line per new fingerprint under
the fingerprint_observed target, so running a single named tool and reading that
window gives verified ground truth:
MARK=$(date -Is)
# run exactly one tool against the proxy, then:
journalctl -u pqcrypta-proxy --since "$MARK" | grep "New TLS fingerprint"
Addresses in security.pentest_bypass_ips are classified and logged but never
banned by fingerprint, so adding a scanner entry cannot ban the host your
authorised scans come from.
Runtime Directories
The following directories must exist outside the web root before starting the proxy:
| Directory | Mode | Purpose |
|---|---|---|
/var/lib/pqcrypta-proxy/blocklists/ | 0700, owned by pqcrypta | Database-synced IP/fingerprint/country blocklists |
/var/lib/pqcrypta-proxy/fingerprints/ | 0700, owned by pqcrypta | JA3/JA4 fingerprint database (ja3.json) |
# Create directories with correct ownership and permissions
install -d -m 0700 -o pqcrypta -g pqcrypta /var/lib/pqcrypta-proxy/blocklists
install -d -m 0700 -o pqcrypta -g pqcrypta /var/lib/pqcrypta-proxy/fingerprints
SSRF Protection (Backend Address Validation)
Backend addresses are validated against dangerous IP ranges at config load time (F-01):
- Link-local (
169.254.0.0/16,fe80::/10) — always rejected. These ranges host cloud metadata services (AWS IMDSv1/v2, GCP metadata server, Azure IMDS). Routing proxy traffic here would expose IAM credentials to attackers. This check cannot be disabled. - RFC1918 / loopback — a warning is logged. To suppress it (e.g., in a private internal network where all RFC1918 backends are intentional):
[security]
# Explicitly acknowledge that RFC1918 backends are intentional and the SSRF
# risk has been assessed. Link-local (169.254.0.0/16) is still rejected.
allow_internal_backends = true
GeoIP Database Setup
The MaxMind GeoLite2 databases are not included in the repository (weekly updates would make committed copies stale within days). Download them with the provided script:
# Register free at https://www.maxmind.com/en/geolite2/signup then:
export MAXMIND_ACCOUNT_ID=<your account ID>
export MAXMIND_LICENSE_KEY=<your license key>
scripts/download_geoip.sh
This writes GeoLite2-City.mmdb (the geoip_db_path database, which carries the country too)
and GeoLite2-ASN.mmdb (geoip_asn_db_path) to /var/lib/pqcrypta-proxy/geoip/, where the
defaults look (GEOIP_DIR overrides it). After that, scripts/refresh_fingerprint_db.sh keeps
them current: run weekly by a timer, as an account that owns the data directories, it calls
geoipupdate with /etc/GeoIP.conf handed over as a credential (EditionIDs GeoLite2-City GeoLite2-ASN), validates each downloaded file, replaces the live one by rename only when it
changed, and sends it to the other proxy nodes, which check it against its checksum and format
before taking it; each proxy reloads a data file when it changes. It is the only scheduler
for geoipupdate; disable the Ubuntu package’s own geoipupdate.timer.
A changed database reaches the running proxy by a reload (systemctl reload pqcrypta-proxy,
SIGHUP), not a restart: a reload compares each data file (both GeoLite2 databases, the JA3/JA4
database) with the one it loaded, by inode, size and modification time, and loads what changed,
and the speed test’s readers do the same on their next lookup. The unit needs
ExecReload=/bin/kill -HUP $MAINPID for systemctl reload. The script restarted the proxy, on
every node, every week; each restart refused connections while the old process drained.
Trusted Internal CIDRs (deprecated)
Only loopback (127.0.0.0/8 / ::1) is trusted by default (SEC-A05); RFC1918 ranges are
untrusted like any other source, so a forwarded-for header from them is not believed. For
internal clients that need trust, authenticate them: mTLS client certificates
(tls.require_client_cert = true, or per route under [routes.security]) bind trust to an
identity instead of an address.
trusted_internal_cidrs remains for compatibility and is deprecated: a configuration that
sets it is warned at every start to replace it with mTLS, and zero_trust_mode requires it to
be empty. Addresses it lists bypass the security checks:
[security]
# Deprecated: prefer mTLS. Default: empty (only loopback 127.x/::1 is trusted).
trusted_internal_cidrs = ["10.200.0.0/16"]
GeoIP, ASN and Tor blocking
[security]
geoip_db_path = "/etc/pqcrypta/geoip/GeoLite2-City.mmdb"
geoip_asn_db_path = "/etc/pqcrypta/geoip/GeoLite2-ASN.mmdb"
blocked_countries = ["KP"] # ISO 3166-1 alpha-2
allowed_countries = [] # non-empty: only these; an unlocated address passes
blocked_regions = [] # ISO 3166-2, e.g. "US-CA"
blocked_asns = [] # autonomous system numbers
block_tor_exit_nodes = false # fetch tor_exit_list_url every tor_exit_refresh_secs
geoip_block_duration_secs = 86400 # 0 = permanent
All of these are one check (SecurityState::geo_block_reason) that the
per-request evaluator and the HTTP/3 per-connection gate both call, so no rule
applies on one path and not the other. The Tor list is fetched in the
background and swapped in whole; a failed fetch keeps the previous list. The
speed test reads the same two database paths.
Configuration reload
--watch-config (file edits), POST /reload, and SIGHUP (which also reopens
log files) all trigger the same reload, and every one of them loads the file
the way startup does: the --env overlay and the --udp-port,
--admin-port and --no-pqc overrides are applied again, so a reload never
quietly drops them.
What a reload applies:
- TCP listeners rebuild their routes, backend clients, headers, compression and middleware chain and swap them in atomically: the next request on any connection, including keep-alive connections already open, uses them, while a request in flight finishes on the configuration it started with.
- HTTP/3 listeners take the new configuration for every new connection, with a rebuilt backend pool and fingerprint settings. The WebTransport server and the HTTP→HTTPS redirect server follow it too (allowed origins, allowed domains, redirect status, path canonicalisation).
- Security:
[security],[rate_limiting],[advanced_rate_limiting]and[circuit_breaker]; the per-route policy the security layer reads before routing;security.blocked_ips(addresses and CIDR ranges, added and lifted as listed, leaving operator and database blocks alone); the WAF, recompiled from[waf]when it changed — exclusions, threshold, mode, categories, custom patterns,enabled— with its counters carried over; the scanner-UA exemptions; the GeoIP and JA3 databases when their paths change; the crawler verifier; and the Tor exit refresher, which reads its settings each round. - Admin API credentials —
auth_token,hmac_secret,metrics_token,allowed_ips— on the next request, so a rotated token takes effect without a restart. A reload that removesauth_tokenkeeps the previous one rather than switching authentication off. - Load balancer pools (
[backend_pools]) are added, rebuilt or dropped; a server whose settings did not change keeps its health, connections and canary state through a rebuild. - TLS and PQC settings (
[tls],[pqc],server.http11_only_hosts): the OpenSSL (TCP) listener rebuilds its acceptor and every per-SNI context from them and swaps them in, so the next handshake offers the new groups (an addedexperimental_groupsentry, a changedpreferred_kem), versions and client authentication; a handshake already under way finishes on the context it started with, and a rebuild that fails keeps the previous one and logs why. The rustls listeners take them through the TLS provider. Certificates, and Early Hints.
Settings bound when the process starts — listening addresses and ports, QUIC
transport parameters, the listener kinds (pqc.enabled,
fingerprint.enabled), the admin listener, and the process-wide [logging],
[otel], [ocsp], [acme], [cache], [conformance] and [load_balancer]
services — are listed in RESTART_BOUND_SETTINGS. A reload that changes one
applies everything else and logs a warning naming each such setting, instead of
reporting success while it waits for a restart.
PROXY protocol
[server]
proxy_protocol_trusted = ["10.0.0.0/8"] # load balancers that send PROXY headers
proxy_protocol_timeout_ms = 3000
A connection from a trusted peer must open with a PROXY header, v1 or v2, and
the address it names becomes the client address for logging, rate limits, the
WAF and GeoIP; without one it is refused. Other peers are never parsed for a
header. v2 TLVs are validated and a CRC32C TLV verified. Separately,
proxy_protocol = true on a [[passthrough_routes]] entry sends a v2 header to
that backend.
Access log format
[logging]
access_log = true
access_log_file = "/var/log/pqcrypta/access.log"
access_log_format = "combined" # or "json", or a template:
# access_log_format = '$remote_addr [$time_local] "$request" $status $body_bytes_sent $request_time_ms $ja4 $backend'
Template variables: remote_addr, time_local, time_iso8601, request,
method, path, protocol, status, body_bytes_sent, http_referer,
http_user_agent, host, request_time_ms, trace_id, ja3, ja4,
backend. Client-supplied fields are sanitised against log injection; JSON
escapes them. A streamed response is logged when the stream ends, with the
bytes actually sent.
Request validation
[security.validation]
enabled = true # default on
max_uri_length = 16384 # path + query, bytes -> 414
max_headers_count = 200 # header fields -> 431
max_header_name_length = 256 # bytes -> 431
max_header_value_length = 16384 # bytes, per value -> 431
allowed_methods = [] # empty accepts any method; otherwise -> 405
reject_null_bytes = true # raw or %00 in path or query -> 400
Checked in SecurityState::evaluate, the one evaluator HTTP/1.1, HTTP/2 and
HTTP/3 all call, after the blocklist and header-size checks and before the WAF.
A request with no host is refused by routing, which matches on it.
Refusals: CORS, geo-block page, exempt path
[security]
# Origins that may read the proxy's own 403/429 refusals cross-origin. Without
# CORS headers a refusal reaches the page as an opaque CORS error, so it cannot
# see the status and back off. One list for every transport and both limiters.
refusal_cors_origins = ["https://example.com"] # default: none
# Where a geo-blocked request is redirected (302). Empty refuses with a plain 403.
geo_block_redirect_url = "https://example.com/error_pages/403.html" # default: ""
# Exempt from IP, country and rate blocking, so a blocked visitor can load the
# page explaining the block. Must contain geo_block_redirect_url's path.
error_pages_path_prefix = "/error_pages/" # default: "" (nothing exempt)
None of these name a site by default; each deployment names its own.
Proof-of-work challenge
[security.challenge]
enabled = true # default false
max_number = 100000 # a browser computes on average half this many SHA-256 digests
pass_ttl_secs = 3600 # how long a pass lets its browser through
# secret = { credential = "proxy-challenge" } # shared by nodes that honour each other's passes
[[routes]]
name = "signup"
path_prefix = "/signup"
backend = "app"
[routes.security]
challenge = true # every page load needs a pass, blocked or not
A block a heuristic made – a request or connection rate over its limit, an
error rate, a TLS fingerprint seen too often – is a guess, and refusing every
request until it lapses refuses the person behind the same NAT as the client
that tripped it. With the challenge on, a page load from such an address (a
navigation by Sec-Fetch-Mode, or a GET that accepts HTML) is answered with an
interstitial: the browser finds the number that solves an
ALTCHA proof of work, about a second of SHA-256 in a
worker, and the proxy hands it a pass, a __Host- cookie that lets that
browser through the heuristic blocks for pass_ttl_secs. Its other requests
are refused as before until it has the pass, and a block an operator or the
database made stands whatever a browser solves. A suspicious fingerprint over
its rate keeps its connection, so its page loads can reach the interstitial.
Nothing is stored when a challenge is issued: the expiry travels in the salt,
which the challenge hash covers, and the signature is an HMAC over the
challenge and the client’s network (an IPv4 /24, an IPv6 /48), so a solution is
worth nothing from elsewhere. Each solution is spent once. The pass is an HMAC
over the network, a digest of the User-Agent and its expiry. The page, its
script and its worker are served by the proxy itself at
/.well-known/pqcrypta-challenge/ with its icon, on every host and transport, under a
Content-Security-Policy that admits no inline code and nothing from elsewhere;
verified search-engine crawlers and pentest_bypass_ips are never asked.
pqcrypta_challenges_total{outcome} counts challenges issued and solutions
passed or failed, and each solution is an audit event (challenge_passed,
challenge_failed).
JA3/JA4 Fingerprint Database
To enable fingerprint-based detection:
-
Download an open-source JA3 database (e.g., from salesforce/ja3) or create your own JSON file with the format:
[ {"hash": "<md5>", "classification": "browser", "description": "Chrome 120"}, {"hash": "<md5>", "classification": "malicious", "description": "Mirai scanner"} ]Valid classifications:
browser,bot,legitimate_bot,malicious,scanner,api_client -
Place the file at
/var/lib/pqcrypta-proxy/fingerprints/ja3.json(or configure a custom path viafingerprint.fingerprint_db_path) -
If the file is missing or malformed the proxy starts normally with an empty database and logs a warning.
-
Enforcement is controlled by two flags in
[fingerprint]:block_malicious = true(default) — automatically blocks and IP-bans connections whose JA3/JA4 hash is classified asmaliciousin the database. Set tofalsefor advisory-only logging while you build confidence in the database.block_scanners = false(default) — set totrueto also blockscannerfingerprints.
HTTP→HTTPS Redirect Host Validation
To prevent open-redirect abuse via a spoofed Host header, configure the allowed-domains list:
[http_redirect]
enabled = true
port = 80
# Only redirect requests whose Host header matches one of these domains.
# Requests with an unknown Host receive 400 Bad Request.
allowed_domains = ["example.com", "api.example.com", "www.example.com"]
Leave allowed_domains = [] (empty, the default) to disable the check and allow any Host.
Admin API Authentication
Every admin route but /health takes a credential: the configured auth_token,
a token the proxy generates at each start when none is configured (written to
generated_token_path, readable by the proxy’s user alone, never logged, and
different after every restart), or the client certificate under
require_mtls; hmac_secret adds a signature to every request. The metrics
routes also take metrics_token, unsigned, which authorises nothing else: for
a scraper that cannot sign.
allowed_ips filters addresses before any of that and is not authentication.
The details are under Admin API Authentication.
[admin]
enabled = true # off by default
bind_address = "127.0.0.1"
port = 8081 # the default
allowed_ips = ["127.0.0.1", "::1"]
# At least 32 characters: openssl rand -base64 48
auth_token = "your-random-token-here"
# require_loopback = true ← default: aborts startup when bind_address is non-loopback
Loopback enforcement (require_loopback): By default the proxy refuses to start when the
admin bind_address resolves to a non-loopback interface, because all admin traffic — including
the Bearer token — is plain HTTP. To intentionally expose the admin API on a non-loopback address
(e.g. behind a TLS-terminating SSH tunnel), set:
[admin]
bind_address = "0.0.0.0"
require_loopback = false # explicitly acknowledge the risk
Version-Controlled Configuration
Never commit your production config/proxy-config.toml to version control — it contains
secrets (auth token, ACME email), real infrastructure topology, and backend addresses.
Use config/example-config.toml as the template:
cp config/example-config.toml config/proxy-config.toml
# Fill in real values; proxy-config.toml is in .gitignore
Quick Start
Prerequisites
- Rust: the toolchain pinned in
rust-toolchain.toml, which rustup installs on the firstcargocommand in the repository - TLS certificates (Let’s Encrypt recommended)
Build
# Clone repository
git clone https://github.com/PQCrypta/pqcrypta-proxy.git
cd pqcrypta-proxy
# Build release binary
cargo build --release
# Copy example config and fill in real values (proxy-config.toml is gitignored)
cp config/example-config.toml /etc/pqcrypta/proxy-config.toml
# Validate configuration
./target/release/pqcrypta-proxy --config /etc/pqcrypta/proxy-config.toml --validate
# Run
./target/release/pqcrypta-proxy --config /etc/pqcrypta/proxy-config.toml
Release binary
Each release attaches a Linux x86-64 binary, built by the release workflow
with OpenSSL linked in, and its signed SLSA build provenance:
pqcrypta-proxy.sigstore.json (the Sigstore bundle) and
pqcrypta-proxy.intoto.jsonl (its DSSE envelope with the signing
certificate). The signature is keyless: the certificate names the release
workflow and the commit it built, and the signature is entered in Sigstore’s
public transparency log. Releases up to v0.14.1 carry the binary alone.
gh release download --repo PQCrypta/pqcrypta-proxy --pattern 'pqcrypta-proxy*'
# Against GitHub's attestation store
gh attestation verify pqcrypta-proxy --repo PQCrypta/pqcrypta-proxy
# Or against the bundle that came with it
gh attestation verify pqcrypta-proxy --repo PQCrypta/pqcrypta-proxy \
--bundle pqcrypta-proxy.sigstore.json
# Or with cosign
cosign verify-blob-attestation --new-bundle-format \
--bundle pqcrypta-proxy.sigstore.json --type slsaprovenance1 \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp '^https://github\.com/PQCrypta/pqcrypta-proxy/\.github/workflows/release-please\.yml@refs/heads/main$' \
pqcrypta-proxy
Docker
Each release pushes its image to the GitHub Container Registry, tagged with
the release (v<version>) and latest, with signed build provenance attached
in the registry (images up to v0.14.1 were built and tested, not published):
docker pull ghcr.io/pqcrypta/pqcrypta-proxy:latest
gh attestation verify oci://ghcr.io/pqcrypta/pqcrypta-proxy:latest \
--repo PQCrypta/pqcrypta-proxy
Or build it yourself:
# Build the image from the repository root (the Dockerfile is docker/'s; the
# commit names the build in --version)
docker build -f docker/Dockerfile \
--build-arg PQCRYPTA_GIT_COMMIT="$(git rev-parse HEAD)" -t pqcrypta-proxy .
# Run it: the proxy runs unprivileged in the container, on 4433 (TCP and
# UDP). The image's health check asks the admin API on 8081, which is off
# unless the mounted configuration says `[admin] enabled = true` (port 8081 is
# its default); its listeners must use these ports
docker run -d -p 443:4433/tcp -p 443:4433/udp \
-v /path/to/certs:/etc/pqcrypta/certs:ro \
-v /path/to/config.toml:/etc/pqcrypta/config.toml:ro \
pqcrypta-proxy
Configuration
Minimal Configuration
# /etc/pqcrypta/proxy-config.toml
[server]
bind_address = "0.0.0.0" # "[::]" for dual-stack; enable_ipv6 = false downgrades it to IPv4
udp_port = 443
additional_ports = [4433, 4434]
worker_threads = 0 # 0 = one per CPU core; read before the Tokio runtime is built
max_concurrent_multipath_paths = 4 # draft-ietf-quic-multipath; 1 = single-path, 0 = never negotiated
[tls]
cert_path = "/etc/letsencrypt/live/example.com/fullchain.pem"
key_path = "/etc/letsencrypt/live/example.com/privkey.pem"
ocsp_stapling = true # must be true AND [ocsp].enabled for stapling to run
pqc_session_tickets = true # without this, no TLS 1.3 tickets are issued at all
session_ticket_lifetime_secs = 43200
certificate_compression = "auto" # RFC 8879; "auto" (default) or "off"; restart to apply
[http_redirect]
enabled = true
port = 80
# Backend: Apache on port 8080
[backends.apache]
name = "apache"
type = "http1"
address = "127.0.0.1:8080"
tls_mode = "terminate"
# Backend: Rust API on port 3003
[backends.api]
name = "api"
type = "http1"
address = "127.0.0.1:3003"
tls_mode = "terminate"
# Route: api.example.com → API backend
[[routes]]
name = "api-route"
host = "api.example.com"
path_prefix = "/"
backend = "api"
forward_client_identity = true
priority = 100
# Route: example.com → Apache backend
[[routes]]
name = "main-site"
host = "example.com"
path_prefix = "/"
backend = "apache"
forward_client_identity = true
priority = 100
Security Configuration
[security]
dos_protection = true
blocked_ips = []
geoip_db_path = "/var/lib/pqcrypta-proxy/geoip/GeoLite2-City.mmdb"
blocked_countries = ["CN", "RU", "KP"]
# Rate limits live in [rate_limiting], not under [security]; the auto-block
# thresholds that react to them are [security] keys.
[rate_limiting]
requests_per_second = 100
burst_size = 200
[circuit_breaker] # top-level, not under [security]
failure_threshold = 5
success_threshold = 2
half_open_delay_secs = 30 # open -> half-open after this long
Advanced Rate Limiting Configuration
The advanced rate limiter provides multi-dimensional rate limiting inspired by Cloudflare, Envoy, HAProxy, and ML research. It solves the corporate NAT problem where many users share one gateway IP.
# Basic layer: request rate and, separately, how fast an IP may OPEN connections.
# max_connections_per_ip caps concurrency; a client that opens and closes as fast
# as it can never trips a concurrency cap, which is what connection_rate_limit is for.
# A connection counts once (by its source port) however many requests it carries,
# so a page load multiplexed over one HTTP/2 or HTTP/3 connection is one connection.
[rate_limiting]
enabled = true
requests_per_second = 100
burst_size = 50
connection_rate_limit = true
connections_per_second = 50
[advanced_rate_limiting]
enabled = true
ipv6_subnet_bits = 64 # group /64 subnets so a single host cannot rotate addresses
trusted_proxies = ["10.0.0.10"] # the proxies in front of this one; none by default
# Key resolution: a table, not a string. The first entry that can be derived
# from the request wins; `fallback` applies when none can.
[advanced_rate_limiting.key_strategy]
order = ["api_key", "jwt_subject", "ja3_fingerprint", "real_ip", "source_ip"]
fallback = "source_ip"
use_composite = false
[advanced_rate_limiting.global_limits]
requests_per_second = 10000
burst_size = 2000
[advanced_rate_limiting.global_limits.per_ip]
requests_per_second = 100
burst_size = 200
requests_per_minute = 1000
requests_per_hour = 10000
[advanced_rate_limiting.global_limits.per_fingerprint]
requests_per_second = 500
burst_size = 100
[advanced_rate_limiting.global_limits.per_api_key]
requests_per_second = 50
burst_size = 100
[advanced_rate_limiting.global_limits.per_composite]
requests_per_second = 200
burst_size = 50
# Adaptive anomaly detection
[advanced_rate_limiting.adaptive]
enabled = true
baseline_window_secs = 3600 # window used to profile normal traffic
sensitivity = 0.7 # 0.0 = laxest, 1.0 = strictest; 0.7 == raw multiplier
auto_adjust = true # tighten each key's limits toward its own baseline
min_samples = 1000 # samples required before adaptive limiting acts
std_dev_multiplier = 3.0 # requests > mean + N*stddev counts as an anomaly
# Per-route limits are keyed by route name and carry their own [.limits] table.
[advanced_rate_limiting.route_limits.login]
pattern = "/api/method/login"
[advanced_rate_limiting.route_limits.login.limits]
requests_per_second = 2
burst_size = 5
requests_per_minute = 20
requests_per_hour = 100
Key Features:
- Composite Keys: Combine IP + JA3 fingerprint + path for fine-grained limiting
- JA3/JA4 Fingerprinting: Identify clients behind NAT by TLS handshake signature, on TCP and QUIC alike
- JWT Subject Extraction: Rate limit by authenticated user, not just IP
- X-Forwarded-For Trust Chain:
trusted_proxieslists the hops whose XFF header is honoured when deriving the client IP. The list is empty by default: name only your own proxies, because any address on it can say where a request came from - IPv6 Subnet Grouping:
ipv6_subnet_bitsgroups /64 subnets to prevent per-host evasion - Adaptive Baseline: each key’s request rate, sampled once a second, as a mean and standard deviation that weigh older samples less (a sample
baseline_window_secsold weighs 1/e), so the baseline follows traffic that changes; a rate beyondstd_dev_multiplierstandard deviations is anomalous. A reload that changes the limits applies to every key at once - Layered Limits: Global → Route → Client hierarchy for defense in depth
Adaptive: sensitivity and auto_adjust
A request is anomalous once its rate exceeds mean + k * stddev for its key.
std_dev_multiplier is the raw k; sensitivity is the same control
expressed the way an operator thinks about it, and the two compose rather than
compete. The scale is anchored at the default 0.7, which yields exactly
std_dev_multiplier — so a deployment that leaves sensitivity alone behaves
identically to one that had never heard of it:
sensitivity | effective k at the 3.0 default | effect |
|---|---|---|
| 0.0 | 10.0 | only gross outliers |
| 0.7 | 3.0 | the default, unchanged |
| 1.0 | 0.25 | floored — maximum sensitivity still needs a real deviation |
auto_adjust tightens each key’s requests_per_minute and
requests_per_hour toward that key’s own learned threshold. The configured
limits are necessarily sized for the busiest plausible caller, so without it
every quiet key carries the loudest key’s headroom: an account that normally
makes 5 requests a minute may make 3,000 before anything objects, which is all
the room a credential-stuffing run needs.
Adjustment is one-directional and bounded. The configured limit is a ceiling
that is never exceeded and burst_size is the floor, so a nearly-idle key
cannot be tightened into limiting its own first legitimate burst. Nothing
happens at all until the key’s baseline reaches min_samples — a new key is not
throttled for being new. The per-second token bucket is deliberately untouched:
its quota is fixed when the bucket is built, and per-second bursts are what
burst_size and the anomaly detector already answer.
Distributed Rate Limiting (Redis)
By default all rate limit state lives in per-process memory (DashMap). Each proxy instance counts independently, so in a multi-instance deployment one client can consume their full quota on every node.
Enabling the Redis backend makes all per-key counters shared across every instance. The global token bucket stays in-process (one per node, for local DDoS protection); per-IP, per-fingerprint, per-API-key, and per-composite sliding windows move to Redis using atomic Lua scripts.
[advanced_rate_limiting.redis]
url = "unix:///run/redis/redis-server.sock" # or redis://, rediss:// for a remote one
key_prefix = "pqcp" # Namespace prefix for all Redis keys
connect_timeout_ms = 2000 # Abort connection attempt after 2 s
command_timeout_ms = 50 # Per-command timeout; on timeout → silent local fallback
distribute_per_second = true # Include per-second window in Redis (recommended)
Per-key limit tunables (all keys in [advanced_rate_limiting.global_limits.*]):
[advanced_rate_limiting.global_limits.per_api_key]
requests_per_second = 500
burst_size = 250
requests_per_minute = 15000
requests_per_hour = 250000
[advanced_rate_limiting.global_limits.per_composite]
requests_per_second = 200
burst_size = 100
requests_per_minute = 6000
requests_per_hour = 100000
How it works (HTTP/1.1, HTTP/2 via TCP and HTTP/3 via QUIC):
Request arrives on any path
│
├─ [QUIC/HTTP3 only] Simple per-IP SecurityState governor + auto-block
│ (fast in-process check; increments suspicious_patterns counter and
│ auto-blocks repeat offenders — runs before the advanced limiter)
│
├─ Advanced rate limiter (ALL paths: TCP HTTP/1.1 + HTTP/2 + QUIC HTTP/3)
│ │
│ ├─ Global token-bucket (IN-MEMORY — per-node DDoS protection)
│ │
│ ├─ Resolve key (IP / API key / JA3 / JWT / composite)
│ │
│ ├─ Redis available?
│ │ YES → one atomic Lua check, on the Redis server's clock:
│ │ token bucket (per-second)
│ │ rolling window (per-minute, 12 buckets of 5 s)
│ │ rolling window (per-hour, 60 buckets of 1 min)
│ │ ── no answer → counted on this node, sent to Redis when it returns ──
│ │ NO → local DashMap bucket (original behaviour)
│ │
│ └─ Adaptive anomaly detection (always local, per-node)
Rolling windows: the per-minute and per-hour limits sum every bucket the window overlaps, here and in Redis, so no span the length of the window holds more than the limit, including across a minute or hour boundary. A request gives its place back within one bucket of leaving the window (5 s for the minute, 1 min for the hour). A refused request is not counted, and a request is counted in all of a key’s limits or in none.
Graceful fallback: if Redis is unreachable or a command exceeds command_timeout_ms, the request is counted once on this node, whose windows already hold what the client has used here. No error is returned to the client. After a failure Redis is left alone for 250 ms, growing to 5 s, so requests do not wait for it during an outage; then one request tries it. When Redis answers again, each key’s next request adds what this node admitted in the meantime. A proxy that starts before Redis keeps trying to connect.
Admin API reports redis_connected: true/false in the rate limiter stats snapshot so you can verify the connection is live.
Least privilege. A Redis on the same host is best reached on its Unix socket alone (port 0, unixsocket, unixsocketperm 770), with the proxy’s account in Redis’s group: no other local process can then touch the counters. The proxy needs only these commands, its Lua script’s included (Redis checks a script’s commands against the caller’s ACL), on its own key_prefix (rate_limiter::REDIS_COMMANDS; a test runs the limiter against a Redis held to exactly them):
user default reset on nopass ~pqcp:* +evalsha +eval +script|load +hdel +hgetall +hincrby +hmget +hset +pexpire +time
No Redis = zero behaviour change. The [advanced_rate_limiting.redis] section is optional. Omitting it leaves the proxy running exactly as before with in-memory limiting.
WAF Configuration
[waf]
enabled = true
mode = "block" # "detect" logs only; "block" returns 403
anomaly_threshold = 5 # score at which a request is blocked
# Detection categories
sqli = true # SQL injection patterns
xss = true # Cross-site scripting patterns
path_traversal = true # Traversal and path confusion (../, ..;/, %2e%2e, overlong UTF-8)
nosqli = true # NoSQL injection ($where, $gt, $regex, etc.)
ssrf = true # SSRF (metadata IPs Critical; loopback spellings Info — no FP on prose)
cmd_injection = true # OS command injection, ${IFS}, reverse shells
xxe = true # XML external entity injection
deserialization = true # Java/PHP/Python object injection, incl. byte signatures
jndi = true # JNDI/Log4Shell, OGNL, SpEL expression injection
ssti = true # Server-side template injection (Jinja, Twig, ERB)
file_inclusion = true # php://, expect://, phar://, data:// stream wrappers
crlf_injection = true # Response splitting (URL and headers only)
proto_pollution = true # __proto__, constructor.prototype
graphql = false # Schema introspection — off, legitimate for public schemas
request_anomaly = true # Request smuggling, header injection, diagnostic methods
scanner_probe = true # Reconnaissance probe paths (.git, .env, wp-login, …)
block_scanner_uas = true
# Inspection surface
scan_json_body = true # Scan bodies, decoding JSON string escapes
max_body_scan_bytes = 0 # How much of a body is inspected: 0 = all of it (default)
scan_all_headers = true # Every header except negotiation/cache/hints/credentials
max_header_scan_bytes = 8192 # Max bytes of any single header value
max_header_count = 80 # Header count above which a request is anomalous
max_decode_passes = 3 # Percent-decode passes before matching
custom_patterns = [
"(?i)\\bmy-banned-keyword\\b",
]
Anomaly scoring. A rule match contributes its severity’s score — Low 3,
Medium 5, High 8, Critical 10 — and the request is blocked once the total
reaches anomaly_threshold. At the default of 5 any single Medium-or-higher
rule blocks on its own, while two Low-severity signals must agree. Low is where
genuinely ambiguous patterns live: localhost in a URL parameter, a bare
exec(, a backtick pair. Raise the threshold to demand more corroboration,
lower it to act on single weak signals. A match below the threshold is still
counted in the per-rule metrics, so a rule can be evaluated before it is trusted
to block.
The OWASP Core Rule Set ([waf.crs]). Beside the native rules, the proxy
can run CRS itself: the rule set ModSecurity and Coraza run, executed by a
pure-Rust SecLang engine (vendor/zentinel-modsec, with libinjection behind
@detectSQLi and @detectXSS; vendor/zentinel-modsec/VENDOR.md). No C, no
module, no sidecar. A request’s head runs CRS’s phase 1 as it is read; phase 2,
where most of CRS’s attack rules are, runs with the body, decoded as the native
rules decode it, or without one. A body the proxy holds only in part
(max_body_scan_bytes) is not given to CRS, which would refuse it as
unparsable; the native rules scan the part there is. CRS decides by its own
anomaly score, and its verdict joins the native one: a request the native rules
block stays blocked, and one CRS denies is blocked when mode = "block" and
the route’s WAF mode blocks, and reported in "detect". Either way it is named
crs:<rule>+<rule> by the CRS rules that scored it, counted per rule in the
WAF metrics, and shown by the admin explain endpoint.
[waf.crs]
enabled = true
mode = "detect" # "block" once the site's exclusions are written
entry = "/etc/pqcrypta/crs/main.conf" # SecRuleEngine On, then Include crs-setup.conf, rules/*.conf, exclusions
The entry file is SecLang: paranoia level, anomaly thresholds, allowed methods
and the site’s exclusions are CRS’s own settings, made there. A configuration
whose rule set does not load is refused at --validate and at reload; a
reload keeps the loaded rule set when none of its files changed, and loads it
again when one did. With --watch-config, a change in the entry’s directory
(an exclusion edited, the rules link renamed to a new release) is itself a
reload.
tests/crs_regression.rs measures both engines against CRS’s own regression
suite (scripts/crs-cases.py turns its go-ftw tests into cases): on CRS
4.30, blocking at paranoia level 1, of the 2,290 level-1 attack cases aimed at
a request (the response-phase ones aside) the native rules block 18.7% and
CRS 97.9%. The engine itself is held to that corpus case by case:
vendor/zentinel-modsec/tests/crs_conformance.rs replays every stage of it as
go-ftw sends them, through the HTTP framing of Apache, its reference server,
and all 5,225 pass with none skipped (vendor/zentinel-modsec/VENDOR.md).
CRS runs each of its rules over every argument a body holds, so a body CRS
reads is inspected with its worker thread handed to the runtime’s other tasks
from 16 KiB (the native rules alone, from 1 MiB), and the connections that
worker serves are not held while it reads.
Rule identifiers. Every rule has a stable identifier of the form
PQW-<CATEGORY>-<NNN>, and verdicts are reported as category:identifier —
bad-bot-ua:PQW-BOT-001, sqli:PQW-SQLI-011. Identifiers are stable across
pattern edits and across category toggles: switching a category off keeps its
rules’ metric series in place rather than renumbering everything after them.
Decoding. Inputs are matched raw and in every decoded form: percent-decoding
is applied repeatedly to a fixpoint (max_decode_passes), plus form decoding
(+ → space), HTML character references (<), JSON string escapes
(\u003c), IIS-style %uXXXX escapes, and Unicode fullwidth folding
(\uff1cscript\uff1e → <script>). A rule that matches several decoded forms of the same input counts
once. Bodies are decoded lossily and are always inspected, whether or not they
are valid UTF-8; binary bodies are additionally matched against byte signatures
(Java serialisation header, Python pickle opcodes) that no textual decoding
could preserve.
Transport parity. The WAF runs identically over HTTP/1.1, HTTP/2, HTTP/3
and WebTransport. The TCP and QUIC/h3 handlers both call the one
SecurityState::evaluate (and inspect_body once the body is buffered), so
path, query, header and body inspection are the same on every transport; a
regression corpus is run over both --transport auto (h1/h2) and
--transport h3 to prove that parity, not assume it. WebTransport stream and
datagram payloads are proxied to the same backends as HTTP requests, so they run
through the same inspect_body before reaching a backend — a WebTransport
session is not an uninspected path to /encrypt and friends.
Compressed bodies. A request body with a content coding (gzip, deflate,
br, zstd, or several applied in turn) is decoded at the proxy, held to
security.max_request_size and the body memory budget, scanned decoded, and
forwarded decoded without its Content-Encoding: what the WAF reads is
exactly what the backend receives, so bytes after a compressed stream cannot
reach a backend unread. A body that does not decode is refused 400, one that
decodes past the limit 413, and a coding the proxy cannot read 415 with the
codings it reads in Accept-Encoding. waf.decode_compressed_body = false
leaves coded bodies as they came. The raw compressed bytes are never
text-scanned (they trip binary-ish rules), only matched against the binary
deserialization signatures.
Request anomalies. request_anomaly covers what no regex can express:
conflicting Content-Length headers and Content-Length beside
Transfer-Encoding (request smuggling), transfer codings other than chunked,
control characters in header values, TRACE/TRACK/DEBUG, excessive header
counts, and a Host containing a path, space or userinfo marker.
Per-path exclusions. Tune a false positive without switching a category off site-wide, on one site of the many a node may serve:
[[waf.exclusions]]
path = "^/regex/" # regex matched against the request path
categories = ["xss"] # whole categories to suppress
[[waf.exclusions]]
path = "^/api/graphql"
rules = ["PQW-NOSQL-001"] # or individual rule identifiers
[[waf.exclusions]]
path = "^/encrypt$"
host = "^api\\.example\\.com$" # only on this host (authority or Host, no port)
categories = ["sqli", "xss"]
An exclusion without host applies on every host. One whose host does not
compile applies nowhere.
Metrics. The Prometheus endpoint exports pqcrypta_waf_requests_total,
pqcrypta_waf_allowed_total, pqcrypta_waf_blocked_total,
pqcrypta_waf_detected_total, and pqcrypta_waf_rule_hits_total labelled by
rule, category and severity. Only rules that have actually matched are
emitted, so the series count tracks the traffic this node sees rather than the
full rule table.
block_scanner_uas matches against a built-in regex set covering common attack tools. It operates independently from path/payload pattern matching — a request can be blocked purely by its User-Agent even if the body is clean. Disable per-route via waf_mode = "detect" if you need to allow scanner tools from specific paths (e.g., an internal security tooling endpoint).
The scanner-UA check also matches the default curl/N and Wget/N User-Agents, which are the expected clients for artefacts a site publishes for programmatic access (install scripts, datasets, certificate chains). scanner_ua_exempt_paths in [waf] lists paths exempt from it altogether as regular expressions over the lowercased path; injection and path-traversal scanning still runs on them. The default covers only files that exist for tools by convention (/robots.txt, /sitemap.xml, /llms.txt, /.well-known/); a site adds its own, and setting the key replaces the default, so list those too. An invalid pattern is refused at load.
[waf]
scanner_ua_exempt_paths = ['^/robots\.txt$', '^/sitemap\.xml$', '^/\.well-known/']
programmatic_client_paths in [waf] is the narrower list for downloads and APIs: on those paths curl, Wget, python-requests, python-urllib, Go, Java and a missing User-Agent pass, and attack tools, scrapers and headless browsers are still refused. scanner_ua_exempt_paths lifts every user-agent rule, which files read by every kind of crawler need (robots.txt, /.well-known/) and a download does not.
[waf]
programmatic_client_paths = ['^/downloads/', '^/api/dataset\.json$']
A verified crawler’s own address skips the user-agent rules too: one inside a range its operator publishes (Google, Bing, Apple, DuckDuckGo, OpenAI, Perplexity, Ahrefs, Common Crawl; fetched every six hours), or proven by an earlier request that named the crawler and passed its DNS check. Search engines render pages in a headless browser from those addresses, and the renderer’s User-Agent names no crawler (Bing’s sends HeadlessChrome/...), so without this the beacons a rendered page fires were refused as a scraper’s. Injection, traversal and the other attack rules still run on every request from them.
A route can declare the same exemption instead: skip_bot_blocking = true on a [[routes]] entry turns off the scanner/bot User-Agent check for that route only, on both the TCP and HTTP/3 paths. Prefer it over adding hardcoded prefixes.
Two narrower flags admit scripts without admitting scanners. Both lift only the generic-client rules (curl, Wget, python-requests, python-urllib, Go, Java, and a missing or blank User-Agent); attack tools such as sqlmap and nikto, scrapers and headless browsers stay blocked whatever the request carries, where skip_bot_blocking lets them through too:
allow_credentialed_clients = trueadmits those clients when the request carriesX-API-KeyorAuthorization: Bearer. The backend must refuse an invalid credential even on endpoints that need none, or a made-up key becomes the way past the rules.allow_programmatic_clients = trueadmits them with or without a credential, for public endpoints documented for scripts: a published dataset, a scanner’s timeline.
[[routes]]
name = "public-dataset"
host = "api.example.com"
path_prefix = "/dataset"
backend = "api"
allow_programmatic_clients = true
Route-level WAF override:
[[routes]]
name = "public-api"
host = "api.example.com"
path_prefix = "/"
backend = "api"
[routes.security]
waf_enabled = true
waf_mode = "block" # override global mode for this route
Per-route policy is resolved before the security checks run, so all of it
applies on both transports. The WAF and rate limiter sit in front of routing, so
the security layer resolves the route itself through the same find_route the
proxy uses downstream — which is what makes [routes.security] and
skip_bot_blocking take effect at all.
Audit Logging Configuration
[logging]
audit_log_enabled = true
audit_log_path = "/var/log/pqcrypta-proxy/audit.json" # omit to write to stderr
Each audit event is one JSON line with timestamp, level, category, event and the event’s own fields. Events: admin_action, auth_failure, ip_blocked, rate_limit_hit, pqc_downgrade, waf_block, waf_detect, config_reload, tls_reload, and events_dropped (how many events the queue could not hold). rate_limit_hit is written once per address in 10 seconds and pqc_downgrade once per address in 10 minutes. A text field is written to 1024 bytes. The file is created 0640 and reopened when a rotation renames or removes it.
Per-Backend Retry Configuration
[backends.api]
name = "api"
type = "http1"
address = "127.0.0.1:3003"
retries = 2 # attempts after the first; default 2
retry_backoff_ms = 50 # before the first retry; doubles each time
retry_on = ["connect-failure", "5xx", "timeout"] # default: connect-failure
A request that was never written (its connection could not be made) is sent
again whatever its method: the backend did nothing. One that was written goes
again only when its method may be repeated (GET, HEAD, OPTIONS, TRACE, PUT,
DELETE; RFC 9110 section 9.2.2) and its body can be sent again: after a 5xx or a
timeout, where retry_on names them. Each attempt has the backend’s (or the
route’s) timeout. The same policy applies on TCP and HTTP/3.
Per-Backend Circuit Breaker Override
[backends.critical-api]
name = "critical-api"
type = "http1"
address = "127.0.0.1:4000"
[backends.critical-api.circuit_breaker]
failure_threshold = 3 # trip after 3 failures (global default: 5)
half_open_delay_secs = 10 # half-open probe delay (global default: 30)
success_threshold = 1 # close after 1 success (global default: 2)
Connection Pool Configuration
Controls the HTTP/1.1 connection pool used for requests to backends over TCP. All fields are optional — defaults are production-ready for moderate traffic.
[connection_pool]
idle_timeout_secs = 90 # Close idle connections after 90 s
max_idle_per_host = 10 # Keep up to 10 idle connections per backend
max_connections_per_host = 100 # Limit for backends that do not set their own max_connections.
# NOT a ceiling over an explicit per-backend value — several
# backends are deliberately configured above this figure.
acquire_timeout_ms = 5000 # Fail the request if a connection can't be acquired in 5 s.
# Unbounded waiting turns a backend stall into a proxy-wide stall.
Reducing max_idle_per_host lowers file-descriptor usage on backends with many idle periods. Increasing max_connections_per_host improves burst throughput at the cost of backend fd pressure.
Environment Config Overlay
# Load base config, then merge /etc/pqcrypta/proxy-config.prod.toml on top
pqcrypta-proxy --config /etc/pqcrypta/proxy-config.toml --env prod
# Or via environment variable
PQCRYPTA_ENV=prod pqcrypta-proxy --config /etc/pqcrypta/proxy-config.toml
Overlay values win for all matching keys; unmatched keys from the base are kept. The overlay is re-applied on every reload (file watch, POST /reload, SIGHUP), as are the command-line overrides.
Certificate Transparency Configuration
[acme]
enabled = true
certificate_transparency = true
# Empty (the default): one log per operator from the CT log list, the one
# whose temporal shard holds the certificate's expiry. A log takes only
# certificates expiring inside its shard (half a year), so a fixed list goes
# stale: the Xenon 2025H1 shard this example used to name now answers 404.
ct_logs = []
ct_log_list = "https://www.gstatic.com/ct/log_list/v3/log_list.json"
Conformance Suite Configuration
Off by default: it serves malformed protocol output on purpose. Each test owns
one UDP port in port_range, and startup refuses a range that overlaps
server.udp_port or server.additional_ports, or one too narrow for the
catalogue, rather than serving the tests that fit.
[conformance]
enabled = false # master switch
host = "conformance.pqcrypta.com" # the vhost for the catalogue, reports and badge
port_range = [4460, 4600] # inclusive; one UDP port per test
session_ttl_secs = 3600 # how long one client's verdicts are kept
max_sessions = 512 # cap on concurrent sessions
liveness_timeout_ms = 5000 # wait for the probe that follows each anomaly
# The ML-DSA-87 chain t-cert-compression-pq serves, and its key. Verdicts on
# that port quote the chain's size as loaded from here, so replacing the file
# changes what they say.
pq_chain_cert = "/etc/pqcrypta/pqc-certs/conformance/fullchain.pem"
pq_chain_key = "/etc/pqcrypta/pqc-certs/conformance/server.key"
A session has its own host name, <session>.<host> (the sni in POST /session’s
answer). A connection whose server name is a session’s is filed under that session
from any address; one without (a test that ends before the server name is read)
under the address that started the session. The name needs a DNS name covering it
(*.<host>) and a wildcard certificate (*.<host> in [acme] domains, validated
by DNS challenge). POST /session/<id>/address files the caller’s address under an
existing session too: a dual-stack host’s tests that end before a server name is sent
then find the session over either family. h3-conformance adds its host’s address in
each family the suite resolves to, and gives its client the session’s name when the
suite serves it (checked by fetching the catalogue under that name), the suite’s own
name otherwise, where only one session at a time can run from one address.
WebTransport Rate Limiting Configuration
[server]
webtransport_max_sessions_per_origin = 4096 # max concurrent sessions per Origin header (every visitor of a page shares it)
webtransport_max_sessions_per_client = 64 # max concurrent sessions per client address (0: no limit)
webtransport_max_streams_per_session = 1000 # max concurrent streams per session
webtransport_max_datagrams_per_sec = 500 # datagram rate limit per session
QUIC Connection Migration
[server]
enable_quic_migration = true # default true; set false to disable client IP migration
Per-Route Security Policy
[[routes]]
name = "secure-api"
host = "api.example.com"
path_prefix = "/"
backend = "api"
[routes.security]
mtls_required = true # require client certificate on this route (401; 421 over HTTP/3, retried over TCP)
allowed_ja4 = ["t13d1516h2_8daaf6152771_02713d6af862"] # allowlist of known-good JA4 fingerprints
allowed_ja3 = ["0123456789abcdef0123456789abcdef"] # and of JA3 hashes (both must match where both are set)
waf_enabled = true
waf_mode = "block"
enable_0rtt = false # deny 0-RTT early data on this route
Load Balancer Configuration
# Global load balancer settings
[load_balancer]
enabled = true
default_algorithm = "least_connections" # Options: least_connections, round_robin, weighted_round_robin, random, ip_hash, least_response_time, uri_hash, url_param:<name>, header:<name>, first_available, power_of_two_choices
# Session affinity (sticky sessions) settings
[load_balancer.session_affinity]
cookie_name = "PQCPROXY_BACKEND"
cookie_ttl_secs = 3600
cookie_secure = true
cookie_httponly = true
cookie_samesite = "lax" # Options: strict, lax, none
# Request queue when all backends busy
[load_balancer.queue]
enabled = true
max_size = 1000
timeout_ms = 5000
# Slow start for recovering servers
[load_balancer.slow_start]
enabled = true
duration_secs = 30
initial_weight_percent = 10
# Connection draining for graceful removal
[load_balancer.connection_draining]
enabled = true
timeout_secs = 30
# Backend pool with multiple servers
[backend_pools.api]
name = "api"
algorithm = "least_connections"
health_aware = true
affinity = "cookie" # Options: none, cookie, ip_hash, header
health_check_path = "/health"
health_check_interval_secs = 10
# Primary server
[[backend_pools.api.servers]]
address = "127.0.0.1:3003"
weight = 100
priority = 1
max_connections = 100
timeout_ms = 30000 # Bounds the forwarded request; on expiry the client gets 504 Gateway Timeout
tls_mode = "terminate"
# Secondary server
[[backend_pools.api.servers]]
address = "127.0.0.1:3004"
weight = 100
priority = 1
max_connections = 100
# Failover server (only used when primary/secondary unavailable)
[[backend_pools.api.servers]]
address = "10.0.0.5:3003"
weight = 50
priority = 2 # Lower priority = failover only
max_connections = 50
Route to Pool: Routes can reference either single backends or backend pools:
# Route using a backend pool
[[routes]]
name = "api-route"
host = "api.example.com"
path_prefix = "/"
backend = "api" # References backend_pools.api
priority = 100
Canary / Percentage Traffic Splitting
Canary routing lets you ship a new server version to a small percentage of traffic while stable servers handle the rest. The configuration lives in a [backend_pools.NAME.canary] subsection placed before the first [[NAME.servers]] entry. Canary routing is active on all transport protocols: HTTP/1.1, HTTP/2, and HTTP/3/QUIC.
[backend_pools.api-pool]
name = "api-pool"
algorithm = "weighted_round_robin"
# Pool-level canary settings — place before [[servers]] entries
[backend_pools.api-pool.canary]
enabled = true # activate canary routing
sticky = true # keep each client on the same canary
sticky_cookie_name = "PQCPROXY_CANARY" # cookie set on first canary assignment
sticky_cookie_ttl_secs = 3600 # sticky assignment lifetime (seconds)
sticky_header = "X-Canary-Group" # optional: pre-assign group via request header
auto_rollback = true # suspend canary on high error rate
rollback_error_rate = 0.05 # error rate threshold (5 %)
rollback_window_secs = 60 # sliding window length (seconds)
rollback_min_requests = 10 # minimum requests before rollback can trigger
rollback_min_errors = 3 # minimum errors before rollback can trigger
rollback_compare_stable = true # roll back only when the canary fails more than the stable servers
rollback_ignored_statuses = [] # 5xx statuses that are not the canary's errors, e.g. [501]
ramp_percent = [5, 25, 50] # a rollout's steps (admin API `canary` without a weight)
ramp_step_secs = 120 # each step lasts at least this long
ramp_min_requests = 10 # and until the canary has answered this many in it
auto_promote = true # promote when the last step holds; the replaced members drain
cohort = "ip" # each client keeps its side: "random" (default), "ip", "header:<name>"
# Canary server — mark with canary = true, set canary_weight_percent
[[backend_pools.api-pool.servers]]
address = "127.0.0.1:3005"
canary = true # designate as canary
canary_weight_percent = 5 # route 5 % of new traffic here
weight = 100
priority = 1
max_connections = 100
timeout_ms = 30000
tls_mode = "terminate"
# Stable server — receives remaining 95 % of traffic
[[backend_pools.api-pool.servers]]
address = "127.0.0.1:3003"
weight = 100
priority = 1
max_connections = 100
timeout_ms = 30000
tls_mode = "terminate"
How it works:
- A request arrives. If it carries a
PQCPROXY_CANARYcookie matching a live canary server, it is routed there (sticky assignment). - Otherwise, each canary with a free place takes its own
canary_weight_percentof new requests (5 and 50 send 5 % to one, 50 % to the other and 45 % to the stable servers; shares over 100 % divide all the traffic). The request gets aSet-Cookieheader for future stickiness. - If
auto_rollback = true, the canary is suspended and all traffic falls back to stable servers when, within the rolling window, it has servedrollback_min_requests, hadrollback_min_errorserrors, and its error rate exceedsrollback_error_rateand the stable servers’ rate by more than that. An error is a failed backend exchange, a 5xx response or a response body that fails part-way.
Rollouts. A member becomes the canary at run time, a configured stable one included, through POST /pools/{pool}/servers/{id}/canary: with {"weight": n} it takes that share; with no body it steps through ramp_percent, each step held for ramp_step_secs and until it has answered ramp_min_requests. A rollback ends the rollout; at the last step the canary is promoted (auto_promote) or waits for POST /pools/{pool}/servers/{id}/promote. Promotion makes it a stable member and drains the members it was compared with, the version it replaces. So a blue/green deployment is two members, one running: start the new version on the other’s address, make it the canary, and stop the old one when the rollout is promoted (or the new one when it is rolled back). A rollout outlives a config reload that keeps its canary.
Live admin control (all endpoints require Bearer token auth):
GET /canary — every pool's canaries and its rollout
POST /canary/suspend/:server_id — suspend a canary immediately
POST /canary/resume/:server_id — re-enable a suspended canary (resets error window)
POST /canary/weight/:server_id — adjust weight at runtime
body: {"percent": 10}
POST /pools/:pool/servers/:id/canary — make a member the canary: {"weight": n}, or no body for the ramp
POST /pools/:pool/servers/:id/promote — promote the canary; the members it replaces drain
Example:
pqcrypta-proxy --config /etc/pqcrypta/proxy-config.toml --admin GET /canary
# {"pools":[{"pool":"api-pool","canary_enabled":true,...,"ramp_percent":[5,25,50],
# "servers":[{"id":"127.0.0.1:3005","canary_weight_percent":25,"suspended":false,
# "error_rate":0.0,"window_requests":41,"window_errors":0,...}],
# "rollout":{"server":"127.0.0.1:3005","outcome":"ramping","step":2,"steps":[5,25,50],...}}]}
Traffic Shadowing / Mirroring
Add a [routes.shadow] subsection to any route to mirror traffic to a secondary backend. The client only receives the primary response; the shadow response is logged and discarded. All values are configurable — nothing is hardcoded. Shadow mirroring is active on all transport protocols: HTTP/1.1, HTTP/2, and HTTP/3/QUIC.
[[routes]]
name = "api-route"
host = "api.example.com"
backend = "api-stable"
# Mirror 10 % of traffic to a canary instance for dark testing
[routes.shadow]
backend = "api-canary" # Must be a key in [backends.*]
percent = 10 # 0–100 % of requests to mirror (default 100)
timeout_ms = 5000 # Abandon shadow after this many ms (default 5000)
shadow_header = "X-Shadow-Request" # Header injected on shadow requests (default)
shadow_header_value = "1" # Value for that header (default "1")
log_responses = true # Log shadow status + latency at INFO (default true)
How it works:
- Request arrives → body is buffered (only when shadow is configured).
- A
tokio::task::spawnfires the shadow copy asynchronously — the primary forward proceeds in parallel. - The primary response is returned to the client immediately; the spawned task runs independently.
- The shadow backend receives an identical request with the configurable marker header appended so it can distinguish mirror traffic.
- Shadow errors, timeouts, and 5xx responses are logged as warnings but never affect the client.
Activating on the running config:
- Add a
[backends.api-canary]entry pointing at the canary instance (e.g.127.0.0.1:3004). - Add the
[routes.shadow]block to the desired route in/etc/pqcrypta/proxy-config.toml. - Reload config:
curl -s -X POST http://127.0.0.1:8081/reload -H "Authorization: Bearer $TOKEN".
Response Cache Configuration
The proxy includes an RFC 9111-compliant HTTP response cache. It is disabled by default — add a [cache] section to opt in. The cache stores raw backend response bodies (pre-compression); all outer middleware layers (security headers, Alt-Svc, Brotli/gzip) run on every served response, including cache hits.
What is cached: GET and HEAD responses with a cacheable status code (200, 203, 204, 206, 300, 301, 410) that carry Cache-Control: public or no Cache-Control directive. Responses with Cache-Control: no-store, private, no-cache, or Vary: * are never stored. Responses that set cookies are skipped by default.
Conditional request support: ETag / If-None-Match (strong and weak) and Last-Modified / If-Modified-Since — the cache returns 304 Not Modified and avoids body transfer when content is unchanged.
[cache]
enabled = true # default false — must opt in
max_size_mb = 128 # total cache size cap in MiB
default_ttl_secs = 60 # TTL when backend sends no Cache-Control max-age
max_body_size_bytes = 2097152 # responses larger than ~2 MiB are forwarded but not stored
no_cache_set_cookie = true # skip caching responses that set cookies
# Path prefixes that bypass the cache entirely
excluded_paths = ["/api/", "/ws", "/stream", "/auth", "/admin"]
# Exact hostnames (or subdomain suffixes) whose responses are never cached.
# Use this for API subdomains whose backends omit Cache-Control: no-store.
excluded_hosts = ["api.example.com"]
The cache layer is placed as the innermost Axum layer so security headers and compression always apply regardless of whether the response came from the cache or the backend.
TLS Modes
1. TLS Terminate (Default)
Decrypt TLS at proxy, plain HTTP to backend.
[backends.apache]
name = "apache"
type = "http1"
address = "127.0.0.1:8080"
tls_mode = "terminate" # Default - can be omitted
2. TLS Re-encrypt
Decrypt at proxy, re-encrypt to backend via HTTPS.
[backends.internal-api]
name = "internal-api"
type = "http1"
address = "internal.example.com:443"
tls_mode = "reencrypt"
tls_cert = "/path/to/ca.pem" # Optional: private CA, or the backend's own self-signed cert
tls_client_cert = "/path/to/client.pem" # Optional: mTLS client cert
tls_client_key = "/path/to/client.key" # Optional: mTLS client key
tls_sni = "internal.example.com" # Optional: custom SNI
3. TLS Passthrough (SNI Routing)
A connection whose ClientHello names a passthrough route is relayed to its
backend still encrypted, by the HTTPS listener that accepted it, on the same
port: after the connection limits and the block list, with the whole
ClientHello peeked within tls.handshake_timeout_secs (a post-quantum
ClientHello spans more than one segment). The backend receives the ClientHello
as the client sent it. A relay ends when either side does, after
server.max_idle_timeout_secs with nothing moving either way, or at shutdown;
open relays are counted in pqcrypta_connections_open_by_protocol. Routes are
taken again on every reload.
[[passthrough_routes]]
name = "external-service"
sni = "external.example.com" # Supports wildcards: *.example.com
backend = "10.0.0.5:443"
proxy_protocol = false # Optional: PROXY protocol v2
timeout_ms = 30000
Security Headers
[headers]
hsts = "max-age=63072000; includeSubDomains; preload"
x_frame_options = "DENY"
x_content_type_options = "nosniff"
referrer_policy = "strict-origin-when-cross-origin"
permissions_policy = "camera=(), microphone=(), geolocation=()"
cross_origin_opener_policy = "same-origin"
cross_origin_embedder_policy = "require-corp"
cross_origin_resource_policy = "same-origin"
# Custom branding headers
x_quantum_resistant = "ML-KEM-1024, ML-DSA-87, X25519MLKEM768"
x_security_level = "Post-Quantum Ready"
This set is applied by the same rules on HTTP/1.1, HTTP/2 and HTTP/3, and on
cache hits as well as origin responses: one ResponseHeaderSet, which the TCP
listener applies in an Axum layer and the HTTP/3 listener in
apply_response_policy_headers. Most headers replace whatever the backend
sent. The origin’s own value wins for three cross-origin policies
(Cross-Origin-Opener-Policy, -Embedder-Policy, -Resource-Policy) and for
content_security_policy. The configured value is used only when the backend
sent none, so a page can make itself cross-origin isolated, and a CSP carrying
per-request script nonces passes untouched.
A route’s own decisions stand over all of it, on every transport. Its
headers_override values replace the backend’s value and the global one,
whatever the header (an x-frame-options override included). The headers in
its remove_headers stay removed, and stripe_compatibility sends no COOP or
COEP at all. A header the route removes and also overrides goes out with the
override.
HTTP/3 forwards the backend’s response headers as HTTP/1.1 and HTTP/2 do, every
one but the hop-by-hop headers. It used to forward only an allowlist. That
dropped any header not on it, such as a page’s cross-origin policies, Link,
Retry-After and WWW-Authenticate. It also added the security headers on top
of the backend’s and the route’s instead of replacing them, so a route with its
own policies (Grafana) answered over HTTP/3 with two contradictory values of
each, which a browser treats as none.
Every value is optional: an empty string omits that header on every
transport. accept_ch, nel, report_to and priority are empty unless set,
and the Outlook add-in exception (addin_hosts, addin_path_prefix,
addin_csp) is off unless all three are configured. server_timing_enabled
adds a Server-Timing metric whose description is server_timing_desc. The set
is validated once at startup; a value that is not a legal header value is
logged and omitted.
headers_override on a route takes literal header names
(cross-origin-embedder-policy), not the snake_case keys of this section. The
proxy refuses to load a route that spells a managed header the [headers] way,
because that sends a header of the literal name, which no browser reads, while the
real policy stays in force.
Pay only for what you enable
The TCP middleware chain is assembled once at startup, and a layer whose
feature is off is left out, not skipped per request: response cache,
security headers (when every value is empty and Server-Timing is off), Alt-Svc
(when nothing is advertised and tcp_only_hosts is empty), compression, the
HTTP/3-features layer (priority hints off), the advanced
rate limiter, and trace-context extraction (when OTel is off and INFO spans are
filtered out). The startup log names every layer left out. The security
evaluator always runs; it carries the request-size, header-size and blocklist
enforcement that has no switch of its own. The chain is not rebuilt on a hot
reload, so enabling one of these needs a restart.
Response Compression
[compression]
enabled = true # default
min_size = 1024 # bytes; smaller responses are sent as-is
brotli_quality = 4
zstd_level = 3
gzip_level = 6
compress_types = ["text/html", "text/css", "application/json"] # exact MIME type; charset etc. ignored
Applies to HTTP/1.1 and HTTP/2 responses. Before this section existed the compression settings were fixed in code and could not be changed or turned off.
The coding is the one the client weighs highest in Accept-Encoding, and
among codings it weighs the same (browsers weigh them all the same) the
proxy’s preference: brotli, zstd, gzip, deflate. q=0 refuses a coding
however it is spelled, and * stands for those not named. Not compressed:
a response the origin marked Cache-Control: no-transform, and the response
to a request that carries credentials (a cookie, Authorization) and that
the browser says another site made (Sec-Fetch-Site: cross-site). That page
chooses part of what such a response reflects and can see its length, which,
compressed, tells it how much of a guess matched a secret beside it (BREACH).
CORS Configuration
[[routes]]
name = "api-cors"
host = "api.example.com"
path_prefix = "/"
backend = "api"
[routes.cors]
allow_origin = "https://example.com" # must be a specific origin when allow_credentials = true
allow_methods = ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
allow_headers = ["Content-Type", "Authorization", "X-API-Key"]
allow_credentials = true
max_age = 86400
Backend cookies
[[routes]]
name = "app"
path_prefix = "/app"
backend = "app"
enforce_cookie_security = true # add HttpOnly and Secure where the backend omitted them
set_cookie_domain = "example.com" # add Domain where the backend omitted it
Both apply to every backend Set-Cookie on HTTP/1.1, HTTP/2 and HTTP/3,
streamed (SSE) or buffered, and attributes are matched by name, so a cookie
named securetoken is not mistaken for one carrying Secure.
Configuration validation rejects
allow_origin = "*"combined withallow_credentials = trueat startup (RFC 6454 / CORS spec). All modern browsers refuse this combination; the proxy enforces it at load time rather than producing confusing runtime failures. Use a specific origin string when credentials are required.
See config/example-config.toml for full documentation.
CLI Arguments
QUIC/HTTP/3/WebTransport reverse proxy with hybrid post-quantum TLS
Usage: pqcrypta-proxy [OPTIONS]
Options:
-c, --config <CONFIG> Configuration file path [env: PQCRYPTA_CONFIG=] [default: /etc/pqcrypta/config.toml]
--udp-port <UDP_PORT> Override UDP port for QUIC listener [env: PQCRYPTA_UDP_PORT=]
--admin-port <ADMIN_PORT> Override admin API port [env: PQCRYPTA_ADMIN_PORT=]
--log-level <LOG_LEVEL> Log level (trace, debug, info, warn, error). Unset falls back to `[logging] level` in the config file, then "info" [env: PQCRYPTA_LOG_LEVEL=]
--json-logs [<JSON_LOGS>] Enable JSON log format (`--json-logs`, or `--json-logs=false` to force text). Unset falls back to `[logging] format` in the config file, then text [env: PQCRYPTA_JSON_LOGS=] [possible values: true, false]
--no-pqc Disable PQC hybrid key exchange
--watch-config [<WATCH_CONFIG>] Watch the configuration file and reload it when it changes (on unless `--watch-config=false`) [env: PQCRYPTA_WATCH_CONFIG=] [default: true] [possible values: true, false]
--env <ENV> Environment name for per-env config overlay. When set, loads <config-dir>/<config-stem>.<env>.toml and merges it over the base config. Example: --env prod loads /etc/pqcrypta/config.prod.toml [env: PQCRYPTA_ENV=]
--validate Run configuration validation only (don't start server)
--socket-unit <FILE> Write the systemd socket unit for this configuration's listeners (pqcrypta-proxy.socket) to FILE and exit: with it, the service manager holds the listening sockets across a restart. A file, not standard output, which the proxy's own log may share
--test-certificates <DIR> Write self-signed certificates for testing into DIR and exit: for each host the routes name and localhost, an ECDSA P-256 certificate and an ML-DSA-87 companion, in the certificate directory's layout. No client trusts them; a file already there is never replaced
--merge-fingerprints <OUT> Merge fingerprint corpora into one and write it here: observed.json of either version, or a published directory's full.json (`--from`)
--from <FILE> A corpus or directory to merge (`--merge-fingerprints`); repeatable
--admin <METHOD> <PATH> Send one request to this node's admin API with the credentials its configuration's `[admin]` names, and no other section's (the token, and the HMAC proof of possession where `[admin] hmac_secret` is set), print the response body and exit, 1 unless it succeeded: `--admin POST /reload`
--admin-body <JSON> The JSON body of an `--admin` request
--moq-token <PREFIX> Print a Media over QUIC publish token for a Track Namespace prefix, in the serialized form of draft-ietf-moq-transport section 8.8 (`music-radio`; "" for every namespace), signed with `[moq] publish_key`, and exit
--moq-token-days <DAYS> Days a `--moq-token` is valid [default: 30]
-h, --help Print help
-V, --version Print version
The block is pqcrypta-proxy --help (a test holds it to that). An option on the command line wins over its environment variable, which wins over the configuration file’s setting where there is one ([logging] level and format for --log-level and --json-logs), which wins over the built-in default.
PQCRYPTA_ENV (or --env) names the environment overlay merged over the configuration (see Environment Config Overlay). No setting is relaxed by it: backend certificates are verified in every environment.
Architecture
┌──────────────────────────────────────────────────────────┐
│ PQCrypta Proxy │
│ │
Client ──────────►│ Port 80 ─► HTTP Redirect Server ─► HTTPS (301/308) │
(Browser/App) │ │
│ Port 443 ─► TLS Termination ─► Reverse Proxy │
│ │ │ │
│ │ ├─► HTTP/1.1, HTTP/2 (TCP) │
│ │ ├─► HTTP/3 (QUIC/UDP) │
│ │ └─► WebTransport Sessions │
│ │ │
│ └─► TLS Passthrough ─► SNI Routing (no decrypt) │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Security Middleware Stack │ │
│ │ JA3/JA4 → Rate Limit → GeoIP → Circuit Breaker │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ HTTP/3 Features Middleware │ │
│ │ Early Hints → Priority → Compression │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Route Engine │ │
│ │ - Domain matching (api.example.com vs example.com) │ │
│ │ - Path matching (prefix, exact, regex) │ │
│ │ - CORS handling │ │
│ │ - Redirect rules │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Load Balancer │ │
│ │ Algorithms: least_conn | round_robin | weighted │ │
│ │ random | ip_hash | least_response_time │ │
│ │ uri_hash | url_param | header │ │
│ │ first_available | power_of_two_choices │ │
│ │ Features: Session affinity, Health-aware routing │ │
│ │ Slow start, Connection draining │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Backend Pools │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ TLS │ │ TLS │ │ TLS │ │ │
│ │ │ Terminate │ │ Re-encrypt │ │ Passthrough │ │ │
│ │ │ (HTTP) │ │ (HTTPS) │ │ (SNI) │ │ │
│ │ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │ │
│ └─────────┼────────────────┼────────────────┼─────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ Pool: Apache Pool: API Pool: External │
│ ┌────┬────┬────┐ ┌────┬────┬────┐ ┌────┬────┐ │
│ │ S1 │ S2 │ S3 │ │ S1 │ S2 │ S3 │ │ S1 │ S2 │ │
│ └────┴────┴────┘ └────┴────┴────┘ └────┴────┘ │
│ │
│ Admin API (optional; loopback HTTP, 8081 by default) │
│ /health, /metrics, /reload, /shutdown │
└──────────────────────────────────────────────────────────┘
Module Structure
src/
├── main.rs # PQCrypta Proxy - QUIC/HTTP3/WebTransport Proxy with Hybrid PQC TLS
├── lib.rs # PQCrypta Proxy - QUIC/HTTP3/WebTransport Proxy with Hybrid PQC TLS
├── access_logger.rs # Access Logger for PQCrypta Proxy
├── acme.rs # ACME (Automated Certificate Management Environment) Client
├── acme_dns.rs # DNS-based ACME challenges
├── admin.rs # Admin HTTP API for health, metrics, config reload, and graceful shutdown
├── admin_client.rs # `--admin METHOD PATH`: a request to this node's admin API with its token, signed where hmac_secret is set
├── audit_logger.rs # Structured audit logging for security-relevant events
├── backend_client.rs # Connections to backends
├── backend_limits.rs # How many requests each backend has in flight at once, for the whole process
├── bin/ # The tools built beside the proxy: ech-check, ech-keygen, h3-conformance, h3-get
├── body_budget.rs # The memory request bodies may occupy while the proxy holds them
├── bounded.rs # Ceilings for the tables a request can add to
├── cache.rs # HTTP response cache (RFC 9111)
├── cert_compression.rs # RFC 8879 certificate compression policy
├── challenge.rs # A proof-of-work challenge in place of a heuristic block ([security.challenge])
├── challenge/ # The challenge page's script, worker, stylesheet and icon, served by the proxy
├── client_hello.rs # A peeked ClientHello's extensions, which route a TCP connection to the TLS stack that can serve it
├── compression.rs # Response compression middleware
├── config.rs # Configuration module with TOML parsing and hot-reload support
├── conformance/ # HTTP/3 and QUIC **client** conformance suite
├── conn_limits.rs # What every listener holds a client connection to
├── connect_udp.rs # MASQUE CONNECT-UDP proxying (RFC 9298)
├── crawler_verify.rs # Verified search-engine crawler detection
├── data_file.rs # Data files the proxy reads at run time (the GeoLite2 databases, the JA3/JA4 fingerprint …
├── dns_wire.rs # The DNS message format (RFC 1035 §4), as far as the proxy reads and writes it
├── doh.rs # DNS over HTTPS (RFC 8484) for the authoritative name server on this host
├── doq.rs # DNS over QUIC (RFC 9250) on the QUIC listener, beside HTTP/3
├── moq/ # Media over QUIC relay (draft-ietf-moq-transport 23 and 22) and its upstream link: docs/MOQ.md
├── early_data.rs # TLS 1.3 early data (0-RTT) on the TCP listeners
├── ech_config.rs # Loads Encrypted Client Hello (ECH, draft-ietf-tls-esni-25) server configurations from disk
├── error_chain.rs # An error with every cause under it, for log lines (a failed fetch says why)
├── fingerprint.rs # TLS Fingerprinting Module
├── fingerprint_corpus.rs # The observed TLS fingerprint corpus
├── fuzz_support.rs # Mutation fuzzing for the parsers that read raw client bytes
├── fuzzing.rs # Entry points for the coverage-guided fuzz targets in fuzz/ (built under cfg(fuzzing))
├── health.rs # Backend health probes on each backend's interval; what the admin API reports
├── host_names.rs # Host names in security.pentest_bypass_ips and the [masque] client lists
├── http3_features.rs # HTTP/3 Advanced Features Module
├── http_listener/ # HTTP/1.1 and HTTP/2 reverse proxy with TLS termination, re-encryption, and passthrough
├── inherited.rs # Listening sockets the service manager opened for this process
├── load_balancer.rs # Load balancer module for backend pool management
├── log_file.rs # Size-based rotating file writer for the tracing subscriber
├── memory_pressure.rs # The proxy's own memory, as its cgroup accounts it, and what the proxy gives up when that runs …
├── metrics.rs # Prometheus metrics for the proxy
├── ocsp.rs # OCSP stapling (RFC 6960, RFC 6066 section 8, RFC 8446 section 4.4.2.1)
├── openssl_alloc.rs # OpenSSL's memory, from the proxy's own allocator
├── otel.rs # OpenTelemetry distributed tracing integration
├── path_canon.rs # The request path every listener routes and forwards on
├── path_loss.rs # Real packet loss on one peer's path, at the socket
├── pqc_extended.rs # Extended Post-Quantum Cryptography Support
├── pqc_policy.rs # What a classical key exchange means to this server (pqc.downgrade_action)
├── pqc_tickets.rs # ML-KEM-1024 protected TLS session tickets (tls.pqc_session_tickets)
├── pqc_tls.rs # Post-Quantum Cryptography TLS Provider
├── provider_kx.rs # Key-exchange groups the linked OpenSSL's providers carry and rustls does not
├── proxy.rs # Backend proxy module
├── quic_listener/ # QUIC/HTTP3/WebTransport listener
├── rate_limiter.rs # Advanced Multi-Dimensional Rate Limiting Module
├── recv_low_water.rs # A socket's receive low-water mark (SO_RCVLOWAT)
├── request_encoding.rs # A request body's content coding (RFC 9110 section 8.4), decoded here
├── request_id.rs # Request IDs
├── request_target.rs # The host a request names, resolved one way for every layer and transport
├── route_gate.rs # Per-route request gates, applied identically on every transport
├── secret_source.rs # Secret settings named by systemd credential or file rather than written in the configuration
├── security.rs # Security middleware module
├── service_notify.rs # The service manager's notification protocol (sd_notify(3))
├── speedtest.rs # Native speed test session handler for WebTransport connections on /speedtest
├── speedtest_budget.rs # What one client may take of the speed test
├── speedtest_meter.rs # Server-side meter for speed-test uploads, shared by every transport
├── staged_file.rs # Files written beside their destination and renamed in place; private ones mode 0600 from creation
├── startup_verify.rs # Startup verification of the cryptographic runtime
├── telemetry.rs # WebTransport Telemetry Wall — native handler for the /telemetry path
├── test_certificate.rs # Self-signed ECDSA and ML-DSA-87 certificates for testing (--test-certificates)
├── tls.rs # TLS configuration with Post-Quantum Cryptography (PQC) support
├── tls_acceptor.rs # Custom TLS Acceptor with ClientHello Capture
├── traffic_shape.rs # Requests by country and declared body size, exported for baselining
├── waf.rs # Web Application Firewall (WAF) module
├── waf_crs.rs # The OWASP Core Rule Set beside the native WAF rules ([waf.crs])
├── webtransport_server.rs # The dedicated WebTransport server, on webtransport_port, with ALPN negotiation
├── ws_tunnel.rs # WebSocket tunnels to a backend, for every transport a client may use
├── wt_flow.rs # A WebTransport session's flow control and its CONNECT stream's capsules (draft 17)
└── wt_session.rs # One WebTransport session, whichever listener accepted it
Post-Quantum Cryptography
PQCrypta Proxy supports hybrid PQC key exchange using rustls-post-quantum (X25519MLKEM768).
Supported KEMs
| Algorithm | Security Level | Description |
|---|---|---|
X25519MLKEM768 | NIST Level 3 | Hybrid X25519 + ML-KEM-768 — recommended default (FIPS 203) |
SecP256r1MLKEM768 | NIST Level 3 | Hybrid P-256 + ML-KEM-768 (FIPS 203) |
SecP384r1MLKEM1024 | NIST Level 5 | Hybrid P-384 + ML-KEM-1024 (FIPS 203) |
curveSM2MLKEM768 | NIST Level 3 | Hybrid curveSM2 + ML-KEM-768 (draft-yang-tls-hybrid-sm2-mlkem, 0x11EE): rustls through the vendored fork’s sm2 feature, OpenSSL from 4.0. Interoperates with OpenSSL 4.0.3 in both directions (examples/kx-interop.rs) |
X448MLKEM1024 | NIST Level 5 | Hybrid X448 + ML-KEM-1024 (FIPS 203) |
mlkem512 | NIST Level 1 | Pure ML-KEM-512 (FIPS 203) |
mlkem768 | NIST Level 3 | Pure ML-KEM-768 (FIPS 203) |
mlkem1024 | NIST Level 5 | Pure ML-KEM-1024 (FIPS 203) |
kyber768 ⚠️ | NIST Level 3 | Deprecated — pre-NIST round-3 draft, not FIPS 203. Requires --features legacy-pqc at build time. Not interoperable with ML-KEM peers. Do not use for new deployments. |
x25519_kyber768 ⚠️ | NIST Level 3 | Deprecated — pre-NIST round-3 draft hybrid, not FIPS 203. Requires --features legacy-pqc at build time. |
Only FIPS 203-compliant algorithms are built by default.
kyber768andx25519_kyber768(pre-standardisation Kyber drafts) are excluded from all default builds. To enable them only for backward-compatible migration periods, compile withcargo build --release --features legacy-pqc. A deprecation warning is logged at startup whenever a legacy algorithm is selected.
ML-DSA-87 Server Certificates (FIPS 204)
With the default pqc-signatures feature, the SNI certificate resolver serves ML-DSA-87-signed X.509 certificates for domains whose key file contains an ML-DSA-87 PKCS#8 private key (OID 2.16.840.1.101.3.4.3.19). Drop {domain}.crt (full PQ chain) and {domain}.key into the certs directory alongside the classical pairs — detection is automatic per domain, on the same TCP :443 and QUIC listeners.
- The TLS 1.3
CertificateVerifyis signed with ML-DSA-87 (TLS signature schememldsa87, codepoint0x0906) via aws-lc-rs - All three PKCS#8 CHOICE encodings from draft-ietf-lamps-dilithium-certificates are accepted:
seed [0],expandedKey, and the seed+expandedbothform OpenSSL 3.5 writes - Clients that do not offer
mldsa87insignature_algorithmsare refused (no silent classical fallback on that SNI) - Combined with
-groups X25519MLKEM768this yields a fully post-quantum handshake: PQ key exchange + PQ certificate signature
# Connect with OpenSSL 3.5+
openssl s_client -connect pqc.pqcrypta.com:443 -sigalgs mldsa87 \
-groups X25519MLKEM768 -CAfile root-ca.crt
Delegated Credentials (RFC 9345)
A delegated credential is a short-lived key that a certificate’s own key has signed for: the handshake is signed with it, so the certificate’s key can stay offline and a compromised credential expires within a day. The SNI certificate resolver mints them for any certificate that allows delegation, one with the DelegationUsage extension (1.3.6.1.4.1.44363.44) and the digitalSignature key usage, which clients require before they accept one.
- Three per certificate, in the order a handshake prefers them: ML-DSA-87 (CNSA 2.0) and ML-DSA-65, unless
pqc.enable_signaturesis off, then ECDSA P-256. A client gets the first whose scheme it lists in itsdelegated_credentialextension and whose signature it can verify (the certificate signed it with a scheme in the client’ssignature_algorithms); every other client gets the certificate’s own signature - Each is valid for 24 hours and replaced after six, so none is served with less than 18 hours left. The delegated keys are generated in memory and never written anywhere
- The credential rides on the end-entity entry of
Certificate, and the delegated key signsCertificateVerifyunder the scheme the credential names. TLS 1.3 only, as RFC 9345 requires; served wherever rustls terminates TLS, which is QUIC (HTTP/3) here. The OpenSSL TCP listener does not implement them - The vendored rustls implements the extension on both sides:
DelegatedCredential::delegatesigns a credential (RFC 9345 §4), the server sends one only to a client that offered it, and its client aborts withunexpected_messageon one it never asked for (§4.1.1)
No public CA issues the DelegationUsage extension, so scripts/delegated-credential-cert.sh issues the certificate from a private CA for a test host (delegated-credential.conformance.pqcrypta.com) and renews it weekly through delegated-credential-cert.timer; the proxy picks it up on its TLS reload and mints the credentials itself. The unit runs it as the proxy’s account, which keeps its own certificates, with the private CA in the unit’s state directory (/var/lib/pqcrypta-delegation-ca), the file system otherwise read-only and only the admin API on loopback reachable.
cp scripts/delegated-credential-cert.sh /usr/local/bin/pqcrypta-delegated-credential-cert
cp scripts/delegated-credential-cert.{service,timer} /etc/systemd/system/
systemctl enable --now delegated-credential-cert.timer
Configuration
[pqc]
enabled = true
provider = "auto" # OpenSSL on TCP; ECH offers, and hellos OpenSSL would refuse for their signature_algorithms_cert, to rustls; "rustls" or "openssl" picks one
preferred_kem = "X25519MLKEM768"
fallback_to_classical = true # offer P-384, P-256, X25519 so non-ML-KEM clients can connect
require_pqc_provider = true # refuse to start if our own PQC provider is broken
experimental_groups = ["frodo1344shake", "hqc5"] # OQS provider groups, TCP and QUIC
These two were one flag until they were split, and the split matters because they answer different questions.
These settings shape the groups on every listener, TCP and QUIC alike. With PQC enabled the offer is every hybrid the TLS stack implements — X25519MLKEM768, SecP256r1MLKEM768 and SecP384r1MLKEM1024 on both OpenSSL and rustls (the last added to the vendored rustls), and curveSM2MLKEM768 on rustls and on OpenSSL 4.0 or later — with preferred_kem first. The OpenSSL list is checked name by name against the linked library, and a KEM with no TLS group codepoint (X448MLKEM1024 in OpenSSL 3.5) is left out rather than failing the list. A pure ML-KEM group is offered only when preferred_kem names it, and never under require_hybrid. The classical fallback is one tuple, P-384, P-256 and X25519, on every listener: a classical client’s own key share is used, so a client with no ML-KEM (Safari 18 and earlier) completes in one round trip, and one that sent no share the server accepts is asked for P-384. RFC 8446 §9.1 has every TLS 1.3 implementation support P-256 (MUST) and X25519 (SHOULD); QUIC stacks such as picotls offer nothing classical but P-256. With pqc.enabled = false only the classical groups are offered.
experimental_groups names key-exchange groups that a loaded OpenSSL provider adds and IANA has not assigned — the OQS provider’s FrodoKEM, HQC and the like, by their OpenSSL names. Every listener offers them in a tuple of their own, after the standard ML-KEM tuples and before the classical fallback: a client that offers ML-KEM still gets ML-KEM, and one that offers only these and a classical group gets post-quantum. No browser offers them, so nothing changes for visitors; an OQS client, or a scanner that asks group by group, sees them. OpenSSL negotiates them on TCP. Over QUIC, rustls takes them from the same providers: provider_kx lists the groups each loaded provider advertises in its TLS-GROUP capabilities, and a handshake that selects one encapsulates to the client’s key share with that provider’s KEM through OpenSSL’s EVP_PKEY encapsulation API, so both transports take the same groups in the same order. Each name is checked against the loaded providers like the rest; under require_hybrid only the hybrids (named for their classical half, p384_frodo976shake) are offered, on both transports, from the one selection both listeners make, and min_security_level does not apply. Standard and classical names are refused at startup, since they have their own settings and their own place in the order. pqcrypta.com offers FrodoKEM-1344 and FrodoKEM-976 (SHAKE), the conservative LWE KEMs its own engines implement, and HQC-256 and HQC-192 (hqc5, hqc3), the code-based KEM NIST selected in 2025, which its hqc-128/192/256 engines implement: each level’s FrodoKEM, then its HQC. HQC comes from liboqs 0.16, whose implementation is the official one of the 2025-08-22 specification, not the PQClean code CVE-2025-48946 concerned.
Until 2026-09-24 the OpenSSL listener logged the group list these settings produced and applied a fixed X25519MLKEM768:P-384, and the QUIC listener ignored them — so preferred_kem, require_hybrid and fallback_to_classical did nothing, and pqc.enabled = false still negotiated the hybrid on HTTP/3.
fallback_to_classical is client compatibility: whether the classical fallback is offered alongside the hybrid PQC groups. With it off, a client with no ML-KEM support cannot complete a handshake at all — on this deployment that measurably includes curl built against quictls, third-party uptime monitoring and several crawlers, all of which reach the site today over P-384. It is a live lockout, not a posture setting. require_hybrid = true states the same lockout deliberately.
require_pqc_provider is our own posture: what happens when PQC is enabled and its provider cannot be used. It defaults to refusing to start. Previously the only way to fail closed here was to turn off fallback_to_classical, which also cut off every non-PQC client — so the safe choice carried a price nobody wanted to pay, and the unsafe one was the default.
Whichever setting removes the classical group, the proxy now logs a warning saying so. It used to warn for require_hybrid and stay silent for fallback_to_classical = false, so the more obscure route to a client lockout was also the quieter one.
Important: PQC support is read from the OpenSSL the proxy links, not from a binary: at startup it asks that library for its version and offers each post-quantum group to a scratch context, the call the listeners make, so the answer is about the library that serves the handshakes. With
require_pqc_provider = true(the default) a library without ML-KEM stops startup; with it false the proxy falls back to a standard rustls listener that accepts TLS 1.2 and does not negotiate X25519MLKEM768. It used to run anopensslbinary named byopenssl_pathandopenssl_lib_path,/usr/local/openssl-3.5by default, which spoke for that build rather than the linked one, and a host without the path refused to start under the defaultrequire_pqc_providerunless it named its own. Both settings are gone; a configuration that still sets them is told they are ignored.
OpenSSL 4.0. The deployment’s TCP listener links OpenSSL 4.0.3, with
liboqs 0.16.0 and oqs-provider 0.12.0 for the FrodoKEM and HQC groups, from its
own prefix, /usr/local/openssl-4.0.3. 4.0 is what adds curveSM2MLKEM768 to
TCP (QUIC has it through the vendored rustls). 4.0’s library soname is
libssl.so.4, so the binary carries the prefix as DT_RPATH
(RUSTFLAGS="-C link-arg=-Wl,--disable-new-dtags,-rpath,/usr/local/openssl-4.0.3/lib64"
with OPENSSL_DIR pointing at the prefix) and loads it whatever
LD_LIBRARY_PATH says. That leaves the system’s OpenSSL 3, and everything
else linked against it, as it was. The openssl crate has to be 0.10.81 or
later: 4.0 made many X509 functions take and return const pointers, and older
releases do not compile against it.
ACME Certificate Automation
Automatic Let’s Encrypt certificate provisioning and renewal. Issues one individual certificate per domain — each domain gets its own {domain}.crt / {domain}.key pair written atomically (write-to-.tmp-then-rename) to prevent corruption on concurrent renewal. With use_ecdsa, keys are ECDSA P-384 by default (ecdsa_curve = "P-256" for smaller certificates).
SNI-based cert selection is handled by MultiDomainCertResolver (rustls/QUIC) and create_pqc_acceptor_with_sni (OpenSSL/TCP), both loading all cert pairs from the certs directory at startup and on every ACME renewal. A server name gets its own certificate, or the wildcard one that covers it (*.example.com.crt for a.example.com): the wildcard is the whole left-most label and stands for exactly one label (RFC 9525 §6.3).
Certificates for IP addresses
A domain’s certificate can also name IP addresses (ip_addresses, RFC 8738 identifiers): the order carries them beside the domain, under the CA’s profile for addresses (ip_profile; Let’s Encrypt issues them only under shortlived, 160-hour certificates), and the HTTP-01 challenge is answered on port 80 of each address. A client that connects by address sends no server name (RFC 6066 has no form for one) and verifies the certificate against the address it dialled (RFC 9525 §6.4); both TLS stacks give such a ClientHello the certificate that names the host’s addresses, and fall back to tls.cert_path where none does. A ClientHello whose server name is an address, bare or bracketed, is answered the same way: RFC 6066 allows none there, but GnuTLS clients such as kdig send one, and rustls (the QUIC listener) ignores it. A name server’s DNS over HTTPS reached by its IP — as dnspython’s dns.query.https() reaches it, verifying the address — is the case this exists for: with a certificate naming only ns1.example.com, that client aborts the handshake.
How It Works
- Each check reads each domain’s cert file, and asks the CA for its suggested renewal window (ARI, RFC 9773: one unauthenticated GET, repeated only after the CA’s Retry-After)
- Renewal triggers per-domain at a point in that window (a hash of the serial picks it, so certificates spread over the window); without ARI,
renewal_daysbefore expiry or a third of the lifetime before, whichever is less (~day 60 of a 90-day cert, ~hour 107 of a 160-hour one). A certificate whose names or addresses differ from the configuration is reissued at once - ACME protocol runs only during actual renewal; the order names the certificate it
replaces(RFC 9773 §5), which Let’s Encrypt exempts from its rate limits. The next check comes atcheck_interval_hours, or sooner when a renewal falls due first - HTTP-01 challenges served on port 80 before HTTPS redirect kicks in
- Exponential backoff on challenge polling (2s → 4s → 8s → 16s cap)
- Hot reload — ACME notifies the TLS provider immediately after each cert is written; no restart required
Configuration
[acme]
enabled = true
domains = ["example.com", "api.example.com"]
email = "[email protected]"
directory_url = "https://acme-v02.api.letsencrypt.org/directory" # Production
# directory_url = "https://acme-staging-v02.api.letsencrypt.org/directory" # Staging
challenge_type = "http-01"
certs_path = "/etc/pqcrypta/certs"
account_path = "/etc/pqcrypta/acme/account.json"
renewal_days = 30 # Without ARI: 30 days before expiry, or a third of the lifetime if less
check_interval_hours = 24 # Once daily, sooner when a renewal falls due first
use_ecdsa = true # ECDSA, P-384 unless ecdsa_curve = "P-256"
accept_tos = true
# A domain's certificate can also name its host's addresses (RFC 8738): a
# client connecting by address authenticates it, and gets it when it sends
# no server name. The domain must be in `domains`.
ip_addresses = { "api.example.com" = ["192.0.2.10", "2001:db8::10"] } # its public addresses
ip_profile = "shortlived" # Let's Encrypt issues addresses only under this profile
# DNS challenges instead of HTTP-01 (challenge_type = "dns-01"), and for any
# wildcard in `domains` ("*.example.com") whatever challenge_type says
# [acme.dns_update]
# server = "127.0.0.1:53" # takes the UPDATE (primary, or a forwarding secondary)
# key_name = "acme-node1" # TSIG key, as that server knows it
# algorithm = "hmac-sha256" # or "hmac-sha512"
# secret_file = "/etc/pqcrypta/acme/dns-update.key" # its secret, base64, 0600
# propagation_timeout_secs = 120 # every name server must serve the record by then
# External Account Binding (required by ZeroSSL, optional for Let's Encrypt)
# eab_kid = "your-kid"
# eab_hmac_key = "your-hmac-key"
Challenge Types
| Type | Description | Requirements |
|---|---|---|
http-01 | HTTP validation on port 80 | Port 80 accessible, served by redirect server |
dns-01 | A TXT record, published by DNS UPDATE (RFC 2136) signed with TSIG (RFC 8945, HMAC-SHA256 or -SHA512), waited for at every name server of its zone, removed after validation; dns-account-01 (draft-ietf-acme-dns-account-label, one record name per ACME account, so several nodes validate one name at once) where the CA offers it | [acme.dns_update]: a server that takes the update (the zone’s primary, or a secondary that forwards it, as Knot DNS does) and a TSIG key |
An IP address identifier is always validated by HTTP-01, whatever challenge_type says: RFC 8738 §7 allows no DNS challenge for one. A wildcard (*.example.com in domains) is always validated by a DNS challenge, the only kind a CA offers for one, so a configuration with a wildcard and no [acme.dns_update] is refused at load.
Supported CAs
| CA | Directory URL |
|---|---|
| Let’s Encrypt | https://acme-v02.api.letsencrypt.org/directory |
| Let’s Encrypt Staging | https://acme-staging-v02.api.letsencrypt.org/directory |
| ZeroSSL | https://acme.zerossl.com/v2/DV90 (requires EAB) |
| Buypass | https://api.buypass.com/acme/directory |
| Google Trust Services | https://dv.acme-v02.api.pki.goog/directory |
OCSP Stapling
For every certificate chain the proxy serves, the end-entity certificate’s
responder (Authority Information Access) is asked for its status. A response
is believed only when OpenSSL verifies it: signed by the issuer, or by a
responder the issuer certified for OCSP signing; about this certificate; and
current (thisUpdate/nextUpdate, five minutes of clock skew). A good
response is stapled, by the rustls listeners (QUIC, plain TCP) and the OpenSSL
ones alike, to clients that ask for it, until its nextUpdate; it is fetched
again halfway through its validity (and no later than
refresh_before_expiry_secs before its end). A revoked answer is logged as an
error and nothing is stapled. A TLS reload makes the service look at the served
chains again at once.
A certificate that names no responder has nothing to staple: Let’s Encrypt and
Google Trust Services retired OCSP, and their certificates carry none. The
status endpoint lists each certificate with its responder, its status, whether
it is stapled now, and whether it requires stapling (TLS Feature
status_request, RFC 7633). Verification uses OpenSSL, so stapling needs the
pqc feature (a default build has it).
Configuration
[ocsp]
enabled = true
cache_duration_secs = 3600 # 1 hour cache
refresh_before_expiry_secs = 300 # Refresh 5 min before expiry
timeout_secs = 10
max_retries = 3
Status Monitoring
# Check OCSP status
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8081/ocsp
# Force refresh
curl -X POST -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8081/ocsp/refresh
Admin API
Endpoints
Public (no authentication required):
| Endpoint | Method | Description |
|---|---|---|
/health | GET | Minimal health check — safe for load-balancer probes (F-03) |
Protected (by the configured admin authentication: the bearer token or, under require_mtls,
the client certificate; with hmac_secret, a signed request; GET of the three
/metrics routes also with metrics_token, unsigned — see
Admin API Authentication):
| Endpoint | Method | Description |
|---|---|---|
/metrics | GET | Prometheus metrics (comprehensive) |
/metrics/json | GET | JSON metrics snapshot |
/metrics/errors | GET | Per-endpoint error counts and recent failure log. Filter with ?type=client (4xx) or ?type=server (5xx) |
/reload | POST | Reload configuration — audit logged |
/shutdown | POST | Graceful shutdown — audit logged |
/config | GET | Read-only config view |
/backends | GET | Each backend’s health as the background probes last found it: up or down, the answer (HTTP 200, or why it failed) and when it was asked |
/tls | GET | TLS certificate info |
/ocsp | GET | OCSP stapling status |
/ocsp/refresh | POST | Force OCSP response refresh (5-min cooldown) |
/acme | GET | ACME certificate status |
/acme/renew | POST | Force certificate renewal (1-hour cooldown) |
/ratelimit | GET | Rate limiter status and statistics |
/ratelimit/reset/{key} | POST | Clear a client’s rate-limit buckets; key is a whole key (SourceIp:203.0.113.7) or its value |
/blocklist | GET | Blocked addresses and networks, with reason, and the synced fingerprint bans (a JA4, from an address, a network or everywhere) |
/blocklist/block/{ip} | POST | Block an address on every listener — audit logged |
/blocklist/unblock/{ip} | POST | Lift a block on every listener — audit logged |
/security/status | GET | Which protections are on and what they have loaded |
/security/geoip/{ip} | GET | What the GeoIP and ASN databases say about an address, and whether a location rule blocks it |
/security/fingerprints | GET | Observed fingerprints, one per JA4, most recently seen first (?limit=N) |
/security/threats | GET | What is being refused, and why |
/waf/explain | POST | Every WAF rule a request matches and what enforcement would do, without counting it |
/health/quic | GET | QUIC listener health — port, migration status, active connections |
/health/webtransport | GET | WebTransport health — active sessions, allowed origins, limits |
/canary | GET | Canary servers, their weights and state |
/canary/suspend/{server_id} | POST | Take a canary out of rotation |
/canary/resume/{server_id} | POST | Put a suspended canary back |
/canary/weight/{server_id} | POST | Set a canary’s share of traffic |
/pools | GET | Load-balancer pools: servers, load, circuit breakers, draining |
/pools/{pool}/servers/{server_id}/{action} | POST | drain, undrain, healthy, unhealthy, canary ({"weight": n}, or no body for the pool’s ramp) or promote for one server |
/cache | GET | Response cache statistics |
/cache/purge | POST | Purge the response cache: everything, one host and path prefix (?host=&prefix=), or one URL (?host=&path=) |
/moq | GET | Media over QUIC relay: versions, sessions, tracks, cache, counters (404 where [moq] is off) |
/moq/sessions | GET | MoQ sessions open now: peer, transport, version, the peer’s MOQT_IMPLEMENTATION, path |
/moq/tracks | GET | Tracks the relay holds: Largest Object, publishers, subscribers, cached bytes |
/moq/namespaces | GET | Namespaces publishers advertise (serialized form, draft-ietf-moq-transport section 8.8) |
Example
# Health check (the one route that needs no credential)
curl http://127.0.0.1:8081/health
# Prometheus metrics
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8081/metrics
# Reload configuration
curl -X POST -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8081/reload
# Reload TLS certificates only
curl -X POST -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8081/reload -d '{"tls_only":true}'
Telemetry Wall
The Telemetry Wall is a native WebTransport handler at /telemetry (default wss://api.pqcrypta.com:4433/telemetry) that streams real-time transport-layer data without any backend involvement.
What it demonstrates
QUIC’s key advantage over TCP is that stream-level impairment on one stream does not affect other streams. The Telemetry Wall makes this concrete: impair channel ch3 and watch channels ch1, ch2, ch4, ch5, ch6 continue uninterrupted. The equivalent on HTTP/2 or WebSocket over TCP would stall all streams.
Session structure
| Stream | Type | Rate | Content |
|---|---|---|---|
ch1–ch6 | Server uni-streams | 20 Hz | Throughput frames (~32 KB virtual per frame ≈ 5 Mbps per channel) |
| Stats | Server uni-stream | 10 Hz | RTT, CWND, CPU %, memory %, uptime |
| Control | Bidi-stream | Client-driven | Impairment and heal commands |
| Datagrams | — | Echo | RTT and packet-loss measurement |
Session idle timeout: 5 minutes. Hard cap: 60 minutes.
Wire protocol
All stream frames use a 4-byte big-endian length prefix followed by JSON:
[u32 BE length][JSON bytes]
Channel header (first frame on each uni-stream):
{"stream_type":"channel_header","channel":"ch1","rate_hz":20}
Throughput frame:
{"t":1234567.890,"seq":42,"channel":"ch1","bytes_total":1048576,"impaired":false,"impairment":null}
Stats frame:
{"t":1234567.890,"rtt_ms":23.5,"cwnd_bytes":1250000,"cpu_pct":8.3,"mem_pct":42.1,"uptime_s":86400}
Impairment commands (client → server on control bidi-stream)
{"cmd":"impair","channel":"ch3","type":"delay_ms","intensity":200.0,
"pattern":"burst","burst_freq_s":5.0,"burst_dur_ms":500.0,"duration_s":30.0}
{"cmd":"heal","channel":"ch3"}
{"cmd":"heal_all"}
Impairment types: delay_ms, loss_pct, bandwidth_kbps, jitter_ms, disconnect
Patterns: constant, burst (periodic spike), random
Server acknowledges each command:
{"type":"ack","cmd":"impair","channel":"ch3","ok":true}
Speed Test
The speed test handler at /speedtest (wss://api.pqcrypta.com:4433/speedtest) provides a side-by-side QUIC vs TCP throughput comparison from the same server.
How the QUIC vs TCP comparison works
The proxy has two config options that together enable independent TCP and QUIC measurements in the browser:
tcp_only_hostsin[server]: listed hostnames getAlt-Svc: clear, evicting any cached QUIC upgrade so the browser stays on TCP/TLS. A request for one that still arrives over HTTP/3 — coalesced onto a connection made for another name on the same address — is answered421 Misdirected Request(RFC 9110 §15.5.20), which browsers retry on a new connection; it was a 404, which failed a TCP speed test’s request outright.http11_only_hostsin[server]: listed hostnames suppress theh2ALPN token, forcing HTTP/1.1. The browser then opens one TCP connection perfetch()stream instead of coalescing onto an HTTP/2 pipe — giving each parallel speed test stream its own TCP flow.
The QUIC path uses WebTransport streams natively; the TCP path uses HTTP/1.1 connections to the same backend. Both paths hit the same server, measuring the protocol itself rather than network distance.
Upload meter
A browser uploads over several streams or connections at once and stops them at its time limit, so neither one stream’s own figures nor what the page handed to its send buffer describe the upload. Each upload names its test with a 128-bit id ("test" in the WebTransport command, ?test= on POST /speedtest/tcp-upload-stream over TCP or HTTP/3), and every stream carrying that id adds what it receives to one meter in the proxy process: bytes per 50 ms bucket, counted on arrival. The client reads it with the meter op on its WebTransport session, or GET /speedtest/tcp-upload-meter?test=ID on a TCP-only host, while the test runs and after it, and computes one rate over the whole test from what the server received. Meters last three minutes and are capped overall and per client address.
What one client may take
The speed test moves as much data as a link carries and its route analysis starts probe processes, so each client network (an IPv4 address, an IPv6 /64) is held to, over WebTransport and TCP alike: as many test streams at once as the page’s largest QUIC upload pool runs (32 WebTransport sessions of four streams, since a browser keeps about 128 KB in flight per session) and eight control streams beside it, a limit the node’s info answer gives so the page fits its pool under it; an hourly allowance of 16 GiB down and 8 GiB up, drawn on as the bytes move, 16 MiB at a time, so transfers side by side hold only what they are about to move and cannot overdraw it; one upload of at most 500 MB and two minutes; one route analysis at a time, 30 s apart, with at most four on the server at once (each probe process is killed at its time limit). A refusal is 429 over TCP, or an error frame over WebTransport (too_many_streams, budget_exhausted, busy), with when to try again.
Latency over TCP
Every response on a TCP-only speed-test host carries Timing-Allow-Origin for the allowed front ends, so the page can read the full Resource Timing entry: responseStart − requestStart is one round trip plus the handler’s time, without the browser’s fetch and scheduling overhead around it.
Operations (JSON over length-prefixed frames)
| Operation | Client sends | Server sends |
|---|---|---|
download | {"op":"download","bytes":N} | 1-byte status + N raw bytes |
upload | {"op":"upload","bytes":N,"test":ID} + N raw bytes | {"bytes_received":M,"duration_ms":D,"throughput_mbps":T}; with test, counted on that test’s meter |
meter | {"op":"meter","test":ID} | The test’s meter: bucket_ms, buckets (bytes per bucket from the first byte), bytes, span_ms, streams, open |
info | {"op":"info"} | Server capabilities JSON |
geoip | {"op":"geoip"} | Client IP, city, country, ASN |
traceroute | {"op":"traceroute"} | Stream of hop frames with per-hop GeoIP, then {"type":"done"} |
Datagram echo: any datagram ≥ 8 bytes is echoed immediately. Client embeds a send timestamp in the payload to compute RTT and count loss.
Limits
| Parameter | Value |
|---|---|
| Max download | 1 GB per stream or request, on every transport (client time-limits it) |
| Max upload | 500 MB |
| Download chunk | 256 KB (keeps QUIC send buffer full) |
| Session idle timeout | 5 minutes |
| Session hard cap | 30 minutes |
| Sessions per client address | 64 (webtransport_max_sessions_per_client); the page’s upload opens up to 32, since a browser holds about 128 KB in flight per WebTransport session |
| Sessions per origin | 4096 (webtransport_max_sessions_per_origin): every visitor of a page shares its origin, so this bounds the site, not a visitor |
Examples
speedtest-probe — the speed test from the command line
cargo run --release --example speedtest-probe -- https://api.pqcrypta.com:4433/speedtest --origin https://pqcrypta.com
Datagram round trips, a time-bounded download over parallel streams and an upload read back from the node’s meter, without a browser’s limits in the way: what the node and the path can carry, to check a page’s figures against.
masque-client — a MASQUE (RFC 9298) reference client
cargo run --example masque-client -- <relay:port> <target:port> <name>
cargo run --example masque-client -- pqcrypta.com:443 1.1.1.1:53 example.com
Opens an HTTP/3 connection, sends an Extended CONNECT with :protocol = connect-udp,
and relays one DNS query to the target resolver as an HTTP Datagram. Written to be read:
it is the shortest complete demonstration of the CONNECT-UDP flow, including the
quarter-stream-ID framing that RFC 9297 uses to bind a connection-global datagram back to
its request stream.
Three things it gets right that are easy to get wrong:
- The CONNECT stream is not finished. The stream is the session; closing the send side tells the relay to tear the UDP socket down, and datagrams then vanish silently with a 200 OK already in hand.
- Both
SETTINGS_H3_DATAGRAMandSETTINGS_ENABLE_CONNECT_PROTOCOLare negotiated. Separate settings; without the second,:protocolis not legal on the request. - Inbound datagrams are filtered by quarter stream ID. Every datagram on the connection reaches every reader.
A standalone copy that builds against upstream quinn/h3 rather than the vendored noq
forks is published at https://pqcrypta.com/masque/, for people who want the client
without the proxy.
Pentest Suite
The pentests/ directory contains 32 automated black-box attack scripts across 12 phases, used to continuously validate pqcrypta-proxy’s security posture. No source access is required — all scripts target the public HTTP surface.
Quick start
cd pqcrypta-proxy/pentests
cp config.demo.sh config.sh
vi config.sh # set TARGET and API_TARGET at minimum
./preflight.sh # check required tools
./run_all.sh # all 32 scripts
./run_all.sh --skip-slow # skip TLS deep-scan and resilience/chaos
./run_all.sh --local # tighter timing thresholds (LAN / same datacenter)
./run_all.sh --phase 5 # single phase
Phase map
| Phase | Scripts | Attack category |
|---|---|---|
| 1 | 14 | Reconnaissance & information disclosure |
| 2 | 01, 12 | WAF bypass & advanced evasion |
| 3 | 02, 03 | Bot detection bypass, header injection |
| 4 | 07, 06, 13 | HTTP smuggling (1.1/2/3/WebTransport), TLS/SSL, WebSocket |
| 5 | 08, 09, 05, 10, 11, 04 | SSRF, cache poisoning, API auth, crypto fuzzing, timing oracles, rate limiting |
| 6 | 15, 19, 20 | Auth hardening, session security, MFA bypass, access control |
| 7 | 16, 17, 23 | Business logic, race conditions, CSP, client-side JS |
| 8 | 21, 22, 18 | Supply chain, cloud/infra, resilience & chaos |
| 9 | 24 | Data privacy & PII exposure |
| 10 | 25, 26, 27 | Container/K8s runtime, CI/CD pipeline, database & storage |
| 11 | 28 | AI / LLM attack surface (prompt injection, context bleed) |
| 12 | 29, 30, 31, 32 | XXE, SSTI, file upload, gRPC/Protobuf |
Protocol coverage
| Protocol | Coverage |
|---|---|
| HTTP/1.1 | CL.TE and TE.CL smuggling via raw nc, all WAF / auth / API tests |
| HTTP/2 | TE rejection (RFC 9113 §8.2.2), Rapid Reset (CVE-2023-44487), all API tests |
| HTTP/3 / QUIC | curl --http3 with Alt-Svc fallback detection; WAF and rate-limit tests |
| WebTransport | TCP probe on QUIC_PORT, HTTP/3 QUIC framing |
| WebSocket | RFC 6455 upgrade, auth bypass, token-in-query-string, RFC 8441 H2 WS |
Pentest bypass IP
Add your test runner IP to pentest_bypass_ips in [security] to skip rate-limiting and auto-block without disabling the WAF:
[security]
# Remove after the engagement ends.
pentest_bypass_ips = ["YOUR.RUNNER.IP.HERE"]
A runner whose address changes (a home connection) can be listed by host name instead. The name stands for the addresses it resolves to, and DNS carries each change. Names resolve only through host_resolver, a validating resolver reached over TCP. Only an answer it authenticates counts, because a forged answer would exempt the forger:
[security]
pentest_bypass_ips = ["runner.example.com"]
host_resolver = "127.0.0.1:53"
Effect: rate limiting and auto-block are disabled for listed IPs (preventing mid-run lockout), but the WAF still executes — attack payloads still return 403, confirming WAF detection is working. Script 04 (rate limiting) needs a non-bypassed IP to test the limiter itself.
Output
Each run writes to results/run_YYYYMMDD_HHMMSS/:
results/run_20260522_153000/
├── MASTER_REPORT.txt # full concatenated output
├── SUMMARY.tsv # machine-readable: phase<TAB>script<TAB>name<TAB>status<TAB>findings<TAB>warns<TAB>duration_s
├── 01_waf_bypass.txt
├── 07_advanced_smuggling.txt
└── ...
| Exit code | Meaning |
|---|---|
0 | All scripts passed — no findings, no warnings |
1 | At least one [WARN] or [VULN] finding |
2 | One or more scripts failed with an execution error |
3 | Preflight check failed or scope_guard.sh refused the target |
Timing oracle methodology (script 11)
50 samples per test group, python3 statistics.mean + pstdev per group, alert threshold 3σ above baseline mean. Minimum floor: 15 ms remote, 3 ms with --local. Tests: API key oracle, admin login timing, decrypt padding oracle, WAF timing side-channel.
Required tools
bash 5.0+, curl, python3, openssl, nc, dig, jq. Optional: hey (race conditions), websocat (WebSocket), grpcurl (gRPC), testssl.sh (TLS deep-scan), nikto (web scan).
Metrics
Latency Percentiles (p50 / p95 / p99)
Latency percentiles are computed from a double-buffered 5-minute sliding window rather than a cumulative histogram. The active buffer accumulates request durations; every 2.5 minutes the buffers rotate, so reported percentiles always reflect the last 2.5–5 minutes of live traffic. Historical outliers from startup or past load spikes do not pollute current readings.
Percentiles are interpolated using Prometheus-style linear interpolation within each bucket. The histogram uses 19 buckets with boundaries chosen to match SLO thresholds: 1, 5, 10, 25, 50, 100, 150, 200, 300, 500, 750, 1000, 1500, 2000, 2500, 5000, 10000, 30000 ms, and +Inf. This avoids the step-function snapping seen with coarse bucket boundaries (a p99 of 1001 ms reported as 2500 ms).
Traffic, Challenges and Certificates
Beside the request, connection, TLS, rate-limit and WAF families, /metrics
(and /metrics/json) carries:
| Metric | Type | What it counts |
|---|---|---|
pqcrypta_requests_by_country_total{country} | counter | Requests judged, by the client’s country in the GeoIP database (ZZ where it has none); a country appears once it has a request |
pqcrypta_request_body_bytes | histogram | Request bodies by declared size (Content-Length), in power-of-four buckets from 256 B to 64 MiB |
pqcrypta_challenges_total{outcome} | counter | Proof-of-work challenges issued, and solutions passed or failed |
pqcrypta_certificate_not_after_seconds{domain,kind} | gauge | When each served certificate expires, the primary and the ML-DSA companion |
The first two are what a baseline of the traffic needs to see a change no per-request rule does: one country’s share rising far above its usual share for that hour of the week, or bodies far larger than usual. The last is what an alert on a renewal that has not happened reads.
Health Checks and the Metrics
Every request the proxy serves counts in its metrics and its latency
histogram. x-health-check-bypass is a header only the proxy may set
(PROXY_ONLY_HEADERS, with x-webtransport-proxy): one a client sends is
stripped on every listener before anything reads it. It used to keep requests
out of these figures for anyone who sent it, and to walk a scanner past the
bad-bot rules. A synthetic check that must not count reaches its backend
directly, not through the proxy.
WAF Blocked Requests
A request the WAF refuses (its own rules or CRS, in block mode) is answered
403 with x-waf-block: 1, on every transport, so whatever reads the
responses – a backend’s middleware, a monitor – can tell a refusal for what
the request carried from a failure. A refusal of the address itself (the
blocklist, its location, a rate limit) carries no such header.
OpenTelemetry Distributed Tracing
PQCrypta Proxy supports end-to-end distributed tracing via the OpenTelemetry SDK. When enabled, every HTTP request creates a span that is stitched into the incoming trace (if one is present) and propagated to upstream backends.
Propagation Formats
| Format | Headers | Notes |
|---|---|---|
| W3C Trace Context (W3C Recommendation) | traceparent, tracestate | Extracted first; highest priority |
| B3 Multi-header | x-b3-traceid, x-b3-spanid, x-b3-sampled | Fallback extract; always injected |
| B3 Single-header | b3 | {traceId}-{spanId}-{flag} compact form; also injected |
Both W3C and B3 formats are injected into every upstream request so Jaeger, Zipkin, Tempo, and W3C-compatible backends can all correlate traces from a single proxy deployment.
Transport Coverage
Trace context extraction and injection is active on all four transports:
- HTTP/1.1 + HTTP/2 — axum
trace_context_middlewareextracts fromHeaderMapbefore the first handler runs - HTTP/3 / QUIC — extracted from the incoming H3 header map before any routing
- WebTransport — same QUIC path; context propagated into backend requests
- Backend requests —
inject_current_context_into_map()stamps both formats into every proxied request
Configuration
[otel]
# Enable distributed tracing (disabled by default)
enabled = true
# Service name reported in spans and to the collector
service_name = "pqcrypta-proxy"
# OTLP HTTP/JSON endpoint — works with Jaeger, Grafana Tempo,
# OpenTelemetry Collector, Honeycomb, Lightstep, etc.
otlp_endpoint = "http://localhost:4318"
# Sampling ratio: 1.0 = always, 0.0 = never, 0.1 = 10% of root spans
# Uses ParentBased(TraceIdRatioBased) — child spans inherit parent decision
sample_ratio = 1.0
# Who may name the trace a request continues (addresses or CIDR ranges):
# the proxy's own tracing peers, such as a load balancer in front of it.
# A request from anywhere else begins a trace of the proxy's own, sampled by
# sample_ratio, and keeps the traceparent/B3 context it sent as a span link,
# so a client cannot choose trace IDs or mark every request sampled.
trusted_parents = []
# Optional resource attributes added to every exported span
# [otel.resource_attributes]
# deployment.environment = "production"
# host.name = "proxy-1"
Access Log Correlation
When tracing is active, every access-log line includes a trace_id=<hex> field so log entries can be looked up directly in Jaeger or Tempo:
203.0.113.42 - - [02/Mar/2026:14:23:01 +0000] "GET /api/v1/users HTTP/3" 200 1542 "-" "curl/8.5.0" host="api.pqcrypta.com" time=18ms trace_id=4bf92f3577b34da6a3ce929d0e0e4736
Span Export
Spans are batched and exported asynchronously via OTLP HTTP/JSON (no protobuf dependency — uses the existing reqwest client). The global tracer provider is a NOOP until init_otel() is called after config loads, so startup spans are silently dropped; all request-handling spans are fully exported. On graceful shutdown, the batch queue is flushed before the process exits.
Deployment
Fleet deploy
scripts/deploy.sh BINARY NODE... installs a release binary on each node in
turn (local, or an ssh destination). On each it copies the binary beside the
live one and runs it with --validate as the service account against that
node’s configuration, which loads it and runs the startup security checks as a
real start would. It keeps the live binary as .prev-<UTC time>, installs and
restarts, and waits for the node to be active and running this binary’s
version, putting the previous binary back if it is not; the first node that
fails stops the run. It builds nothing: build once, on a build host, and give
it the binary. A measurement build ([measurement build: …] in --version) is
refused.
cargo build --release --bin pqcrypta-proxy # on the build host
scripts/deploy.sh target/release/pqcrypta-proxy local node2 node3
scripts/deploy.sh --gate target/release/pqcrypta-proxy local # then the post-deploy WAF gate
Systemd (Linux)
# Copy service file
sudo cp packaging/systemd/pqcrypta-proxy.service /etc/systemd/system/
# Enable and start
sudo systemctl enable pqcrypta-proxy
sudo systemctl start pqcrypta-proxy
# View logs
journalctl -u pqcrypta-proxy -f
Restarts without refusing connections. The proxy takes its listening sockets from the service manager when it passes them (systemd socket activation). Write the socket unit from the configuration, the same addresses the listeners bind, and enable it; the service needs no change, since systemd hands a service the sockets of the unit with its name:
sudo pqcrypta-proxy --config /etc/pqcrypta/proxy-config.toml \
--socket-unit /etc/systemd/system/pqcrypta-proxy.socket
sudo systemctl daemon-reload
sudo systemctl enable --now pqcrypta-proxy.socket
sudo systemctl restart pqcrypta-proxy # takes the sockets from here on
The sockets then outlive the process: while one drains and the next starts,
the kernel completes TCP handshakes into the listen backlog and queues
datagrams, and the next process serves them. Write the unit again when the
listeners change (ports, bind_address, the conformance range): a passed
socket no listener takes is reported at startup, and a listener with no passed
socket binds its own as before. QUIC connections still end at a restart (their
state lives in the process); clients open new ones on the same socket.
The connections that queued during a restart reach the new process together,
so the connection-rate limit (rate_limiting.connection_rate_limit) waits ten
seconds after the process starts before it counts: one client’s queued
connections say nothing about it, and the limit bans on its first offence. The
request-rate limits and the per-address connection limits apply throughout.
macOS (launchd)
# Copy plist
cp packaging/macos/com.pqcrypta.proxy.plist ~/Library/LaunchAgents/
# Load service
launchctl load ~/Library/LaunchAgents/com.pqcrypta.proxy.plist
Windows Service
# Using NSSM (Non-Sucking Service Manager)
nssm install pqcrypta-proxy "C:\Program Files\pqcrypta-proxy\pqcrypta-proxy.exe"
nssm set pqcrypta-proxy AppParameters "--config C:\ProgramData\pqcrypta\config.toml"
nssm start pqcrypta-proxy
Performance Tuning
Kernel Parameters (Linux)
# /etc/sysctl.d/99-pqcrypta.conf
net.core.rmem_max = 26214400
net.core.wmem_max = 26214400
net.core.rmem_default = 1048576
net.core.wmem_default = 1048576
net.ipv4.udp_mem = 65536 131072 262144
Build Optimizations
# Build with native CPU optimizations
RUSTFLAGS="-C target-cpu=native" cargo build --release
Benchmarking
The throughput comparison against HAProxy, the instructions-per-request A/B
used for optimisation work, and the handshake benchmarks live in
benchmarks/ as scripts, not cargo bench targets; benchmarks/README.md
describes the rig and the traps it guards against.
Security
All Security Features
-
TLS 1.3 minimum by default (configurable via
min_version; applies to both TCP/TLS via OpenSSL 3.5+ and QUIC/HTTP3 via rustls) - Full security headers (HSTS, COEP, COOP, CORP, etc.)
- Server identity hidden (custom branding)
- X-Forwarded-For header support
- Rate limiting (per-IP token bucket with burst handling; multi-dimensional composite keys)
- DoS protection (connection limits, body size limit, request validation, auto-blocking)
- Request size limits (413/431 responses); chunked body size enforced (Transfer-Encoding bypass closed)
- GeoIP blocking (MaxMind DB integration)
- JA3/JA4 TLS fingerprinting (browser/bot/malware detection)
- JA3/JA4 replay detection (one non-browser fingerprint from many client networks in a window)
- JA3/JA4 drift detection (one client network rotating its fingerprint)
- Circuit breaker (backend protection; per-backend failure threshold and half-open delay overrides)
- Per-backend retry (configurable count, exponential backoff, retry-on conditions)
- IP blocking (manual + auto with expiration; DB-synced blocklists)
- Compression (Brotli, Zstd, Gzip, Deflate)
- Early Hints (103) support
- Priority Hints (RFC 9218)
- Request Coalescing (dedupe identical requests)
- PQC hybrid key exchange (X25519MLKEM768 — NIST FIPS 203)
- PQC downgrade detection (block/log/allow when classical-only TLS negotiated)
- 0-RTT replay protection (nonce store with strict/session/none modes; window configurable)
- Background cleanup (auto-expire blocked IPs)
- SSRF protection (link-local backend rejection, RFC1918 warning, WAF SSRF pattern set)
- WAF (pattern-based injection and traversal detection: SQLi, XSS, path traversal, NoSQLi, SSRF, CMDi, XXE, deserialization; covers OWASP A01/A03/A08/A10; detect/block modes; custom patterns)
- Structured audit logging (async JSON — admin actions, auth failures, WAF events, rate limits, PQC downgrades, config reloads, JA3 replay/drift)
- Admin router tier split (public /health vs. authenticated /metrics, /reload, etc.)
- Admin token auth (ephemeral if not configured; constant-time comparison; per-IP + global brute-force lockout with exponential back-off)
- JWT rate limiting with HMAC-SHA256 signature verification (no unsigned sub claim trust)
- Configurable JWT algorithms (default HS256; non-HMAC rejected — prevents algorithm-confusion attacks)
- Exponential back-off on global auth cooldown (5 min base, up to 30 min)
- ACME/OCSP endpoint rate limiting (/acme/renew 1-hour cooldown; /ocsp/refresh 5-min cooldown)
- Certificate Transparency — new ACME certs submitted to CT logs after issuance
- ACME domain path sanitization — RFC 1035 validation before any certs_path join
-
QUIC connection migration (configurable enable/disable via
enable_quic_migration) - WebTransport per-origin session rate limiting (max sessions, streams, datagrams/sec)
- Per-route security policy (mTLS, JA3 and JA4 allowlists, rate limit override, WAF mode, 0-RTT control)
- Config conflict validation at startup and hot-reload (PQC+passthrough, 0-RTT without replay protection, mTLS without CA cert)
-
Environment config overlay (
--env <name>mergesconfig.<name>.tomlover base) - Config schema versioning (warns on absent version; errors on future version)
- Admin API non-loopback warning (WARN when bind_address is not loopback)
-
[admin] require_mtls = trueserves the admin API over TLS 1.3 with a required client certificate (it used to be a hard startup error, because the listener had no TLS) - Backend topology not disclosed in logs (resolved host:port pairs removed from startup output)
-
Loopback-only trust for
is_trusted_ip()(RFC1918 not trusted by default — closes XFF bypass) - Graceful shutdown drain polling (100 ms poll loop exits when connections reach zero — no fixed sleep)
- OpenSSL binary path validation (must be absolute, pointing to a regular file)
- Log injection prevention (newlines and control characters stripped from all user-controlled log fields)
-
Backend certificates always verified (
tls_skip_verifyrefused; pin withtls_cert) -
unsafe_code = denycrate-wide; only the modules at a C or kernel boundary (OpenSSL, mimalloc, inherited sockets, socket options) allow it, andclippy::undocumented_unsafe_blocks = denymakes every unsafe block and impl state why it is sound in aSAFETYcomment - Panic prevention (no production-path unwrap(); ok_or/? throughout)
- Memory exhaustion prevention: every table a client can add to (addresses, fingerprints, cookies, paths, replay nonces) has a ceiling enforced where entries are made, swept for room at most once every few seconds when full, so neither memory nor the work per request follows the number of distinct values clients send
- ReDoS prevention (regex patterns size-limited)
- SECURITY.md: private vulnerability reporting, and an advisory with each fix
mTLS Configuration
Whether a client is asked for a certificate is decided once from the configuration and applied on every listener — HTTP/1.1, HTTP/2 and HTTP/3, whichever TLS stack serves them:
require_client_cert = true— every client must present one; the handshake fails without it.- A route that needs one —
internal = true, or[routes.security] mtls_required = trueon any route — with no global requirement: the listeners ask for a certificate, a client may still finish the handshake without one, and the route answers it401. Other routes are unaffected, and no client is asked when no route needs a certificate, so browsers are not shown a certificate picker for nothing. - Neither — not asked.
Both of the first two need ca_cert_path; the proxy refuses to start without
it rather than accept any publicly issued certificate. The route gate reads
x-client-cert, which only the accept loop sets — any copy a client sends is
stripped on every listener.
[tls]
ca_cert_path = "/etc/pqcrypta/client-ca.pem"
require_client_cert = true # every client, every route
# ...or leave it false and mark the routes that need one:
[[routes]]
name = "internal-api"
internal = true # mTLS by default; opt out with [routes.security] mtls_required = false
The admin API takes the same protection on its own listener. With
require_mtls = true it serves TLS 1.3 only, prefers the hybrid groups, and
requires a client certificate issued by client_ca_path (default:
tls.ca_cert_path); the certificate is then the credential, and auth_token
is still checked when set. Because the listener is encrypted and
authenticated, require_loopback no longer applies to it, and in
zero_trust_mode a required client certificate satisfies the admin
proof-of-possession requirement as hmac_secret does.
[admin]
enabled = true
bind_address = "10.0.0.5" # reachable from the management network
port = 8081
require_mtls = true
client_ca_path = "/etc/pqcrypta/admin-ca.pem"
# tls_cert_path / tls_key_path default to [tls] cert_path / key_path
Admin API Authentication
The admin API is off unless [admin] enabled = true. It listens on 127.0.0.1:8081 by
default and speaks plain HTTP, so it refuses to start on a non-loopback bind_address unless
require_loopback = false or require_mtls makes it TLS with client certificates. Every route
but /health passes, in order:
- The address filter (
allowed_ips): a request from an address not listed is refused 403. It decides who may try; it authenticates no one. - A credential, one of:
- The bearer token (
auth_token, at least 32 characters), compared in constant time. A correct token is never throttled. - With no
auth_tokenconfigured, a 48-character token the proxy generates at each start and prints to standard error (not to the log, so a log pipeline does not carry it), with theauth_token = "…"line that would keep it. It changes at every restart, so anything that calls the API unattended needsauth_tokenset. There is no unauthenticated mode. - Under mTLS (
require_mtls = truewithclient_ca_path;tls_cert_pathandtls_key_pathdefault to[tls]’s), the client certificate: a token is still checked when one is configured, and none is generated.
- The bearer token (
- Proof of possession (optional,
hmac_secret; inzero_trust_mode, this or mTLS is required): each request also carriesX-Admin-Signature, the HMAC-SHA256 ofMETHOD\nPATH_AND_QUERY\nTIMESTAMP\nNONCE\nBODY_SHA256(the body’s SHA-256 in hex, of no bytes when there is none, so a body cannot be changed either), withX-Admin-Timestamp(within ±300 s) andX-Admin-Nonce(each accepted once), so a token taken from one request cannot be replayed.
Startup refuses an allowed_ips that is not loopback-only when no auth_token is configured: a
token generated per start is not one a remote caller can hold across restarts.
[admin]
enabled = true
bind_address = "127.0.0.1"
port = 8081
auth_token = "your-strong-secret-token-at-least-32-chars"
allowed_ips = ["127.0.0.1", "::1"]
# hmac_secret = "…" # optional: per-request signatures
# metrics_token = "…" # optional: reads /metrics, /metrics/json, /metrics/errors alone, unsigned
# require_mtls = true # optional: client certificates (tls_cert_path, tls_key_path, client_ca_path)
Token requirements:
- Minimum 32 characters — the proxy rejects a shorter
auth_token,admin.hmac_secret,admin.metrics_tokenor routesecurity.hmac_secretat startup, and ametrics_tokenthat is theauth_token. Generate one withopenssl rand -base64 48. - Token comparison uses constant-time equality to prevent timing side-channel attacks.
Brute-force protection:
- Per-IP: 10 failures per 60-second window triggers a
429 Too Many Requestslockout for that IP. - Distributed (F-08): 50 total failures across all IPs triggers a global cooldown of 5 minutes (base). Each successive trigger doubles the cooldown (5 min → 10 min → 20 min → 30 min max). Resets to 0 on a successful authentication. This catches distributed attacks where each source IP stays below the per-IP threshold.
- Endpoint cooldowns (F-14):
/acme/renewis limited to once per hour;/ocsp/refreshto once per 5 minutes to prevent inadvertent CA rate-limit exhaustion.
JWT Rate Limiting
Per-subject JWT rate limiting verifies the token’s HMAC-SHA256 signature before trusting the sub claim. Configure a shared signing secret that matches the upstream token issuer:
[advanced_rate_limiting]
jwt_secret = "your-hmac-sha256-secret-at-least-32-bytes"
jwt_algorithms = ["HS256"]
[advanced_rate_limiting.key_strategy]
order = ["jwt_subject", "source_ip"]
Without jwt_secret, the jwt_subject strategy is disabled and falls back to the next configured key strategy.
Algorithm restriction (F-10): By default only HS256 is accepted. To allow additional HMAC variants:
[advanced_rate_limiting]
jwt_secret = "your-hmac-sha256-secret-at-least-32-bytes"
jwt_algorithms = ["HS256"] # Only HS256/HS384/HS512 are valid; non-HMAC strings are rejected
Backend TLS Verification
A backend’s certificate is always verified: the native roots, plus tls_cert,
which is either the CA that issued the backend’s certificate or the backend’s
own certificate when it is self-signed (pinned as its trust anchor). There is
no way to turn verification off; a configuration that sets tls_skip_verify
is refused at load with that advice.
[backends.dev-backend]
name = "dev-backend"
type = "http1"
tls_mode = "reencrypt"
address = "localhost:8443"
tls_cert = "/etc/pqcrypta/dev-backend.crt" # its self-signed certificate
0-RTT Early Data
0-RTT (TLS 1.3 early data) is disabled by default. When enabled it works on every listener, TCP and QUIC: session tickets allow early data, and a request that arrives in it is served before the handshake completes, its response leaving as 0.5-RTT data. Waiting for the handshake would answer at the moment a 1-RTT connection does, which is no saving at all.
[tls]
enable_0rtt = true
# Methods safe for 0-RTT forwarding (idempotent, no side effects)
zero_rtt_safe_methods = ["GET", "HEAD"]
# Early data a TCP ticket allows (QUIC tickets always carry 0xffffffff, RFC 9001 §4.6.1)
zero_rtt_max_early_data = 16384
# "strict": refuse a repeated ClientHello; "session": each ticket carries early data once
zero_rtt_replay_protection = "strict"
zero_rtt_nonce_window_secs = 60
What counts as early. A request is early when it is dispatched before the client’s Finished has been verified. That is the property replay turns on: an attacker can re-send a recorded ClientHello and its early data, but never the Finished, so everything a replayed connection dispatches is early. On TCP the OpenSSL listeners read early data with SSL_read_early_data and the rustls listeners through a driver of their own (tokio-rustls completes a server handshake before returning); on QUIC each request stream reports whether it arrived in 0-RTT. Replay protection runs on the ClientHello before any handshake work, on both TCP stacks; OpenSSL adds its own single-use tickets when early data is on.
Per-route enforcement (RFC 8470)
Every route has an allow_0rtt flag that defaults to false. When a request arrives as TLS 1.3 early data on a route where allow_0rtt = false, the proxy responds with 425 Too Early and does not forward the request to the backend. This prevents replay attacks on non-idempotent operations (POST, PUT, DELETE, PATCH, etc.).
Routes that serve purely idempotent, replay-safe content can opt in explicitly:
[[routes]]
name = "static-assets"
host = "cdn.example.com"
path_prefix = "/static/"
backend = "cdn"
allow_0rtt = true # safe: static files, no side effects
[[routes]]
name = "api"
host = "api.example.com"
path_prefix = "/"
backend = "api"
# allow_0rtt = false ← default; early-data requests receive 425 Too Early
A request that is forwarded while early carries Early-Data: 1 to the backend (RFC 8470 §5.1), so an origin that cannot tolerate replay can answer 425 itself.
The x-tls-early-data header used internally to propagate the early-data flag is stripped from all incoming requests before being set by the accept loop, and is removed from every outgoing backend request, so it cannot be forged by clients or leaked to backends.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributing
Contributions welcome! Please read CONTRIBUTING.md first.
Report a bug or ask for a feature in GitHub Issues, and ask questions in Discussions. Report a vulnerability privately, as SECURITY.md describes.
Similar Articles
cloudflare/quiche
quiche is a Rust-based implementation of the QUIC transport protocol and HTTP/3, providing a low-level API for processing QUIC packets and managing connections. It is used by Cloudflare for HTTP/3 support, Android's DNS resolver, and can be integrated into curl.
How to Intercept HTTP/3 Traffic: QUIC and Qpack
A technical walkthrough explaining why HTTP/3 traffic bypasses traditional HTTP proxies and how to intercept QUIC/QPACK traffic using InterceptSuite, including real traffic analysis from curl and Microsoft Edge and an open-source HTTP/3 extension for decoding.
Show HN: Rscrypto, pure-Rust crypto with industry leading public benches
rscrypto is a pure-Rust cryptography library that provides RSA, Ed25519, X25519, AEADs, hashes, KDFs, and more, with a focus on portability, no_std support, and industry-leading benchmarks.
@Ryrenz: When the signal is down to one bar and you can still load web pages, it’s thanks to things like quiche—Cloudflare has f…
Cloudflare has open-sourced quiche, a Rust implementation of the QUIC transport protocol and HTTP/3, used in their edge network and adopted by Android and curl for enhanced network performance.
Qpack amplification attacks against HTTP/3 servers
FoxIO researchers disclosed QPACK amplification attacks against HTTP/3 servers, where a small HEADERS frame can force servers to allocate 10x-1000x more memory, enabling OOM/DoS with a single connection. Seven of ten tested implementations were vulnerable, including quic-go, quiche, lsquic, Bun, and Wireshark, with several already patched and others still unpatched.