Ok I’m still struggling with how the pathing works for child namespaces. I’m creating policy in the /it namespace to allow writing of a policy in the /it/printer_team namespace. For testing I setup a overly broad policy like this.
path "*" {
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}
With my non root token I’m able to then write a policy to the child namespace.
vault policy write -ns=it/printer_team bootstrap_policy bootstrap_policy.hcl
So yes totally possible to grant this ability to write a policy in a child namespace. Just need to scope things to the correct path. Looking at the api we have sys/namespace
so that looks like the next path to try.
Updated my policy to this as it should include all child namespace paths?
path "sys/namespaces/*" {
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}
With my non root token having this policy it’s unable to write the bootstrap_policy to the child namespace.
vault policy write -ns=it/printer_team bootstrap_policy bootstrap_policy.hcl
vault policy write -ns=it/printer_team bootstrap_policy bootstrap_policy.hcl
Error uploading policy: Error making API request.
URL: PUT https://localhost:8200/v1/sys/policies/acl/bootstrap_policy
Code: 403. Errors:
* 1 error occurred:
* permission denied
At this point I’m either not using the sys/namespaces path correctly or paths outside of sys/namespace
need to be opened up to allow writing the bootstrap policy to a child namespace. Based on the learn.hashicorp namespace doc I also tried these below in the non root token’s policy without luck.
# Manage namespaces
path "sys/namespaces/it/printer_team/namespaces/*" {
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}
# Manage policies
path "sys/namespaces/it/printer_team/policies/acl/*" {
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}
Hopefully I’m just overlooking something with how these paths work. Are there considerations for paths being relative if you’re working from within a namespace already? Other considerations for nested namespaces and pathing?