Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Fly.io 10 min read Deep dive mediumAdept

How CDNs Generate Certificates

CDNs like Fly obtain Let's Encrypt certificates for customer domains using the ACME tls-alpn-01 challenge, which needs neither DNS access nor port 80. The older tls-sni-01 challenge was removed because shared-hosting providers let customers claim arbitrary .invalid names and upload certificates, enabling issuance for other tenants on the same IP. The history runs through NPN vs. ALPN negotiation, NPN downgrade attacks and the middlebox bug that produced the ClientHello padding extension. Fly's flow ends with its Rust proxy recognizing the "acme-tls/1" ALPN value and serving a self-signed challenge certificate. Subdomain takeover is mitigated by giving every app a unique IPv6 address and requiring a CNAME to it before validation.

Assumes: TLS handshake basicsDNS recordsHTTPS certificates

Related posts

  • HTTPS by default

    Replit mediumAdept

    Replit's proxy now redirects all HTTP requests to server repls to HTTPS and serves HSTS headers, so every hosted server is HTTPS by default. The proxy manages roughly half a million Let's Encrypt certificates via ACME. It uses HTTP-01 validation for custom domains, which already CNAME to the proxy, and DNS-01 for per-user wildcard certificates (*.<user>.repl.co), so each user needs only one certificate. Certificates are renewed lazily on request once fewer than 30 days remain, about 5,000-10,000 per day. A conservation mode defers renewals when ACME rate-limit capacity runs low, and a circuit breaker forces renewal for certificates near expiry.

  • Using short-lived certificates to protect TLS secrets

    Meta Engineering mediumAdept

    Meta now limits TLS private key exposure on its edge to 10 days by rotating short-lived certificates daily, after rejecting CRL/OCSP revocation (latency, failure modes), remote signing from datacenters (vulnerable to backbone and datacenter outages) and delegated credentials (insufficient browser support). Certificates are issued months ahead from third-party CAs and moved from a locked-down secret store to an edge-only store just 10 days before expiry, which keeps CA issuance off the critical path and provides ready backup certs for emergency rotation. A ConfigBuilder groups certs into expiry-dated bundles, validates them, and rolls them out in stages: canary, then about 100 machines, then the full fleet after a day of baking. The OffloadService signs with both old and new keys during rotation, and caching plus staggered fetches keep daily rotation from overloading the secret store.

  • Why We Built Our Own DNS Infrastructure

    Replit mediumAdept

    Replit made its repl hosting cluster-aware by running its own authoritative DNS server for *.repl.co, which resolves each repl's domain to the proxy load balancer in the cluster hosting that repl. This avoided a "meta-proxy" layer that would have added two extra hops per request. The Go server, built on miekg/dns, CNAMEs ACME DNS-01 challenges to a GCP-managed validation zone. Because DNS caching can outlive the 60s TTL, proxies in the old cluster use tombstones to transparently forward requests for repls that have moved. Custom domains work unchanged because they already CNAME to <repl id>.repl.co.

  • 4 real? Tracking exploitation and patching of eMudhra’s weak keys

    Cloudflare mediumAdept

    eMudhra's eight intermediate CA keys were trivially weak (private values like 4, 56 and 66), so anyone could recover the signing keys from the public certificates and forge certificates for any domain that unpatched clients not enforcing Certificate Transparency would accept. Cloudflare patched Pingora within hours, used AI-assisted code analysis to find every other system trusting the keys, and added handshake logging. That logging recorded about 22,000 weak-key handshakes, including roughly 160 forged certificates naming unrelated domains, one minted within an hour of the disclosure, but no evidence of interception. About 50 million probes from challenge pages show modern browsers are mostly patched, while bots, old browsers and Android WebView (30–40% still accepting) lag, with patching flat after the first weekend. The fix is to patch now, and longer term trust stores need fast update mechanisms such as upki for revocation and CT keys.

  • That Old Certificate Expired and Started an Outage. This is What Happened Next

    Shopify Engineering mediumAdept

    When Let's Encrypt's old root certificate expired on September 30, 2021, Shopify's internal service-to-service HTTPS calls began failing because the Ruby httpclient gem, pulled in transitively by rack-oauth2, openid_connect and google-api-client, ships its own six-year-old cacert.pem that trusted neither the expired root nor the new one. Failures surfaced about 15 minutes late because TLS validation only happens at connection setup and HTTP keep-alive connections persisted until Kubernetes pods were recycled by a deploy. Locking monolith deployments early confined the damage to canaries, avoiding a global outage, though recommendations, marketing campaigns and order-confirmation risk checks were degraded. The fix was a fork overriding cacert.pem with automated root-bundle updates, with a longer-term move toward system trust stores under consideration.

The quest for software engineering knowledge.

Look:
Layout: