Runbook: Certificate Expiry

Last updated 2 min read
Report issue

Runbook: Certificate Expiry#

When you see: HTTPS errors, browsers warning about expired certs, monitoring alerts about cert expiry within 14 days.

Severity: SEV-3 if 14-7 days out; SEV-2 if <7 days; SEV-1 if already expired and customer-visible.

Architecture recap#

GritivaCore TLS lives in two places:

  • Edge (Cloudflare) — wildcard *.gritiva.com cert managed by Cloudflare. You do nothing. Auto-renewed.
  • Per-domain (DRM) — when you add app.example.com in the panel under Domains -> Add domain, DRM either uses Cloudflare's edge cert OR provisions a Let's Encrypt cert inside the scope's nginx. The Let's Encrypt path is what can expire.

Diagnose#

Step 1 — Identify which domains are at risk#

Open DOMAINS in the panel — each row shows the domain, its scope and its certificate state. Scripted:

BASH
curl -s https://api.gritiva.com/api/v1/domains/me -H "X-API-Key: $GRITIVA_API_KEY"

Any domain expiring in under 14 days, or holding a Let's Encrypt certificate, deserves attention.

Step 2 — Check the renewal timer#

On the VM hosting the scope (panel -> VMs -> Web terminal, or SSH):

BASH
sudo systemctl status certbot.timer
# expect: active (waiting); Trigger: <future date>

If Failed or absent, certbot can't run.

Step 3 — Check the renewal logs#

BASH
sudo journalctl -u certbot --since "7 days ago" | tail -50

Look for Failed authorization, connection refused, rate limited.

Mitigate#

Force a renewal now#

BASH
sudo certbot renew --force-renewal

If the renewal fails for the same reason it's been failing, fix the underlying cause first (see below).

Switch to Cloudflare edge cert (avoids LE entirely)#

In the panel, open Domains -> app.example.com and route the domain through Cloudflare's wildcard cert instead of a per-domain Let's Encrypt cert. No per-domain provisioning is then needed.

Fix (durable)#

Common causes of LE renewal failure:

  1. Port 80 not reachable from public internet (LE HTTP-01 challenge needs it). For scopes behind cloudflared tunnels, switch to DNS-01 challenge.
  2. Rate limited — LE limits to 50 certs per registered domain per week. If you hit it, switch to CF edge cert temporarily.
  3. DNS misconfiguration — dig +short app.example.com should return a Cloudflare IP. If it's pointing at your VM directly, the routing is wrong.

Prevention#

The DRM reconciler emits an expires_soon event 14 days before expiry. Alerting on it is configured in Grafana at https://monitor.gritiva.com — add an alert rule there and point its contact point at your Slack incoming webhook. The DOMAINS page in the panel is the manual equivalent if you'd rather check by hand.