Hi,
I have several applications, each one having an AppRole with particular policies attached to it.
$ vault list auth/approle/role/
Keys
----
myservice
To login, each application uses its role ID and a secret ID in order to get a token, and then authenticate to Vault.
$ vault write auth/approle/login role_id=xxx secret_id=xxx
Key Value
--- -----
token c0e85e79-c971-ce59-ac0a-b7b02186b86f
token_accessor ff45cb52-570b-b619-99d6-2d167a19a78c
token_duration 768h0m0s
token_renewable true
token_policies [default myservice-policy]
token_meta_role_name "myservice"
Typically, I'd be storing the role ID and secret ID in the configuration file of the application.
Now, let's assume one application gets compromised. How can I revoke all tokens issued to a specific application, as well as its role ID and secret ID?
- If I remove the role (vault delete auth/approle/role/myservice), the role ID and secret ID of the application can't be used to issue new tokens, but the tokens already issued stay valid
- I could do it manually by:
- listing all the tokens issued to the application using vault list auth/token/accessors
- for each of these token accessors, get his properties via vault write auth/token/lookup-accessor accessor=xxx
- check if the metadata has the information role_name=myservice
- if this is the case, revoke the token using vault write auth/token/revoke-accessor accessor=xxx
... but this seems highly unscalable and error-prone.
Any idea or how this could be achieved? Ideally, it'd be something like vault write -f auth/approle/role/myservice/revoke.
Thanks!
Christophe