broker: a destroyed rented gateway leaves its community's DNS pointed at a released IP — rehearsal-c.idss.nz + its wildcard resolve to a droplet DigitalOcean has taken back #758

Closed
opened 2026-08-25 00:37:24 +00:00 by matou-build-agent · 3 comments

Split out of #757 (rule 1: file follow-ups, don't widen the ticket).

The hazard

Rentals holds no Zone and no Registry: Release and Reap destroy the droplet and mark the lease released, and nothing touches the DNS records that name it. So the moment the broker tears a rented gateway down, the community's <slug>.idss.nz A record — and the *.<slug> wildcard CNAME riding it — keep resolving to an IP DigitalOcean has already returned to its pool.

Only Issuer.Offboard deletes those records, and it needs the slug's claim secret (the community's, not the broker's). A red drive, a lost secret, or a community that simply stops renewing never reaches it.

Live evidence (2026-08-25T00:2xZ, from dig + doctl)

Authoritative NS (dolly.ns.cloudflare.com):

rehearsal-c.idss.nz                A     168.144.165.255
*.rehearsal-c.idss.nz              CNAME rehearsal-c.idss.nz.
_acme-challenge.rehearsal-c.idss.nz CNAME 1d9420c8-5fe0-4c33-b330-bc1291286403.acme.rehearsal-c.idss.nz.
acme-dns.rehearsal-c.idss.nz       A     168.144.165.255

doctl compute droplet list in the Matou account holds no idss-gateway-* droplet at all — the box at 168.144.165.255 is gone (the #756 reaper did its job). https://rehearsal-c.idss.nz/ times out.

So 168.144.165.255 is a released DigitalOcean address that our zone still names, wildcard included. Whoever DO hands it to next serves rehearsal-c.idss.nz and every *.rehearsal-c.idss.nz name — including, if they ask for it, a browser-trusted certificate for both, since _acme-challenge.<slug> still delegates to an acme-dns registration on the same dead host.

This is a rehearsal slug, so the blast radius today is a drive name. The same code path is what a real alpha community's name rides.

Why it isn't #757's fix

#757 is about the RESERVATION ledger (who owns the name) and is fixed harness-side. This is the ZONE (what the name resolves to) and is broker-side. They meet only in Issuer.Offboard, which needs a secret neither the reaper nor the release path holds.

What a fix has to weigh

  • The broker destroying a droplet it created is its own authority; deleting records that name that droplet's IP is correcting a lie, not taking anything from anyone. Scoping the delete to records whose value is the destroyed droplet's IP keeps a community that has already re-pointed at their own VPS untouched — the ordering hazard that makes an unconditional delete unsafe.
  • Whether teardown should also un-redeem the reservation (starting #754's 24h clock, since the name no longer points at a live gateway) is a genuine #278 question and should be decided on its own, not smuggled in: a real community whose lease lapses while they are offline would become re-claimable a day later. Recommend deciding it explicitly, and separately from the record deletion above.
  • docs/GOTCHAS.md #80 (as amended by #757) and ADR 0189 are the places the outcome is recorded.

Provable

Seam-testable entirely inside broker/internal/broker with the existing fake zone/provider (rentals_test.go, zone_test.go idiom): destroy a rental, assert the record set for its slug is gone when the records still name the destroyed IP, and assert it is LEFT ALONE when they name something else.

Split out of #757 (rule 1: file follow-ups, don't widen the ticket). ## The hazard `Rentals` holds no `Zone` and no `Registry`: `Release` and `Reap` destroy the droplet and mark the lease released, and **nothing touches the DNS records that name it**. So the moment the broker tears a rented gateway down, the community's `<slug>.idss.nz` A record — and the `*.<slug>` wildcard CNAME riding it — keep resolving to an IP DigitalOcean has already returned to its pool. Only `Issuer.Offboard` deletes those records, and it needs the slug's claim secret (the community's, not the broker's). A red drive, a lost secret, or a community that simply stops renewing never reaches it. ## Live evidence (2026-08-25T00:2xZ, from `dig` + `doctl`) Authoritative NS (`dolly.ns.cloudflare.com`): ``` rehearsal-c.idss.nz A 168.144.165.255 *.rehearsal-c.idss.nz CNAME rehearsal-c.idss.nz. _acme-challenge.rehearsal-c.idss.nz CNAME 1d9420c8-5fe0-4c33-b330-bc1291286403.acme.rehearsal-c.idss.nz. acme-dns.rehearsal-c.idss.nz A 168.144.165.255 ``` `doctl compute droplet list` in the Matou account holds **no `idss-gateway-*` droplet at all** — the box at `168.144.165.255` is gone (the #756 reaper did its job). `https://rehearsal-c.idss.nz/` times out. So `168.144.165.255` is a released DigitalOcean address that our zone still names, wildcard included. Whoever DO hands it to next serves `rehearsal-c.idss.nz` and every `*.rehearsal-c.idss.nz` name — including, if they ask for it, a browser-trusted certificate for both, since `_acme-challenge.<slug>` still delegates to an acme-dns registration on the same dead host. This is a rehearsal slug, so the blast radius today is a drive name. The same code path is what a real alpha community's name rides. ## Why it isn't #757's fix #757 is about the RESERVATION ledger (who owns the name) and is fixed harness-side. This is the ZONE (what the name resolves to) and is broker-side. They meet only in `Issuer.Offboard`, which needs a secret neither the reaper nor the release path holds. ## What a fix has to weigh - The broker destroying a droplet it created is its own authority; deleting records that name **that droplet's IP** is correcting a lie, not taking anything from anyone. Scoping the delete to *records whose value is the destroyed droplet's IP* keeps a community that has already re-pointed at their own VPS untouched — the ordering hazard that makes an unconditional delete unsafe. - Whether teardown should also **un-redeem** the reservation (starting #754's 24h clock, since the name no longer points at a live gateway) is a genuine #278 question and should be decided on its own, not smuggled in: a real community whose lease lapses while they are offline would become re-claimable a day later. Recommend deciding it explicitly, and separately from the record deletion above. - `docs/GOTCHAS.md` #80 (as amended by #757) and ADR 0189 are the places the outcome is recorded. ## Provable Seam-testable entirely inside `broker/internal/broker` with the existing fake zone/provider (`rentals_test.go`, `zone_test.go` idiom): destroy a rental, assert the record set for its slug is gone when the records still name the destroyed IP, and assert it is LEFT ALONE when they name something else.
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime. Ruling: the DNS-record-deletion fix (scoped to records whose value is the destroyed droplet's IP) is a two-way door — revertible by commit, and provable entirely offline against the existing fake zone/provider test doubles (rentals_test.go/zone_test.go idiom), as the ticket itself lays out. It is not on the one-way-door list: it narrows an existing exposure (a dangling public DNS record naming a released IP — a subdomain-takeover-shaped hazard) rather than widening any security posture, touches no personal credentials, involves no member-facing trust accept (the broker is destroying and cleaning up after its own droplet, not accepting or rejecting a member action), destroys no member data, and spends nothing. Proceeding to ready-for-agent.

Scope note carried forward from the ticket: the un-redeem/reservation-reclaim-clock question the ticket flags (#278-adjacent) is a genuine separate policy call — it is explicitly out of scope below, not smuggled into this fix, matching the ticket's own recommendation.

Verified against the current code: Rentals.Release and Rentals.Reap destroy the droplet and mark the lease released; neither touches any DNS zone or registry — there is no Zone or Registry reference anywhere in the rentals code. The hazard is real and unmitigated.

Agent Brief

Category: bug
Summary: When the broker destroys a rented gateway's droplet, it must also remove the DNS records that named that droplet's IP — otherwise the community's hostname (and wildcard) keep resolving to an address DigitalOcean has returned to its pool.

Current behavior:
Release and Reap destroy the droplet and mark the lease released. Nothing touches the DNS zone. The <slug>.idss.nz A record and its *.<slug> wildcard CNAME continue to resolve to the now-released IP indefinitely, until (if ever) Issuer.Offboard runs — which needs a secret the broker's teardown path doesn't hold. Only a full offboard clears the dangling records; a red drive, a lost secret, or a lapsed community never reaches it.

Desired behavior:
When the broker tears down a rented gateway it created, it also deletes the DNS record(s) for that rental's slug — but ONLY the records whose current value names the destroyed droplet's IP. A community that has already re-pointed its name at its own infrastructure (a different IP) must be left untouched — this scoping is what makes an otherwise-unconditional delete safe.

Key interfaces:

  • Rentals needs a way to reach the zone/registry for the slug at teardown time (the ticket suggests holding a Zone/Registry reference or equivalent, but the exact wiring is an implementation choice).
  • The delete operation must be conditioned on the record's current value matching the destroyed droplet's IP — not an unconditional delete by slug.
  • Both Release and Reap (both the direct-release and the timeout/lapsed-reap paths) must apply this cleanup, since either can be the path that destroys the droplet.

Acceptance criteria:

  • After Release or Reap destroys a droplet, DNS records for that rental's slug that still name the destroyed IP are removed.
  • A record for the same slug that has been re-pointed to a different IP (e.g. a community's own VPS) is left untouched by teardown.
  • Seam test (offline, using the existing fake zone/provider doubles): destroy a rental, assert matching-IP records are gone; destroy a rental whose records point elsewhere, assert they're untouched.
  • docs/GOTCHAS.md #80 and ADR 0189 are updated to record the outcome, per the ticket's own note on where this gets documented.

Out of scope:

  • Whether teardown should also start the reservation's 24h reclaim clock (un-redeem) — a separate, genuine policy question (adjacent to #278) that should be decided and filed on its own, not folded into this fix.
  • Issuer.Offboard's existing full-offboard path — unaffected, still the authoritative full cleanup when the community's claim secret is available.
  • #757's reservation-ledger fix — that's the harness-side half; this is the zone-side half, and they only meet at Issuer.Offboard.
> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** Ruling: the DNS-record-deletion fix (scoped to records whose value is the destroyed droplet's IP) is a two-way door — revertible by commit, and provable entirely offline against the existing fake zone/provider test doubles (`rentals_test.go`/`zone_test.go` idiom), as the ticket itself lays out. It is not on the one-way-door list: it narrows an existing exposure (a dangling public DNS record naming a released IP — a subdomain-takeover-shaped hazard) rather than widening any security posture, touches no personal credentials, involves no member-facing trust *accept* (the broker is destroying and cleaning up after its own droplet, not accepting or rejecting a member action), destroys no member data, and spends nothing. Proceeding to `ready-for-agent`. **Scope note carried forward from the ticket:** the un-redeem/reservation-reclaim-clock question the ticket flags (#278-adjacent) is a genuine separate policy call — it is explicitly out of scope below, not smuggled into this fix, matching the ticket's own recommendation. Verified against the current code: `Rentals.Release` and `Rentals.Reap` destroy the droplet and mark the lease released; neither touches any DNS zone or registry — there is no `Zone` or `Registry` reference anywhere in the rentals code. The hazard is real and unmitigated. ## Agent Brief **Category:** bug **Summary:** When the broker destroys a rented gateway's droplet, it must also remove the DNS records that named that droplet's IP — otherwise the community's hostname (and wildcard) keep resolving to an address DigitalOcean has returned to its pool. **Current behavior:** `Release` and `Reap` destroy the droplet and mark the lease released. Nothing touches the DNS zone. The `<slug>.idss.nz` A record and its `*.<slug>` wildcard CNAME continue to resolve to the now-released IP indefinitely, until (if ever) `Issuer.Offboard` runs — which needs a secret the broker's teardown path doesn't hold. Only a full offboard clears the dangling records; a red drive, a lost secret, or a lapsed community never reaches it. **Desired behavior:** When the broker tears down a rented gateway it created, it also deletes the DNS record(s) for that rental's slug — but ONLY the records whose current value names the destroyed droplet's IP. A community that has already re-pointed its name at its own infrastructure (a different IP) must be left untouched — this scoping is what makes an otherwise-unconditional delete safe. **Key interfaces:** - `Rentals` needs a way to reach the zone/registry for the slug at teardown time (the ticket suggests holding a `Zone`/`Registry` reference or equivalent, but the exact wiring is an implementation choice). - The delete operation must be conditioned on the record's current value matching the destroyed droplet's IP — not an unconditional delete by slug. - Both `Release` and `Reap` (both the direct-release and the timeout/lapsed-reap paths) must apply this cleanup, since either can be the path that destroys the droplet. **Acceptance criteria:** - [ ] After `Release` or `Reap` destroys a droplet, DNS records for that rental's slug that still name the destroyed IP are removed. - [ ] A record for the same slug that has been re-pointed to a different IP (e.g. a community's own VPS) is left untouched by teardown. - [ ] Seam test (offline, using the existing fake zone/provider doubles): destroy a rental, assert matching-IP records are gone; destroy a rental whose records point elsewhere, assert they're untouched. - [ ] `docs/GOTCHAS.md` #80 and ADR 0189 are updated to record the outcome, per the ticket's own note on where this gets documented. **Out of scope:** - Whether teardown should also start the reservation's 24h reclaim clock (un-redeem) — a separate, genuine policy question (adjacent to #278) that should be decided and filed on its own, not folded into this fix. - `Issuer.Offboard`'s existing full-offboard path — unaffected, still the authoritative full cleanup when the community's claim secret is available. - #757's reservation-ledger fix — that's the harness-side half; this is the zone-side half, and they only meet at `Issuer.Offboard`.
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=10599
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=10599 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #758 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 758,
  "status": "success",
  "commits": [
    "4d2573ac8d24b1aca6c8044e007efb5beb084457"
  ],
  "changed_files": [
    "STATUS.md",
    "broker/cmd/broker/main.go",
    "broker/internal/broker/broker.go",
    "broker/internal/broker/broker_test.go",
    "broker/internal/broker/http_rent_test.go",
    "broker/internal/broker/rentals.go",
    "broker/internal/broker/rentals_expiry_live_test.go",
    "broker/internal/broker/rentals_test.go",
    "broker/internal/broker/rentals_zone_cleanup_test.go",
    "broker/internal/broker/zone.go",
    "broker/internal/broker/zone_test.go",
    "docs/GOTCHAS.md",
    "docs/adr/0189-rented-gateways-free-while-alpha-ttl-reaped-pubkey-in-release-on-abandon.md"
  ],
  "tests": [
    {
      "command": "go test ./internal/broker/",
      "exit_code": 0
    },
    {
      "command": "go vet ./...",
      "exit_code": 0
    },
    {
      "command": "gofmt -l internal/broker/ cmd/broker/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "After Release or Reap destroys a droplet, DNS records for that rental's slug that still name the destroyed IP are removed": "rentals.go cleanupRecordsForIP called from Release + Reap after Destroy; proven by TestRelease_ClearsRecordsNamingTheDestroyedIP + TestReap_ClearsRecordsNamingTheDestroyedIP (rentals_zone_cleanup_test.go)",
    "A record for the same slug re-pointed to a different IP is left untouched by teardown": "Zone.DeleteRecordsForIP scopes the delete to the slug's A record naming the destroyed IP; proven by TestRelease_LeavesRecordsAloneWhenRepointed + the re-pointed 'b' host in TestReap_ClearsRecordsNamingTheDestroyedIP + TestCloudflareZone_DeleteRecordsForIPLeavesRepointedNameAlone",
    "Seam test (offline, fake zone/provider doubles): matching-IP records gone; elsewhere-pointed records untouched": "rentals_zone_cleanup_test.go + zone_test.go scoped-delete cases, all offline over fakeZone/scriptedCF/FakeProvider",
    "docs/GOTCHAS.md #80 and ADR 0189 updated to record the outcome": "GOTCHAS #80 amended (#758 zone half); ADR 0189 amendment 2026-08-26 (#758) added"
  },
  "summary": "Broker teardown (Release + Reap) now clears the DNS records naming a destroyed rented gateway's IP, scoped to that IP so a re-pointed community is untouched.",
  "blockers": []
}
**close-report** for #758 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 758, "status": "success", "commits": [ "4d2573ac8d24b1aca6c8044e007efb5beb084457" ], "changed_files": [ "STATUS.md", "broker/cmd/broker/main.go", "broker/internal/broker/broker.go", "broker/internal/broker/broker_test.go", "broker/internal/broker/http_rent_test.go", "broker/internal/broker/rentals.go", "broker/internal/broker/rentals_expiry_live_test.go", "broker/internal/broker/rentals_test.go", "broker/internal/broker/rentals_zone_cleanup_test.go", "broker/internal/broker/zone.go", "broker/internal/broker/zone_test.go", "docs/GOTCHAS.md", "docs/adr/0189-rented-gateways-free-while-alpha-ttl-reaped-pubkey-in-release-on-abandon.md" ], "tests": [ { "command": "go test ./internal/broker/", "exit_code": 0 }, { "command": "go vet ./...", "exit_code": 0 }, { "command": "gofmt -l internal/broker/ cmd/broker/", "exit_code": 0 } ], "criteria": { "After Release or Reap destroys a droplet, DNS records for that rental's slug that still name the destroyed IP are removed": "rentals.go cleanupRecordsForIP called from Release + Reap after Destroy; proven by TestRelease_ClearsRecordsNamingTheDestroyedIP + TestReap_ClearsRecordsNamingTheDestroyedIP (rentals_zone_cleanup_test.go)", "A record for the same slug re-pointed to a different IP is left untouched by teardown": "Zone.DeleteRecordsForIP scopes the delete to the slug's A record naming the destroyed IP; proven by TestRelease_LeavesRecordsAloneWhenRepointed + the re-pointed 'b' host in TestReap_ClearsRecordsNamingTheDestroyedIP + TestCloudflareZone_DeleteRecordsForIPLeavesRepointedNameAlone", "Seam test (offline, fake zone/provider doubles): matching-IP records gone; elsewhere-pointed records untouched": "rentals_zone_cleanup_test.go + zone_test.go scoped-delete cases, all offline over fakeZone/scriptedCF/FakeProvider", "docs/GOTCHAS.md #80 and ADR 0189 updated to record the outcome": "GOTCHAS #80 amended (#758 zone half); ADR 0189 amendment 2026-08-26 (#758) added" }, "summary": "Broker teardown (Release + Reap) now clears the DNS records naming a destroyed rented gateway's IP, scoped to that IP so a re-pointed community is untouched.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#758
No description provided.