Skip to main content
← PROBLEMS / ENGINEERING
An end-to-end domain learning journey

Automating TLS Certificate Rotation
& Expiry Alerts.

An unmonitored 90-day TLS certificate expired on the CDN edge while origin health checks stayed 200 OK, silently cutting 100% of browser and mobile traffic.
Start the journey5 stages
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

If latency budgets leave no room for synchronous retries, automate ACME renewals at 60 days (30 days remaining), monitor the public CDN edge with strict TLS verification (`insecure_skip_verify: false`), and configure a dual-CA backup issuer.

TL;DR30-second simplified summary
▾

Core Mechanics: Modern web architectures terminate public TLS at CDN PoPs (120+ edge locations) and route over separate connections to origin ALBs.

Visual & Structural Flow: Depicts Expired Edge Cert vs. Green Internal Probes (Browser / Mobile -> CDN Edge (120 PoPs) -> Internal Probe -> Origin ALB); 90-Day Cert Renewal, Verification & Dual-CA Failover (ACTIVE (0-60d) -> RENEW (Day 60) -> BACKUP CA).

Trade-Offs & Production: Relying on calendar reminders, curl -k scripts, or a single ACME cron job fails in production: Calendar / Manual Renewal: Breaks across 45 domains and human handoffs. Implement a closed-loop automated TLS pipeline: Early ACME Renewal: Renew 90-day certs at 60 days (renewBefore: 720h), giving a 30-day runway before expiry.

Failure Modes & Application: Automated short-lived certificate rotation underpins both public edge security and internal zero-trust meshes: Multi-CDN & Edge Gateways: Cloudflare, Fastly, and AWS CloudFront automate 90-day ACME renewals with CT-log monitoring.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
TLS Certificate Lifecycle
The TLS certificate lifecycle governs generating key pairs, proving domain/workload identity via ACME or an internal CA, deploying X.509 certificates without dropping connections, and rotating or revoking them before expiry.
Full walkthrough · 5 stages
01
STAGE 01 · WHY IT MATTERSL4 · FUNDAMENTALS

Why TLS expiry causes total silent outages.

Why this matters: The mechanism: understand how Why TLS expiry causes total silent outages works from first principles.

Think of Why TLS expiry causes total silent outages as the intuition layer for Automating TLS Certificate Rotation & Expiry Alerts: The mechanism: understand how Why TLS expiry causes total silent outages works from first principles.

Modern web architectures terminate public TLS at CDN PoPs (120+ edge locations) and route over separate connections to origin ALBs. When a 90-day certificate expires at the edge, browsers abort during the TLS handshake before any HTTP request reaches your servers—so internal VPC probes and origin metrics look 100% healthy while every customer is locked out.

02
STAGE 02 · IMPACTL5 · APPLIED DESIGN

Blind spots in origin-only monitoring and silent ACME failures.

Why this matters: The problem: see what breaks without Blind spots in origin-only monitoring and silent ACME failures under real concurrency or scale.

Three gaps combined to cause a total outage across 45 SAN/wildcard domains:

  1. Origin-Only Probing: Internal monitors hit origin.internal or used insecureSkipVerify: true, never testing the public CDN edge chain.
  2. Silent DNS-01 IAM Drift: Revoking route53:ChangeResourceRecordSets broke ACME renewal 21 days earlier with no alert.
  3. No Backup CA: Single-CA reliance leaves no fast (< 5 min) recovery path during CA rate-limits or outages.
Edge vs. Origin Blind Spot

Expired Edge Cert vs. Green Internal Probes

Browser / MobileCDN Edge (120 PoPs)Internal ProbeOrigin ALB1. TLS Handshake ->ERR_CERT_DATE_INVALID2. VPC health check (skips CDN) ->200 OK3. Fix: External Blackbox strictTLS probe4. Monitor edge AND origin mTLSexpiry

Internal VPC probes bypass the CDN edge; only external strict-TLS probes catch edge cert expiry.

Engineering Decision Framework
Problem
How to implement Automating TLS Certificate Rotation & Expiry Alerts without hitting unbounded tail latency, state divergence, or operational fragility.
Naive Solution
Use a single unpartitioned path with unbounded retries and synchronous global coordination.
Why It Fails
Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
Alternatives
Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
Engineering Decision
If latency budgets leave no room for synchronous retries, automate ACME renewals at 60 days (30 days remaining), monitor the public CDN edge with strict TLS verification (insecure_skip_verify: false), and configure a dual-CA backup issuer.
Trade-Offs
Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
Decision Exercise · Make the Call

When Automating TLS Certificate Rotation & Expiry Alerts experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?

03
STAGE 03 · NAIVE SOLUTIONL5 · APPLIED DESIGN

Naive fixes (and why they still break).

Why this matters: The problem: see what breaks without Naive fixes under real concurrency or scale.

Relying on calendar reminders, curl -k scripts, or a single ACME cron job fails in production:

  • Calendar / Manual Renewal: Breaks across 45 domains and human handoffs.
  • insecureSkipVerify: true: Masks expired leaf certs, missing intermediate CAs, and 526 Invalid SSL origin-to-CDN mTLS failures.
  • Expiry-Only Alerting: Alerting only at <= 7 days leaves too little time if a DNS-01 IAM bug or CA rate-limit blocks issuance.
Lifecycle & Failure Recovery

Naive fixes (and why they still break)

check pubkeyRBAC/ABAC matchkid/TTL mismatchUnauthenticatedSignature VerifiedPolicy AllowedExpired / Revoked
04
STAGE 04 · ENTERPRISE SOLUTIONL6 · SCALE & TRADE-OFFS

Enterprise solution: 33% Renewal Buffer, Edge Blackbox Probes & Dual-CA.

Why this matters: Operational control: configure bounds, failure handling, and safe production defaults.

Implement a closed-loop automated TLS pipeline:

  • Early ACME Renewal: Renew 90-day certs at 60 days (renewBefore: 720h), giving a 30-day runway before expiry.
  • Pipeline & Edge Observability: Alert immediately (P2) on certmanager_certificate_ready_status == 0 or failed renewal attempts, and run external blackbox_exporter probes (45 domains × 3 regions × 1/min = 2.25 handshakes/sec) with insecure_skip_verify: false checking both public edge and origin-facing TLS (<= 21d warn, <= 7d page).
  • Hot-Swappable Dual-CA: Pre-authorize both Let's Encrypt and Google Trust Services / ZeroSSL in DNS CAA records so failover completes in < 5 min without dropping TLS 1.3 sessions.
Zero-Touch TLS Lifecycle

90-Day Cert Renewal, Verification & Dual-CA Failover

30d remaining (720h)Zero-downtime edge deployPrimary ACME fails /…CAA pre-authorized issueACTIVE (0-60d)Edge probes 200 + chain RENEW (Day 60)ACME DNS-01 primary CABACKUP CAZeroSSL/GTS (<5m swap)

Renewing at 60 days with dual-CA CAA records provides a 30-day safety buffer and <5-minute failover.

# Prometheus blackbox_exporter strict edge TLS module
modules:
  http_2xx_strict_tls:
    prober: http
    timeout: 5s
    http:
      tls_config:
        insecure_skip_verify: false
# Alert rules:
# 1) probe_ssl_earliest_cert_expiry - time() < 86400 * 21  -> P2 Warning
# 2) probe_ssl_earliest_cert_expiry - time() < 86400 * 7   -> P1 Page
# 3) certmanager_certificate_ready_status == 0             -> P2 Renewal Broken
05
STAGE 05 · SYSTEM DESIGN APPLICATIONSL7 · STAFF / PRINCIPAL

Where automated TLS lifecycles are used.

Why this matters: Scope boundary: identify where this pattern fits best and where simpler or async alternatives win.

Automated short-lived certificate rotation underpins both public edge security and internal zero-trust meshes:

  • Multi-CDN & Edge Gateways: Cloudflare, Fastly, and AWS CloudFront automate 90-day ACME renewals with CT-log monitoring.
  • Kubernetes Service Meshes (SPIFFE/Istio): Rotate workload mTLS SVIDs every few hours automatically via cert-manager and Envoy SDS.
Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

Why must synthetic TLS probes target the public CDN hostname with `insecure_skip_verify: false` and also alert on `certmanager_certificate_ready_status == 0`?

Recommended Learning Flow