I want to use Vault to issue temporary credentials for database access. I have set up vault with oidc auth against azure active directory. Authentication itself is working fine.
Now I would like to have few external groups connected to AD groups to control which person in AD can assume which role in Vault.
SETUP:
OIDC role:
vault write auth/oidc/role/example-ro user_claim=“email” allowed_redirect_uris=“http://localhost:8250/oidc/callback” allowed_redirect_uris=“https://vault./ui/vault/auth/oidc/oidc/callback” groups_claim=“groups” policies=“example-ro” oidc_scopes=“https://graph.microsoft.com/.default”
external group:
vault write -field=id -format=table identity/group name=“example-ro” type=“external” policies=“example-ro”
database role:
vault write database/roles/example-ro db_name=database creation_statements=“CREATE USER ‘{{name}}’@’%’ IDENTIFIED BY ‘{{password}}’;GRANT SELECT ON example.* TO ‘{{name}}’@’%’;GRANT SELECT ON example2.* TO ‘{{name}}’@’%’;GRANT SELECT ON example_archive.* TO ‘{{name}}’@’%’;” default_ttl=“1h” max_ttl=“24h” username_template="{{.DisplayName | replace “oidc-” “” | replace “.” “” | truncate 10 }}{{ random 4 }}{{ timestamp “02”}}"
vault policy:
path “database/creds/example-ro” {
capabilities = [“read”]
}
vault policy write example-ro example-ro-policy.hcl
RESULT:
I can login fine and assume example-ro role even I am not member of example-ro group in AD. I can login even when the group is not defined in AD at all.
EXPECTED RESULT:
I expect to see some kind of permission error, when I try to login via oidc and try to assume role connected to nonexisting group or