swarm-bao: let the controller write agent credentials, and gate that it can
Closes #4124. The controller's policy granted only the bootstrap paths -- hive cert-auth roles and hive ACLs. #4113 then made it a secret WRITER, and nothing related the grants to the paths the code writes, so every matrix token provision answered 403. The two halves landed on different issues and neither looked wrong on its own. `secret/data/` is KV v2's ACL prefix and is absent from the path the code passes, so matching `swarm-secret-client`'s spelling literally would have granted nothing. Write-only: the controller mints these and never reads one back, and a read capability would let it recover every agent's credentials rather than only replace them. The gate is the point. Two module-eval arms -- the grant exists and is not a broader wildcard, and its capability list is pinned whole, because an ADDED capability is what a presence check misses -- plus a test in path.rs pinning MOUNT/AGENT_PREFIX and naming the nix file, since renaming either constant is a silent 403 rather than a compile error. setup.md carried two warnings this makes false: that nothing in the tree had ever authenticated to the store, and that no deployment shape mints a leaf whose CN reads swarm-controller. glue-bao-tls.nix has minted one since #3726 item 1.
This commit is contained in:
parent
85d0b8de5d
commit
cc8fb0ee44
4 changed files with 62 additions and 8 deletions
|
|
@ -168,6 +168,19 @@ let
|
|||
# `writeText`: a store path puts the grants behind a hash where
|
||||
# ../module-eval.nix cannot read them, and a heredoc would make the HCL's
|
||||
# indentation a function of this file's.
|
||||
#
|
||||
# The last grant is a different kind from the others: they let the controller
|
||||
# bootstrap hives, this lets it write an agent's credentials. Two things about
|
||||
# it do not read as they look.
|
||||
#
|
||||
# `secret/data/` is KV v2's ACL prefix, not part of the path the code passes:
|
||||
# `swarm-secret-client` writes `swarm/agents/<agent>/...` under mount
|
||||
# `secret`, and the engine inserts `data/`. Matching the code's spelling
|
||||
# literally would grant nothing.
|
||||
#
|
||||
# Write-only on purpose. The controller mints these; nothing in its job reads
|
||||
# one back, and a read capability here would let it recover every agent's
|
||||
# credentials rather than merely replace them.
|
||||
controllerPolicyText = ''
|
||||
path "auth/cert/certs/hive-*" {
|
||||
capabilities = ["create", "update", "read", "delete"]
|
||||
|
|
@ -184,6 +197,10 @@ let
|
|||
path "sys/policies/acl" {
|
||||
capabilities = ["list"]
|
||||
}
|
||||
|
||||
path "secret/data/swarm/agents/*" {
|
||||
capabilities = ["create", "update"]
|
||||
}
|
||||
'';
|
||||
|
||||
# Every listener serves the same identity: they differ in which address
|
||||
|
|
|
|||
Loading…
Reference in a new issue