Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

permission denied error #286

Open
sluwood opened this issue Mar 17, 2024 · 1 comment
Open

permission denied error #286

sluwood opened this issue Mar 17, 2024 · 1 comment

Comments

@sluwood
Copy link

sluwood commented Mar 17, 2024

Hi,

I was trying to set up jwt verification using jwks method with OAuth 2.0 server as the authentication server.
So the frontend app receives a jwt token from the Oauth server and then it using this jwt token to get verified by vault (with vault setup using jwks method)
It seems to work as I can use the jwt token to login. However, I am not able to query the actual key value pair inside the vault as it throws the "permission denied" error.

Here is my policy setup:
vault policy read mysecret-testing

Policy name: mysecret-testing

path "secret/test/*" {
capabilities = [ "read", "update", "patch", "delete", "list", "create" ]
}

Here is my role setup:
vault write auth/jwt/role/demo - <<EOF
{
"role_type": "jwt",
"bound_audiences": "dgc",
"policies": ["mysecret-testing"],
"token_explicit_max_ttl": 7200,
"user_claim": "sub",
"bound_claims": {
"env": "00000000-0000-0000-0000-000000000001"
}
}
EOF

Now here is the result showing the verification of the jwt token:
vault write auth/jwt/login role=demo jwt="JWT_TOKEN"
WARNING! The following warnings were returned from Vault:

  • TTL of "768h" exceeded the effective max_ttl of "2h"; TTL value is capped accordingly

Key Value


token "sometoken"
token_accessor "someaccessor"
token_duration 2h
token_renewable true
token_policies ["default" "mysecret-testing"]
identity_policies []
policies ["default" "mysecret-testing"]
token_meta_role demo

So I know the jwks part works. Now when I tried to query the actual secret then it returns the permission denied error.
vault kv get -field=secret secret/test/00000000-0000-0000-0000-000000000001
Error making API request.

URL: GET http://localhost:9280/v1/sys/internal/ui/mounts/secret/test/00000000-0000-0000-0000-000000000001
Code: 403. Errors:

  • permission denied

Please kindly suggest how to resolve this issue.

Thanks
wood

@sluwood
Copy link
Author

sluwood commented Mar 17, 2024

This shall be the expect results using the regular built-in vault token access without Oauth authentication
vault kv get -field=secret secret/test/00000000-0000-0000-0000-000000000001
newsecret

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant