Vault agent silently DoSes Vault server when token policy does not include auth/token/renew-self #22575
Labels
agent
core/token
core
Issues and Pull-Requests specific to Vault Core
reproduced
This issue has been reproduced by a Vault engineer
Summary
When the capability for a token to renew itself is missing from a renewable token's policies, vault agent silently DoS's the Vault server with failing requests to
auth/token/renew-self
which result in error:1 error occurred:\n\t* permission denied\n\n
with a 403 return code.There are no errors reported from Vault Agent and there appears to be no backoff present as it is issuing hundreds of requests a second to Vault Server.
How to Reproduce
Pull the
hashicorp/vault:1.14.1
Docker image - we will use this as both the server and the client.Start a container acting as Vault Server. For ease of inter-container networking, we define a custom network as the default bridge network provided by Docker does not have container-DNS for some reason.
Start an interactive Vault container to use as the client. Note that it is also on the custom
vault
network so that it can communicate with the server. Also configure it so that it can talk to Vault Server using the root token:Next we need to alter the default policy to remove the ability for tokens to renew themselves. This can be done by using the Vault CLI for reading, editing, and writing the default policy but it can also be done via the web ui at
http://localhost:8200
. The policy should be edited to remove or comment out this capability:As Vault Agent does not log any errors, we need to enable audit logging in Vault Server so that we can see the deluge of requests arriving from Vault agent:
We are now nearly ready to launch vault agent. We need to create a renewable service token with the default policy, put it in a file, create the Vault agent config file, and then start Vault Agent:
At this point, the audit log in the stdout of the Vault Server instance will become very active with a continuous stream of requests for the token to renew itself but the Vault agent log will remain quiet even though trace logging is enabled. Restoring the capability to update
auth/token/renew-self
to the default policy stops the deluge of requests from vault agent and it appears to operate as normal afterwards.The text was updated successfully, but these errors were encountered: