Watch
0
0
Fork
You've already forked hyperhive
0

grant-bootstrap re-applies the granter and restarts failed policy units; setup treats a refused granting unit as not done

This commit is contained in:
maia 2026-11-19 06:18:04 +01:00 • committed by mara
commit c7d37ca455
3 changed files with 271 additions and 33 deletions

View file

@ -116,7 +116,11 @@ It writes the `bao-bootstrap` policy, places a 24h grant token for
`swarm-bao-granter-role` and restarts that unit. The token comes from the
hidden prompt, or from stdin when stdin isn't a terminal; never from an
argument or environment variable. If the granter exists already, it
says so and does nothing. To do both steps in one go,
runs the same steps again: this is also how a change to the granter's own
policy or to `bao-bootstrap` reaches an existing store, because a deploy
changes the text on the host and not in the store. Afterwards it resets and
restarts every failed `swarm-bao-*-policy` unit, which otherwise stays down once
it hits its start limit. To do both steps in one go,
without re-typing the root token, run `swarmctl bao init --and-grant`
instead (it needs the `pkcs11` seal, which unseals itself).

View file

@ -724,7 +724,7 @@ Prints the unseal or recovery keys and the root token to stdout, once, and store
Bootstrap the granter: the one-time step that lets `swarm-bao-granter-role` write every `swarm-*` policy and role.
Reads the root token from a hidden prompt, or from stdin when stdin isn't a terminal; never from an argument or an environment variable. Writes the `bao-bootstrap` policy, places a 24h grant token for the granter unit and restarts it, so run it as root on the host running that unit. Says so and does nothing when the granter exists already.
Reads the root token from a hidden prompt, or from stdin when stdin isn't a terminal; never from an argument or an environment variable. Writes the `bao-bootstrap` policy, places a 24h grant token for the granter unit and restarts it, so run it as root on the host running that unit. When the granter exists already it runs the same steps again, which is how a change to the granter's policy reaches an existing store, then resets and restarts the failed `swarm-bao-*-policy` units.
**Usage:** `swarmctl bao grant-bootstrap [OPTIONS]`

View file

@ -52,7 +52,13 @@ and the unit runs once. A successful run deletes the token file too.
After that, a new or changed `swarm-*` grant needs no operator step: the unit
that writes it changes, and the deploy restarts it. A root step comes back only
when the granter itself needs a path it lacks, such as a new mount.
when the granter itself needs a path it lacks, such as a new mount. That
step is `swarmctl bao grant-bootstrap`, which is also the re-apply: a change
to `granterPolicyText` or to `bao-bootstrap-policy.hcl` reaches an existing
store only through it, since the deploy leaves the store's copy alone. It
writes `bao-bootstrap`, places a fresh 24h token, restarts the granter unit
(which rewrites `bao-granter`), then resets and restarts the failed
`swarm-bao-*-policy` units.
⚠️ The granting units re-run on **boot** and whenever a deploy **changes**
them, not on every deploy. When a grant drifts in the store and its unit stays