bao: write the swarm controller's policy from inside the store
Cert auth answers a role, so nothing in the swarm can authenticate to the store until some role exists. Creating the first one therefore cannot itself use a certificate — the credential has to come from outside that cycle, and an operator places it. `deploy.bao.bootstrapTokenFile` names that token. A one-shot unit inside the store's container reads it and writes the `swarm-controller` policy; `local-defaults.nix` supplies the path (never the file) on an all-local deploy, since co-location makes only the location derivable. `bao operator init` stays an operator action in every shape. The unit runs in the container rather than on the host because writing the first grant is a store-side operation: it reaches the store locally and needs no client certificate. Gating it on the store being here is therefore not the co-location assumption glue-matrix-bao-token.nix warns about — a reader has to work from anywhere, the first write never does. Policy only, deliberately: a cert-auth role binds a certificate and the controller has no bao identity yet — it holds no leaf and contains no bao code at all. The two certificates that do exist are both wrong to bind. `clientCertFile` is the store host's own reader leaf rather than the controller's, and the CA that signed it also signs every other reader's, so binding that would let any reader authenticate as the controller. Whoever gives the controller an identity writes the role. The grants are scoped to `hive-*`. Without the prefix the controller could rewrite the policy that constrains it. Two things the module-eval arms pin: the unit renders inside the container with the token path in both its script and its ConditionPathExists, and a host that names a token while running no store gets neither the unit nor the host-side directory. The capabilities were derived with `bao write -output-policy` rather than written from memory, and the setup.md commands were run against a real binary for shape before being written down. Refs #3726.
This commit is contained in:
parent
6fd5bc1c4f
commit
2f7d3e02e9
4 changed files with 223 additions and 0 deletions
|
|
@ -129,6 +129,24 @@ in
|
|||
# itself, and this is a different top-level path.
|
||||
config.services.hyperhive.deploy.swarm-controller.enable = lib.mkDefault cfg.deploy.singleHostSwarm;
|
||||
|
||||
# Where the operator drops the token that writes the swarm's first bao
|
||||
# grants. All-local supplies the path, never the file: `bao operator init`
|
||||
# stays a human step in every shape (see ./swarm-bao.nix), so what
|
||||
# co-location makes derivable is only *where* it goes. The granting unit
|
||||
# skips until the file appears, so naming the path early costs a boot
|
||||
# nothing.
|
||||
#
|
||||
# ⚠️ Deliberately NOT under `/var/lib/swarm-bao-token`, which already holds
|
||||
# the PKCS11 seal material. Those are both "a bao token" and neither can
|
||||
# substitute for the other: one unseals the store, this one authorises the
|
||||
# first write.
|
||||
#
|
||||
# Outside the `swarm` attrset above for the same reason the controller's
|
||||
# options are — a path on this host is a `deploy.*` fact.
|
||||
config.services.hyperhive.deploy.bao.bootstrapTokenFile = lib.mkIf cfg.deploy.singleHostSwarm (
|
||||
lib.mkDefault "/var/lib/swarm-bao-bootstrap/grant.token"
|
||||
);
|
||||
|
||||
# Same reason, one option later: the queue secret is a path on THIS host,
|
||||
# so it moved to `deploy.*` with the rest of the controller's credentials.
|
||||
# It has to sit out here rather than in the `swarm` attrset above — a bare
|
||||
|
|
|
|||
Loading…
Reference in a new issue