rented gateway: the _acme-challenge delegation is written once at control-plane boot and never retried — a lost race against acme-dns-register leaves a permanently dead TLS door (#915's fix is a no-op on this path) #921

Closed
opened 2026-08-28 04:32:37 +00:00 by matou-build-agent · 1 comment

Failure

Drive 20260828T031915Z (target device, commit 6fc7fba1) red at leg activation (bubbled up as standing), signature 25304f657c24 — the third drive lost to this signature.

the gateway deploy failed — The gateway deploy failed. [There is no old operating system to roll back to — this server was rented fresh for the community, so nothing of yours was overwritten.]

artifacts/legs.json — 15 green, activation red at 650684 ms; artifacts/verdict.json firstRedLeg: standing.

Evidence

logs/founding-state.log:60-73 — deploy.outcome: "failed", and the ONLY failed step is public-entry; control-plane, dashboard, brand, admin and mesh are all done. logs/founding-state.log:633-637 names the kind and the remedy:

"kind": "delegation" … a door that never even begins to answer points at an absent or wrong _acme-challenge.<apex> delegation … the five-record PutRecords set, with _acme-challenge.<slug> at the gateway's acme-dns fulldomain

The probe log runs probe 1/120 → probe 119/120 at 5 s (founding-state.log:142-618) — ~600 s, which is the bulk of the leg's 650 s.

Live DNS on the still-standing droplet confirms the delegation was never written:

_acme-challenge.rehearsal-c.idss.nz. CNAME rehearsal-c.idss.nz.   # the *.<slug> wildcard, not a fulldomain
acme.rehearsal-c.idss.nz.           (no NS)                        # no delegation, no glue
rehearsal-c.idss.nz.                A 170.64.155.97                # A + wildcard landed fine

That is byte-for-byte the record set broker/internal/broker/zone.go:206-228 writes when rec.AcmeChallenge is empty — the if c := strings.TrimSpace(rec.AcmeChallenge); c != "" guard at zone.go:209 never fired.

The defect

On the rented path the delegation is written by exactly one thing, once, with no retry:

  1. The app's pre-install point writes it empty by design. internal/founding/rentedpath.go:200-203 → internal/founding/ownvpspath.go:509:

    if err := o.broker.PointSubdomain(ctx, d.Address.Host, ip, "", d.Address.Secret); err != nil {
    

    with the comment at ownvpspath.go:506-508: "the box is not installed yet, so it publishes no acme-dns fulldomain… The gateway's heartbeat re-points with the challenge once it is up (ADR 0136)". The whole repair is delegated to the heartbeat.

  2. The heartbeat is the sole writer. control-plane/cmd/control-plane/main.go:578-579:

    repoint := heartbeat.RepointerFunc(func(ctx context.Context, ip string) error {
        return client.PointSubdomain(ctx, apex, ip, readAcmeChallenge(), secret)
    })
    

    readAcmeChallenge() (main.go:612-618) is a single best-effort os.ReadFile of clan.AcmeDNSFulldomainFact (internal/clan/acmedns.go:60 = /var/lib/idss-acmedns/fulldomain); absent → "".

  3. The heartbeat only ever re-points on ADDRESS drift. internal/heartbeat/heartbeat.go:260:

    if ip == lastIP && !owed && live == ip {
        h.confirmCurrent(ip); h.renewLease(ctx); return
    }
    

    live is the <slug> A record (main.go:582-585, dns.AuthoritativeReader). Nothing in Tick reads or reconciles the _acme-challenge CNAME the heartbeat is the only writer of.

  4. So the write happens exactly once, at the worst moment. Heartbeat.Run (heartbeat.go:221) ticks IMMEDIATELY at control-plane start, then every addressHeartbeatInterval = 5 min (main.go:86). IDSS_GATEWAY_IP is never exported by any render (grep across *.go/*.nix finds only the two consumer sites in main.go), so WithKnownIP is unset, lastIP == "", and the very first tick re-points. If acme-dns-register has not yet published the fulldomain at that instant, that one write carries "" — then markPointed sets lastIP, and from the 5-minute tick onward ip == lastIP && live == ip holds forever. The delegation is never written for the life of the community.

  5. The consequence is a guaranteed dead door. The #554 delegation gate (internal/clan/acmedns.go:326-367) polls the CNAME for ~5 min then FAILS OPEN (acmedns.go:363-366), so Caddy starts and burns DNS-01 orders against a delegation-less name; :443 never serves; public-entry exhausts its 120 probes and the deploy reds. internal/clan/acmedns.go:294 and :348 encode the assumption that is now false: "the heartbeat writes ~90s after boot, so this typically releases in under two minutes." The heartbeat writes at t≈0, not t≈90s, and never again.

Why #915 did not catch this

Commit 6fc7fba1 ("gate the acme-challenge point on the fulldomain fact") added ChallengeTimeout/ChallengePoll polling to internal/fleetwire/challenge.go:110-155 and wired a 2 min / 5 s budget at app/helper/cmd/helper/wiring_prod.go:537-544. That source is reached ONLY through Orchestrator.acmeChallenge → wireName (internal/founding/standup.go:963), and wireName has exactly one caller: RunReachability (internal/founding/standup.go:810) — the self-hosted S10 path. The rented journey never calls it. logs/founding-state.log:817-819 records the skip verbatim: "paired — the community name was aimed at the server before install, so the public reachability check is skipped; the gateway deploy begins".

So the #915 fix is a no-op for the journey that produced the #915 report. The compiled binary is confirmed to carry it (strings app/.dev/helper contains fleetwire: gateway published no acme-dns fulldomain within %s and no foundingtesting symbols), and no founding: read acme-dns challenge error appears anywhere in founding-state.log — the gate never ran.

Suspected layer

internal/heartbeat + the gateway's acme-dns unit ordering (internal/clan/acmedns.go) — NOT the app-side internal/fleetwire seam #915 patched.

What plugging it needs

A ruling on which of these owns the repair (this is why it is filed, not healed — ADR 0136 scopes the heartbeat to the address, so making it delegation-aware is a contract change, and the alternative is a gateway unit-ordering change):

  1. Make the heartbeat delegation-aware. Give it a challenge reader + a live-CNAME reader alongside LiveRecordReader, and add the challenge to the heartbeat.go:260 short-circuit: re-point whenever the readable fulldomain is non-empty and the live _acme-challenge.<slug> CNAME does not already answer it. This is the #642 amendment's own logic ("reconcile external drift even when the address hasn't changed") extended to the second record family the heartbeat exclusively owns. Needs a red-first seam test in internal/heartbeat/heartbeat_test.go: fact appears after the first tick → second tick re-points with it; fact matches the live CNAME → silent.
  2. Or order the control plane after the registration. Have idss-control-plane.service order After=acme-dns-register.service on the gateway render so the first tick cannot lose the race. Cheaper, but it only narrows the window — a re-registration or a broker outage still strands the delegation with no retry, so (1) is likely needed regardless.
  3. Either way, correct the stale comments at internal/clan/acmedns.go:294 and :348 ("the heartbeat writes ~90s after boot"), and the ownvpspath.go:506-508 comment that promises a repair the heartbeat does not actually perform.

Do not re-attempt this on the internal/fleetwire ChallengeSource — that path is unreachable from the rented journey.

Evidence absent from this run

  • state/clan-config and the rest of state/ — empty; logs/state-logs.log records ENOENT ... /test-results/standing-rented/state/logs.
  • No droplet-journal.txt; this device drive harvests device-journal.txt (the executor box) and gateway-journal.txt instead.
  • No gateway-side journal at all. All four gateway harvests (gateway-journal.txt, gateway-units.txt, gateway-stall.txt, gateway-caddy.txt) failed with root@170.64.155.97: Permission denied (publickey,keyboard-interactive), even though logs/gateway-do-forensics.txt shows the box up and tcp/22 accepting a fresh connect. So there is no direct proof of the acme-dns-register vs control-plane boot ordering on THIS droplet — the diagnosis rests on the code path plus the live DNS state, which are unambiguous about the outcome. A gateway-harvest auth failure on a red rented drive is worth its own look; without it, the acme-dns-register.service and acme-dns-gate.service journals that would timestamp the race are unrecoverable.
  • logs/broker-journal.txt — off-mesh, harvests nothing by design (#681).

drive 20260828T031915Z red at standing: the gateway deploy failed — The gateway deploy failed. [There is no old operating system to roll back to — this server was rented fresh for the community, so nothing of yours was overwritten.]
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T031915Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## Failure Drive `20260828T031915Z` (target `device`, commit `6fc7fba1`) red at leg `activation` (bubbled up as `standing`), signature `25304f657c24` — the third drive lost to this signature. ``` the gateway deploy failed — The gateway deploy failed. [There is no old operating system to roll back to — this server was rented fresh for the community, so nothing of yours was overwritten.] ``` `artifacts/legs.json` — 15 green, `activation` red at 650684 ms; `artifacts/verdict.json` `firstRedLeg: standing`. ## Evidence `logs/founding-state.log:60-73` — `deploy.outcome: "failed"`, and the ONLY failed step is `public-entry`; `control-plane`, `dashboard`, `brand`, `admin` and `mesh` are all `done`. `logs/founding-state.log:633-637` names the kind and the remedy: > `"kind": "delegation"` … `a door that never even begins to answer points at an absent or wrong _acme-challenge.<apex> delegation` … `the five-record PutRecords set, with _acme-challenge.<slug> at the gateway's acme-dns fulldomain` The probe log runs `probe 1/120` → `probe 119/120` at 5 s (`founding-state.log:142-618`) — ~600 s, which is the bulk of the leg's 650 s. Live DNS on the still-standing droplet confirms the delegation was never written: ``` _acme-challenge.rehearsal-c.idss.nz. CNAME rehearsal-c.idss.nz. # the *.<slug> wildcard, not a fulldomain acme.rehearsal-c.idss.nz. (no NS) # no delegation, no glue rehearsal-c.idss.nz. A 170.64.155.97 # A + wildcard landed fine ``` That is byte-for-byte the record set `broker/internal/broker/zone.go:206-228` writes when `rec.AcmeChallenge` is empty — the `if c := strings.TrimSpace(rec.AcmeChallenge); c != ""` guard at `zone.go:209` never fired. ## The defect On the rented path the delegation is written by exactly one thing, once, with no retry: 1. **The app's pre-install point writes it empty by design.** `internal/founding/rentedpath.go:200-203` → `internal/founding/ownvpspath.go:509`: ```go if err := o.broker.PointSubdomain(ctx, d.Address.Host, ip, "", d.Address.Secret); err != nil { ``` with the comment at `ownvpspath.go:506-508`: *"the box is not installed yet, so it publishes no acme-dns fulldomain… The gateway's heartbeat re-points with the challenge once it is up (ADR 0136)"*. The whole repair is delegated to the heartbeat. 2. **The heartbeat is the sole writer.** `control-plane/cmd/control-plane/main.go:578-579`: ```go repoint := heartbeat.RepointerFunc(func(ctx context.Context, ip string) error { return client.PointSubdomain(ctx, apex, ip, readAcmeChallenge(), secret) }) ``` `readAcmeChallenge()` (`main.go:612-618`) is a single best-effort `os.ReadFile` of `clan.AcmeDNSFulldomainFact` (`internal/clan/acmedns.go:60` = `/var/lib/idss-acmedns/fulldomain`); absent → `""`. 3. **The heartbeat only ever re-points on ADDRESS drift.** `internal/heartbeat/heartbeat.go:260`: ```go if ip == lastIP && !owed && live == ip { h.confirmCurrent(ip); h.renewLease(ctx); return } ``` `live` is the `<slug>` **A** record (`main.go:582-585`, `dns.AuthoritativeReader`). Nothing in `Tick` reads or reconciles the `_acme-challenge` CNAME the heartbeat is the only writer of. 4. **So the write happens exactly once, at the worst moment.** `Heartbeat.Run` (`heartbeat.go:221`) ticks IMMEDIATELY at control-plane start, then every `addressHeartbeatInterval` = 5 min (`main.go:86`). `IDSS_GATEWAY_IP` is never exported by any render (grep across `*.go`/`*.nix` finds only the two consumer sites in `main.go`), so `WithKnownIP` is unset, `lastIP == ""`, and the very first tick re-points. If `acme-dns-register` has not yet published the fulldomain at that instant, that one write carries `""` — then `markPointed` sets `lastIP`, and from the 5-minute tick onward `ip == lastIP && live == ip` holds forever. **The delegation is never written for the life of the community.** 5. **The consequence is a guaranteed dead door.** The #554 delegation gate (`internal/clan/acmedns.go:326-367`) polls the CNAME for ~5 min then FAILS OPEN (`acmedns.go:363-366`), so Caddy starts and burns DNS-01 orders against a delegation-less name; `:443` never serves; `public-entry` exhausts its 120 probes and the deploy reds. `internal/clan/acmedns.go:294` and `:348` encode the assumption that is now false: *"the heartbeat writes ~90s after boot, so this typically releases in under two minutes."* The heartbeat writes at t≈0, not t≈90s, and never again. ## Why #915 did not catch this Commit `6fc7fba1` ("gate the acme-challenge point on the fulldomain fact") added `ChallengeTimeout`/`ChallengePoll` polling to `internal/fleetwire/challenge.go:110-155` and wired a 2 min / 5 s budget at `app/helper/cmd/helper/wiring_prod.go:537-544`. That source is reached ONLY through `Orchestrator.acmeChallenge` → `wireName` (`internal/founding/standup.go:963`), and `wireName` has exactly one caller: `RunReachability` (`internal/founding/standup.go:810`) — the self-hosted S10 path. **The rented journey never calls it.** `logs/founding-state.log:817-819` records the skip verbatim: *"paired — the community name was aimed at the server before install, so the public reachability check is skipped; the gateway deploy begins"*. So the #915 fix is a no-op for the journey that produced the #915 report. The compiled binary is confirmed to carry it (`strings app/.dev/helper` contains `fleetwire: gateway published no acme-dns fulldomain within %s` and no `foundingtesting` symbols), and no `founding: read acme-dns challenge` error appears anywhere in `founding-state.log` — the gate never ran. ## Suspected layer `internal/heartbeat` + the gateway's acme-dns unit ordering (`internal/clan/acmedns.go`) — NOT the app-side `internal/fleetwire` seam #915 patched. ## What plugging it needs A ruling on which of these owns the repair (this is why it is filed, not healed — ADR 0136 scopes the heartbeat to the *address*, so making it delegation-aware is a contract change, and the alternative is a gateway unit-ordering change): 1. **Make the heartbeat delegation-aware.** Give it a challenge reader + a live-CNAME reader alongside `LiveRecordReader`, and add the challenge to the `heartbeat.go:260` short-circuit: re-point whenever the readable fulldomain is non-empty and the live `_acme-challenge.<slug>` CNAME does not already answer it. This is the #642 amendment's own logic ("reconcile external drift even when the address hasn't changed") extended to the second record family the heartbeat exclusively owns. Needs a red-first seam test in `internal/heartbeat/heartbeat_test.go`: fact appears after the first tick → second tick re-points with it; fact matches the live CNAME → silent. 2. **Or order the control plane after the registration.** Have `idss-control-plane.service` order `After=acme-dns-register.service` on the gateway render so the first tick cannot lose the race. Cheaper, but it only narrows the window — a re-registration or a broker outage still strands the delegation with no retry, so (1) is likely needed regardless. 3. **Either way, correct the stale comments** at `internal/clan/acmedns.go:294` and `:348` ("the heartbeat writes ~90s after boot"), and the `ownvpspath.go:506-508` comment that promises a repair the heartbeat does not actually perform. **Do not** re-attempt this on the `internal/fleetwire` ChallengeSource — that path is unreachable from the rented journey. ## Evidence absent from this run - `state/clan-config` and the rest of `state/` — empty; `logs/state-logs.log` records `ENOENT ... /test-results/standing-rented/state/logs`. - No `droplet-journal.txt`; this device drive harvests `device-journal.txt` (the executor box) and `gateway-journal.txt` instead. - **No gateway-side journal at all.** All four gateway harvests (`gateway-journal.txt`, `gateway-units.txt`, `gateway-stall.txt`, `gateway-caddy.txt`) failed with `root@170.64.155.97: Permission denied (publickey,keyboard-interactive)`, even though `logs/gateway-do-forensics.txt` shows the box up and `tcp/22` accepting a fresh connect. So there is no direct proof of the acme-dns-register vs control-plane boot ordering on THIS droplet — the diagnosis rests on the code path plus the live DNS state, which are unambiguous about the outcome. A gateway-harvest auth failure on a red rented drive is worth its own look; without it, the `acme-dns-register.service` and `acme-dns-gate.service` journals that would timestamp the race are unrecoverable. - `logs/broker-journal.txt` — off-mesh, harvests nothing by design (#681). drive `20260828T031915Z` red at `standing`: `the gateway deploy failed — The gateway deploy failed. [There is no old operating system to roll back to — this server was rented fresh for the community, so nothing of yours was overwritten.]` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T031915Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 25304f657c24 -->
Owner

Closing as a duplicate of #922, in #922's favour (ADR 0174 — veto anytime). Same drive 20260828T031915Z, same fault; the signatures differ only because standing wraps activation (25304f657c24 vs 4c82deb1e678). #922 was already claimed (agent-working), so it keeps the work — and this ticket's sharper finding (the delegation is written once at control-plane boot and never retried, so #915's point-side gate is a no-op on this path) has been carried across in full as a comment there rather than lost.

**Closing as a duplicate of #922, in #922's favour** (ADR 0174 — veto anytime). Same drive `20260828T031915Z`, same fault; the signatures differ only because `standing` wraps `activation` (`25304f657c24` vs `4c82deb1e678`). #922 was already claimed (`agent-working`), so it keeps the work — and this ticket's sharper finding (**the delegation is written once at control-plane boot and never retried, so #915's point-side gate is a no-op on this path**) has been carried across in full as a comment there rather than lost.
ben closed this issue 2026-08-28 04:40:06 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#921
No description provided.