There is a lot of jump around in your post so these answers will be out of your order:
- There is no ownership in vault, only permission. Everything is also deny-first. So for anything on the system to be visible the token requesting that object must have permission to do so, doesn’t matter what other token created it.
- sys/mounts is a read-only end point, there is no point in write, update, sudo, etc. See: /sys/mounts - HTTP API | Vault by HashiCorp, it only has 1 GET method.
- sys/mounts/* is a different path and I think that’s what’s your looking for. (Note: * is not a regex wild card in Vault, here it means any object at this location).
- Mounting the same engine multiple times (specially the KV engine) is almost NEVER the answer. You can do what you want with paths and policies rather than remounting the engine. There are cases for it, but they are far and few in-between.
- Yes, you need to setup and use local admin users and revoke the root user.
- To help you better understand policies and what is needed, turn on the audit log. Here you’ll see the requests and paths and it makes writing policies a lot easier.
Here is a simple example, but with more complex requirements multiple requests go out and each need to be parsed to create a policy:
$ vault secrets enable -path=ssh-prod ssh
Error ...
* permission denied
Look at the audit output – recognize the different types of polices that applies to your token and where each policy starts and ends.
{
"type": "response",
"policies": [
"default",
"vault-admin",
"pki-rw-access"
],
"token_policies": [
"default"
],
"identity_policies": [
"vault-admin",
"pki-rw-access"
],
...
"request": {
"operation": "update",
...
"path": "sys/mounts/ssh-prod",
...
"error": "1 error occurred:\n\t* permission denied\n\n"
}
What the audit log is showing is that the current token lacks “update” access to: “sys/mounts/ssh-prod”.
To allow this specifically:
path "sys/mounts/ssh-prod" { capabilities = ["update"] }
To allow this generally to mount any engine:
path "sys/mounts/*" { capabilities = ["update"] }
In reality you should add the following to your admin policies:
path "sys/mounts/*"{ capabilities = ["create", "read", "update", "delete", "list", "sudo"]}
While learning, this is going to be an iterative process, add one permission try the command again, add more permissions, try again. (The good news is the policy of the token is not cached, each request re-reads the policy so just updating the policy applies the changes to the system.