Watch
0
0
Fork
You've already forked hyperhive
0

disable a destroyed agent's identity entity and delete its login role

This commit is contained in:
atlas 2026-11-16 16:50:53 +01:00
commit 299b922039

View file

@ -1813,7 +1813,9 @@ let
lib.hasInfix "path \"secret/data/swarm/agents/*\" {\n capabilities = [\"create\", \"read\", \"update\"]" s;
}
{
# `agent_entity.rs` names each agent's login entity after the agent. The
# `agent_entity.rs` names each agent's login entity after the agent, and
# `agent_cutoff.rs` disables it with the `disabled` key of the by-name
# stanza (the key list carries `disabled` and still not `policies`). The
# accessor read is `read` + `sudo` on the one mount, the lookup and both
# writes list the request keys they take (so `policies`, which would
# attach any policy to a login, is refused), and nothing else under
@ -1829,7 +1831,7 @@ let
in
lib.hasInfix "path \"sys/auth/cert\" {\n capabilities = [\"read\", \"sudo\"]\n}" s
&& lib.hasInfix "path \"identity/lookup/entity\" {\n capabilities = [\"update\"]\n allowed_parameters = {\n \"alias_name\" = []\n \"alias_mount_accessor\" = []\n }\n}" s
&& lib.hasInfix "path \"identity/entity/name/+\" {\n capabilities = [\"create\", \"read\", \"update\"]\n allowed_parameters = {\n \"name\" = []\n }\n}" s
&& lib.hasInfix "path \"identity/entity/name/+\" {\n capabilities = [\"create\", \"read\", \"update\"]\n allowed_parameters = {\n \"name\" = []\n \"disabled\" = []\n }\n}" s
&& lib.hasInfix "path \"identity/entity/id/+\" {\n capabilities = [\"update\"]\n allowed_parameters = {\n \"name\" = []\n }\n}" s
&& lib.hasInfix "path \"identity/entity-alias\" {\n capabilities = [\"create\", \"update\"]\n allowed_parameters = {\n \"name\" = []\n \"mount_accessor\" = []\n \"canonical_id\" = []\n }\n}" s
&&
@ -1845,6 +1847,21 @@ let
# that the walk reads nothing.
&& pathsUnder "sys/policies/acl/" == [ "path \"sys/policies/acl/hive-*\" {" ];
}
{
# `agent_cutoff.rs` deletes a destroyed agent's cert-auth role. `delete` is
# on the `hive-*` roles alone, so the controller's own role and every
# service's role stay out of its reach. The whole capability list is the
# property: it carries `create`, `update` and `read` beside `delete`, which
# is also what shows the stanza is read and not an empty match.
name = "the controller may delete the hive-* cert-auth roles and no other";
ok =
let
s = baoGrantHere.systemd.services.swarm-bao-controller-policy.script;
in
lib.hasInfix "path \"auth/cert/certs/hive-*\" {\n capabilities = [\"create\", \"update\", \"read\", \"delete\"]\n}" s
&& !(lib.hasInfix "path \"auth/cert/certs/*\"" s)
&& !(lib.hasInfix "path \"auth/cert/certs/swarm-" s);
}
{
# `read_policy.rs` writes the policy every hive's role attaches as
# `hive-hives` and the one every agent's role attaches as `hive-agent`. Both