broker: pre-challenge wildcard CNAME poisons resolver caches against the delegation — DNS-01 first-issuance races a 300s stale window (finish-leg reds) #547
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Reference
Matou/idss#547
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What breaks
Every own-VPS founding races its own DNS caches — and mostly loses. Drives
20260814T202512Z,214116Z(and221459Zunless it wins the lottery) all red at the finish leg with the same signature: every Caddy DNS-01 order (wildcard + apex, production + staging fallback) dies ontimed out waiting for record to fully propagate, soid.<apex>never answers TLS inside the door budget.The mechanism (live-probed 22:14–22:26Z, drive 221459Z)
*.<slug> CNAME <slug>(ADR 0100). The wildcard matches_acme-challenge.<slug>._acme-challenge → apex, TXT NODATA) at TTL 300._acme-challengeCNAME +acme.<slug>NS + glue — but each resolver cache node keeps the poisoned chain for up to 300s. Per-attempt propagation timeout (~120s) + certmagic backoff means attempts 1–3 usually straddle stale caches, and the 120×5s door budget expires first. A lottery: drive 171114Z drew a green ("certs first-try"), the next three drew red.Probe evidence (same instant, 22:24:28Z):
@8.8.8.8→ CNAMEdced5343-….acme.rehearsal-b.idss.nz, TXT"TVC43ykIqEBpuRFnh0nBIon3jiCiAMbey3A9wn2NQFk"— delegation correct, droplet acme-dns reachable from outside (kills the "syd1 inbound :53" theory).@1.1.1.1(checker's primary) → still_acme-challenge → rehearsal-b.idss.nz(the stale wildcard chain), TXT empty; converged only at 22:25:58Z.@9.9.9.9still stale after that.Fix directed
cfDefaultTTL300 → 60 inbroker/internal/broker/zone.go(Cloudflare's explicit floor). Bounds every stale window to one minute so Caddy's second attempt sees the truth. Seam test pins TTL ≤ 60 on all five records PutRecords writes.Complementary, not sufficient: #532's cert-store persistence (skips issuance on RE-drives only — first foundings still race).
Also observed (note, not this ticket's scope)
After production-CA attempts fail, Caddy falls back to the LE staging CA (order URLs flip to acme-staging-v02) — if a staging cert ever wins, the door serves an untrusted cert. Worth a GOTCHAS eye when this lands.
Filed from the live probe session; #492's deferred 'finish' diagnosis — reporter was limit-parked at filing time.
swarm-claim host=elitebook-distributed-server-03 run=6423
(automated multi-host claim — lowest live claim id works this ticket)
close-report for #547 — status
success⛔ close-report gates REFUSED this close — the following claims did not verify:
d1a3d59is not reachable from origin/main (not landed on main)envelope
close-report for #547 — status
success✅ close-report gates passed — every claim verified against main; closing.
envelope
AMENDED DIRECTION (read before closing) — #548's forensics on drive 221459Z confirm the mechanism AND narrow the fix: the wildcard issued on its first post-convergence retry, but the APEX order kept failing propagation for the whole run. A poisoned cache node can hold a NEGATIVE answer (TXT NODATA via the wildcard chain) whose TTL rides Cloudflare's SOA minimum (RFC 2308), NOT our record TTL — so TTL 300→60 shrinks the positive-stale window but cannot bound the negative one. Land BOTH: (1) cfDefaultTTL 300→60 + seam test as directed; (2) close the poisoning window at its source — gate Caddy's first start on the delegation being live: a pre-start oneshot (or ExecStartPre) on the gateway that polls
dig +short CNAME _acme-challenge.<apex> @1.1.1.1(and @8.8.8.8) until it returns the acme-dns fulldomain, bounded (~5 min, fail-open with a loud journal line so the door never deadlocks on a broker outage). The heartbeat writes that CNAME ~90s after boot, so the gate typically waits <2 min and saves 3 wasted ACME attempts + the cache poisoning entirely. If the render side is too big for this ticket, land (1) + file the gate as a directed follow-up — do NOT close #547 as sufficient on (1) alone. Staging-flip note for the GOTCHAS entry: certmagic retries against the LE test CA by design after a failed attempt (rate-limit protection) — benign, switches back on success.