The broker rail cannot deploy a fix to ITSELF — the droplet's idss-broker-install is a hand-placed copy that nothing re-places or checks #872

Closed
opened 2026-08-26 18:54:23 +00:00 by ben · 2 comments
Owner

The broker's auto-deploy rail installs a binary from CI, but its own
installer — /usr/local/sbin/idss-broker-install on the mail droplet — is a
hand-placed copy of scripts/broker/idss-broker-install.sh, put there once
by a human under broker/README.md's "one-time setup". Nothing re-places it.

So the rail cannot deploy a fix to itself. Found the hard way in #745.

Why this is filed now

GOTCHAS #91: the installer's marker check was strings "$tmp" | grep -qF "$marker"
under set -o pipefail, which reports SIGPIPE (141) when grep -q exits early —
so a genuine broker binary was refused as "not a broker artifact". The repo fix is
one line. Landing it changes nothing on the droplet, because the droplet is
running a snapshot taken 2026-08-25 20:46 and there is no mechanism that notices.

That is the same shape as the two walls #745 already walked into (GOTCHAS #90's
wrong-mesh runner, then #91's SIGPIPE): a deploy path with an undeployable
component in it, silent by construction.

The concrete gap

  • broker-deploy.yml ssh's deploy@100.98.48.68 sudo /usr/local/sbin/idss-broker-install <sha>.
  • deploy's sudoers line permits only that path, and its authorized_keys
    forces that one command — correctly, this is a locked-down deploy account.
  • Therefore the rail structurally cannot update the script it invokes, and the
    repo copy and the live copy can drift arbitrarily far apart with no signal.
  • There is no check anywhere that the two are the same file.

Shape of a fix (not ruled — this is the filing)

  1. Self-updating installer. The installer already downloads a per-sha
    artifact and swaps it atomically with rollback; it could do the same for
    itself — fetch the repo's copy for the sha it was handed, and re-exec if it
    differs. Keeps the locked-down sudoers line intact (one path, one command).
    Needs care: a broken installer would then be able to break its own successor,
    so the re-exec wants the same "prove it works, else restore" discipline the
    binary swap has.
  2. Publish the installer alongside the binary. publish-broker already
    uploads ourcloud-broker-x86_64, its .sha256 and RELEASE per sha; adding
    idss-broker-install.sh makes the script versioned with the binary it
    installs. Then (1) has something to fetch.
  3. Cheapest: a drift alarm. A step that compares the live script's sha256
    against the repo's and goes red on mismatch — does not fix the drift, but
    makes it impossible for the next installer defect to be invisible for weeks.
    The same shape as check-harness-drift.sh (#867).

Acceptance, whichever lands: a change to scripts/broker/idss-broker-install.sh
merged to main either reaches the droplet or turns something red.

Verify the drift exists today

sha256sum scripts/broker/idss-broker-install.sh
ssh dev@100.98.48.68 sha256sum /usr/local/sbin/idss-broker-install

Filed from #745's session rather than fixed there: #745 is the loop-closer for
#741's expiry tag, and this is a rail-design decision, not that verification.

The broker's auto-deploy rail installs a **binary** from CI, but its own installer — `/usr/local/sbin/idss-broker-install` on the mail droplet — is a **hand-placed copy** of `scripts/broker/idss-broker-install.sh`, put there once by a human under broker/README.md's "one-time setup". Nothing re-places it. So the rail cannot deploy a fix to itself. Found the hard way in #745. ## Why this is filed now GOTCHAS #91: the installer's marker check was `strings "$tmp" | grep -qF "$marker"` under `set -o pipefail`, which reports SIGPIPE (141) when `grep -q` exits early — so a genuine broker binary was refused as "not a broker artifact". The repo fix is one line. Landing it changes nothing on the droplet, because the droplet is running a snapshot taken 2026-08-25 20:46 and there is no mechanism that notices. That is the same shape as the two walls #745 already walked into (GOTCHAS #90's wrong-mesh runner, then #91's SIGPIPE): a deploy path with an undeployable component in it, silent by construction. ## The concrete gap - `broker-deploy.yml` ssh's `deploy@100.98.48.68 sudo /usr/local/sbin/idss-broker-install <sha>`. - `deploy`'s sudoers line permits **only** that path, and its `authorized_keys` forces that one command — correctly, this is a locked-down deploy account. - Therefore the rail structurally cannot update the script it invokes, and the repo copy and the live copy can drift arbitrarily far apart with no signal. - There is no check anywhere that the two are the same file. ## Shape of a fix (not ruled — this is the filing) 1. **Self-updating installer.** The installer already downloads a per-sha artifact and swaps it atomically with rollback; it could do the same for itself — fetch the repo's copy for the sha it was handed, and re-exec if it differs. Keeps the locked-down sudoers line intact (one path, one command). Needs care: a broken installer would then be able to break its own successor, so the re-exec wants the same "prove it works, else restore" discipline the binary swap has. 2. **Publish the installer alongside the binary.** `publish-broker` already uploads `ourcloud-broker-x86_64`, its `.sha256` and `RELEASE` per sha; adding `idss-broker-install.sh` makes the script versioned with the binary it installs. Then (1) has something to fetch. 3. **Cheapest: a drift alarm.** A step that compares the live script's sha256 against the repo's and goes red on mismatch — does not fix the drift, but makes it impossible for the next installer defect to be invisible for weeks. The same shape as `check-harness-drift.sh` (#867). Acceptance, whichever lands: a change to `scripts/broker/idss-broker-install.sh` merged to `main` either reaches the droplet or turns something red. ## Verify the drift exists today ```bash sha256sum scripts/broker/idss-broker-install.sh ssh dev@100.98.48.68 sha256sum /usr/local/sbin/idss-broker-install ``` Filed from #745's session rather than fixed there: #745 is the loop-closer for #741's expiry tag, and this is a rail-design decision, not that verification.

Ruled by agent under ADR 0174 — veto anytime.

Landed the repo half of the fix and relabelled ready-for-human for the one bootstrap step this standing session cannot reach. Commit 3056c3b9 on main.

The ruling (which shape)

Of the three shapes filed, I landed option 2 (publish the installer alongside the binary) + option 3 (a drift alarm), and deliberately did not land option 1 (a self-re-execing installer). Option 1 is the one the filing itself flags — "a broken installer would then be able to break its own successor" — i.e. brick-risk baked into the mail droplet's locked-down deploy path. That is a design bet worthy of a human ruling, not an unattended two-way-door action. The drift alarm satisfies the acceptance ("an installer change either reaches the droplet or turns something red") while being purely additive, fully revertible, and riding the rail's existing anonymous registry read — no new credential, no new door.

What landed (two-way, provable)

  • publish-broker (.forgejo/workflows/ci.yml) now uploads scripts/broker/idss-broker-install.sh as idss-broker-install.sh under each sha — versioning the installer with the binary it installs.
  • assert_installer_not_drifted (scripts/broker/idss-broker-install.sh): the installer's first act fetches the copy CI published for the sha it was handed and, if the on-disk /usr/local/sbin/idss-broker-install differs, dies loud (deploy-broker reds, the live broker is untouched). Skips gracefully when there is nothing to compare — an ad-hoc run from a checkout, or a sha whose publish predates this (an old rollback target), so rollbacks still work.
  • Proof: scripts/tests/broker-install-test.sh gains cases 10–12 (match → installs / drift → refused, binary untouched / absent → installs). Red before green confirmed directly: with the guard stripped, the stale-installer scenario swaps the binary (exit 0); with the guard, it refuses (exit 1) with installer DRIFT (#872), binary untouched. Existing broker tests still green (publish-broker-guard-test 8, broker-deploy-trigger-test 9). CI runs these via seam-smoke.sh's scripts/tests/*.sh loop.
  • Docs: GOTCHAS #99 (the undeployable-component hazard + the rule), broker/README.md (the drift alarm + the re-placement discipline), STATUS.md (header + milestone log).

Verify-the-drift note

The filing's verify commands could not be run from this session: ssh dev@100.98.48.68 times out from matou-workstation — the mail droplet is on the admin mesh (100.98.0.0/16) and this host is on the product mesh (100.83.0.0/16), exactly GOTCHAS #90 / the reason deploy-broker runs on elitebook-03. The repo copy's sha256 is 510de3d2…9ab140b (pre-commit); the live copy is unobservable from here.

Why human

Ben's hands, over the admin mesh (a door this product-mesh standing session does not hold). The alarm only becomes live once an installer carrying the alarm is on the droplet — and nothing re-places the installer today (that is the very bug). So one bootstrap hand-placement is needed, exactly the existing one-time-setup line, run as dev over the admin mesh:

# On the mail droplet (100.98.48.68), from a fresh checkout of this commit, as a user who can sudo:
sudo install -o root -g root -m0755 \
  scripts/broker/idss-broker-install.sh /usr/local/sbin/idss-broker-install
sha256sum /usr/local/sbin/idss-broker-install   # should match the repo copy

After that single placement, the mechanism is self-guarding: every subsequent change to scripts/broker/idss-broker-install.sh is either re-placed the same way or reds deploy-broker with the installer DRIFT (#872) message — never silent again. (broker/README.md's "Re-placing the installer" note now documents this discipline.)

**Ruled by agent under ADR 0174 — veto anytime.** Landed the repo half of the fix and relabelled `ready-for-human` for the one bootstrap step this standing session cannot reach. Commit `3056c3b9` on `main`. ### The ruling (which shape) Of the three shapes filed, I landed **option 2 (publish the installer alongside the binary) + option 3 (a drift alarm)**, and deliberately did **not** land option 1 (a self-re-execing installer). Option 1 is the one the filing itself flags — "a broken installer would then be able to break its own successor" — i.e. brick-risk baked into the mail droplet's locked-down deploy path. That is a design bet worthy of a human ruling, not an unattended two-way-door action. The drift alarm satisfies the acceptance ("an installer change either reaches the droplet or turns something red") while being purely additive, fully revertible, and riding the rail's **existing anonymous registry read** — no new credential, no new door. ### What landed (two-way, provable) - **`publish-broker` (`.forgejo/workflows/ci.yml`)** now uploads `scripts/broker/idss-broker-install.sh` as `idss-broker-install.sh` under each sha — versioning the installer with the binary it installs. - **`assert_installer_not_drifted` (`scripts/broker/idss-broker-install.sh`)**: the installer's first act fetches the copy CI published for the sha it was handed and, if the on-disk `/usr/local/sbin/idss-broker-install` differs, **dies loud** (`deploy-broker` reds, the live broker is untouched). Skips gracefully when there is nothing to compare — an ad-hoc run from a checkout, or a sha whose publish predates this (an old rollback target), so rollbacks still work. - **Proof:** `scripts/tests/broker-install-test.sh` gains cases 10–12 (match → installs / drift → refused, binary untouched / absent → installs). Red before green confirmed directly: with the guard stripped, the stale-installer scenario swaps the binary (exit 0); with the guard, it refuses (exit 1) with `installer DRIFT (#872)`, binary untouched. Existing broker tests still green (`publish-broker-guard-test` 8, `broker-deploy-trigger-test` 9). CI runs these via `seam-smoke.sh`'s `scripts/tests/*.sh` loop. - Docs: **GOTCHAS #99** (the undeployable-component hazard + the rule), **broker/README.md** (the drift alarm + the re-placement discipline), **STATUS.md** (header + milestone log). ### Verify-the-drift note The filing's verify commands could not be run from this session: `ssh dev@100.98.48.68` **times out** from `matou-workstation` — the mail droplet is on the admin mesh (`100.98.0.0/16`) and this host is on the product mesh (`100.83.0.0/16`), exactly GOTCHAS #90 / the reason `deploy-broker` runs on `elitebook-03`. The repo copy's sha256 is `510de3d2…9ab140b` (pre-commit); the live copy is unobservable from here. ## Why human **Ben's hands, over the admin mesh (a door this product-mesh standing session does not hold).** The alarm only becomes live once an installer *carrying the alarm* is on the droplet — and nothing re-places the installer today (that is the very bug). So one bootstrap hand-placement is needed, exactly the existing one-time-setup line, run as `dev` over the admin mesh: ```bash # On the mail droplet (100.98.48.68), from a fresh checkout of this commit, as a user who can sudo: sudo install -o root -g root -m0755 \ scripts/broker/idss-broker-install.sh /usr/local/sbin/idss-broker-install sha256sum /usr/local/sbin/idss-broker-install # should match the repo copy ``` After that single placement, the mechanism is self-guarding: every subsequent change to `scripts/broker/idss-broker-install.sh` is either re-placed the same way or reds `deploy-broker` with the `installer DRIFT (#872)` message — never silent again. (broker/README.md's "Re-placing the installer" note now documents this discipline.)
Author
Owner

CLOSED — bootstrap done, and the rail's REAL wall found and fixed; broker b186b7eb LIVE

Bootstrap (the human step): the alarm-carrying installer is on the droplet — /usr/local/sbin/idss-broker-install sha 57aeebb8965914d858370804a578bb6297a3858ecab34609edb0a3e7867a5c71, matching main. (The earlier 20:12Z placement had already put the #91 SIGPIPE fix live; it was one step behind again after 3056c3b9.)

But the very next dispatch (run 24058 on b186b7eb, 03:07Z) was still red — and the drift alarm had nothing to do with it. From the droplet's sshd journal: Connection closed by authenticating user deploy 100.98.240.186 [preauth]; from elitebook-03 with the secret's key: deploy@100.98.48.68: Permission denied (publickey). The repo secret BROKER_DEPLOY_SSH_KEY (set 2026-08-25 20:57Z, fp SHA256:BimaV8NQ…) and deploy's authorized_keys (placed 20:46Z, fp SHA256:jEIPxXqD…) were two different keypairs with the same comment. Every one of the six broker-deploy failures since 2026-08-23 died there — before the installer ran — which is why neither the #90 mesh fix nor the #91 SIGPIPE fix ever turned it green. GOTCHAS #100.

Fix: Ben rewrote the key material in authorized_keys to the secret's public half (forced-command prefix kept). Pre-flight from elitebook then reached the forced command (idss-broker-install: not a full git sha: 'true').

Proof: broker-deploy run 24074 success (03:15:57 → 03:17:23Z). Droplet: ourcloud-broker.service restarted 03:17:18Z, /usr/local/bin/ourcloud-broker sha256 1c89dd0e8fab… = the registry's ourcloud-broker-x86_64.sha256 for b186b7eb. Boot log shows the #813 front-door probe and the rental ledger — the post-86d5ef7 broker. First successful deploy in the rail's life.

Cosmetic residue: the unit's Description= still reads "build 86d5ef7" (static text in the unit file, not the binary). #745 is now unblocked — the live broker carries #741's expiry tag.

## CLOSED — bootstrap done, and the rail's REAL wall found and fixed; broker `b186b7eb` LIVE **Bootstrap (the human step):** the alarm-carrying installer is on the droplet — `/usr/local/sbin/idss-broker-install` sha `57aeebb8965914d858370804a578bb6297a3858ecab34609edb0a3e7867a5c71`, matching `main`. (The earlier 20:12Z placement had already put the #91 SIGPIPE fix live; it was one step behind again after `3056c3b9`.) **But the very next dispatch (run 24058 on `b186b7eb`, 03:07Z) was still red** — and the drift alarm had nothing to do with it. From the droplet's sshd journal: `Connection closed by authenticating user deploy 100.98.240.186 [preauth]`; from elitebook-03 with the secret's key: `deploy@100.98.48.68: Permission denied (publickey)`. The repo secret `BROKER_DEPLOY_SSH_KEY` (set 2026-08-25 20:57Z, fp `SHA256:BimaV8NQ…`) and `deploy`'s `authorized_keys` (placed 20:46Z, fp `SHA256:jEIPxXqD…`) were **two different keypairs** with the same comment. Every one of the six `broker-deploy` failures since 2026-08-23 died there — before the installer ran — which is why neither the #90 mesh fix nor the #91 SIGPIPE fix ever turned it green. **GOTCHAS #100.** **Fix:** Ben rewrote the key material in `authorized_keys` to the secret's public half (forced-command prefix kept). Pre-flight from elitebook then reached the forced command (`idss-broker-install: not a full git sha: 'true'`). **Proof:** `broker-deploy` run **24074 success** (03:15:57 → 03:17:23Z). Droplet: `ourcloud-broker.service` restarted 03:17:18Z, `/usr/local/bin/ourcloud-broker` sha256 `1c89dd0e8fab…` = the registry's `ourcloud-broker-x86_64.sha256` for `b186b7eb`. Boot log shows the #813 front-door probe and the rental ledger — the post-`86d5ef7` broker. First successful deploy in the rail's life. Cosmetic residue: the unit's `Description=` still reads "build 86d5ef7" (static text in the unit file, not the binary). #745 is now unblocked — the live broker carries #741's expiry tag.
ben closed this issue 2026-08-27 03:19:42 +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#872
No description provided.