disable a destroyed agent's identity entity and delete its login role
This commit is contained in:
parent
db924d9e77
commit
299b922039
2 changed files with 528 additions and 9 deletions
|
|
@ -393,8 +393,11 @@ let
|
|||
# for a certificate, not write that role or reach the issuer.
|
||||
|
||||
# The identity grants name each agent's login entity after the agent
|
||||
# (`agent_entity.rs`). `sys/auth/cert` carries `sudo` because a plain `read`
|
||||
# of an auth mount is refused, and it is that one mount: it yields the
|
||||
# (`agent_entity.rs`) and disable it when the agent is destroyed
|
||||
# (`agent_cutoff.rs`, the `disabled` key of the by-name stanza; the role delete
|
||||
# that goes with it is the `delete` on `auth/cert/certs/hive-*`).
|
||||
# `sys/auth/cert` carries `sudo` because a plain `read` of an auth mount is
|
||||
# refused, and it is that one mount: it yields the
|
||||
# accessor an entity alias names the mount by. Every identity stanza lists the
|
||||
# request keys it takes, so the grants cannot set an entity's `policies`, which
|
||||
# would attach any policy to a login. The entity and alias names are not
|
||||
|
|
@ -439,6 +442,7 @@ let
|
|||
capabilities = ["create", "read", "update"]
|
||||
allowed_parameters = {
|
||||
"name" = []
|
||||
"disabled" = []
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue