bao: enable cert auth and give the controller a role for its policy
The policy the granting unit already writes grants paths under `auth/cert/certs/*`, and nothing in the tree creates that mount. Every certificate login therefore fails against a path that is not there -- the controller's own, and the per-hive ones it is meant to issue against the same mount. Same unit, same bootstrap token: check whether cert auth is mounted, enable it if not, then write a role binding CN `swarm-controller` to the `swarm-controller` policy. Idempotency is a read rather than a tolerated error. `auth enable` fails on an existing mount, and recognising that would tie a rebuild to an error string no run of this store has ever produced, so the unit asks `bao auth list` and mounts only on absence. That read is why the token policy in setup.md gains `sys/auth`. Each grant came from `bao <cmd> -output-policy`, which prints what a command requires without running it -- the same way controllerPolicyText was derived. Enabling an auth method needs `sudo` on `sys/auth/cert`, which the documented token did not have. Gated on `clientCaFile`, not on the token alone: `swarm-bao-certs` installs `client-ca.pem` only under that condition, and a role's `certificate=` has to name a real CA. The policy write, which needs no CA, is unchanged in that case. Nothing can present a certificate for this role yet -- the only client leaf the tree mints carries CN = the hive's name -- and none of this has been run against a live store. Both are stated in setup.md.
This commit is contained in:
parent
df18d3d4d7
commit
8bd41fd84f
3 changed files with 107 additions and 5 deletions
|
|
@ -62,11 +62,27 @@ authenticate until some role exists — this token is what breaks that cycle,
|
|||
and it's the only step that needs the root token.
|
||||
|
||||
```bash
|
||||
# A policy that can write exactly one policy, and nothing else.
|
||||
# Exactly the four grants the bootstrap unit needs, and nothing else. Each was
|
||||
# derived with `bao <cmd> -output-policy`, which prints what a command requires
|
||||
# without running it.
|
||||
bao policy write swarm-bootstrap - <<'EOF'
|
||||
path "sys/policies/acl/swarm-controller" {
|
||||
capabilities = ["create", "update"]
|
||||
}
|
||||
|
||||
# Cert auth is a mount, and nothing has created it yet: reading `sys/auth` is
|
||||
# how the unit checks, and `sudo` is what enabling one costs.
|
||||
path "sys/auth" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
|
||||
path "sys/auth/cert" {
|
||||
capabilities = ["create", "update", "sudo"]
|
||||
}
|
||||
|
||||
path "auth/cert/certs/swarm-controller" {
|
||||
capabilities = ["create", "update"]
|
||||
}
|
||||
EOF
|
||||
|
||||
# A token holding it. `-orphan` so it outlives the session that made it.
|
||||
|
|
@ -75,7 +91,17 @@ bao token create -policy=swarm-bootstrap -ttl=24h -orphan -display-name=swarm-bo
|
|||
|
||||
Put the token's value at `services.hyperhive.deploy.bao.bootstrapTokenFile`
|
||||
(all-local names that path for you), then rebuild. A one-shot unit inside the
|
||||
store's container reads it and writes the `swarm-controller` policy.
|
||||
store's container reads it, writes the `swarm-controller` policy, enables the
|
||||
cert auth method, and creates the `swarm-controller` role that attaches the two.
|
||||
|
||||
⚠️ **None of this has been run against a live store.** Nothing in the tree has
|
||||
ever authenticated to OpenBao, so treat the block above as derived rather than
|
||||
exercised — the grants come from `-output-policy`, not from a swarm that came
|
||||
up on them.
|
||||
|
||||
⚠️ **The role it creates has nothing to present a certificate for yet.** Minting
|
||||
a leaf whose CN is `swarm-controller` is not wired up in any deployment shape;
|
||||
until it is, the role is provisioning waiting for a consumer.
|
||||
|
||||
**Delete the file once that has run.** The unit skips when it's absent, so a
|
||||
host that has finished bootstrapping stops carrying the credential — and the
|
||||
|
|
|
|||
Loading…
Reference in a new issue