Skip to content

Instantly share code, notes, and snippets.

@fvoges
Created May 2, 2023 08:00
Show Gist options
  • Save fvoges/8ac0dd7f5241f7b45d888ec25378a023 to your computer and use it in GitHub Desktop.
Save fvoges/8ac0dd7f5241f7b45d888ec25378a023 to your computer and use it in GitHub Desktop.
Vault list/revoke tokens

List all root tokens

vault list -format json auth/token/accessors | jq -r .[] | xargs -I '{}' vault token lookup -format json -accessor '{}' | jq -r 'select(.data.policies | any(. == "root"))'

List all tokens

vault list auth/token/accessors

Revoke tokens using accessor IDs

vault token revoke -accessor <accessor>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment