blockstor reads the passphrase Secret past controller-runtime's cache,
keeps the master key in its own keyring Secret and unlocks it from
piraeus's linstor-passphrase. Its own RBAC grants the satellite, and
the controller and apiserver, access only to those Secrets and the
generated unlock Secret. cozy-linstor is shared with piraeus, so
unnamed or cluster-wide grants would let any blockstor pod read
piraeus's TLS keys; the satellite runs privileged on every node, which
makes that one compromised node away.
The apiserver reads and writes Secrets through a namespaced Role only.
The controller creates the keyring itself, so it gets its own
namespaced Role, and the namespace it looks the Secrets up in, which
otherwise defaults to blockstor-system. create cannot be limited by
name and is granted on its own. The passphrase Secret's name is a
value so a cluster that names another Secret keeps the Roles in step.
The named rules also allow list and watch: newer blockstor releases
read these Secrets from one watch per Secret selected by
metadata.name, and without the verbs fall back to a GET per read. A
list or watch restricted by resourceNames is authorized only when its
fieldSelector names one of them, so the rule still exposes nothing
else in the namespace.
Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>