Skip to content

Instantly share code, notes, and snippets.

@GuyBarros
Created April 25, 2022 11:17
Show Gist options
  • Save GuyBarros/2ba3524ffc9dfc9ae880bb518551805a to your computer and use it in GitHub Desktop.
Save GuyBarros/2ba3524ffc9dfc9ae880bb518551805a to your computer and use it in GitHub Desktop.
getting details from Vault client count.
Executing the command below will bring a list of entities , their auth method and their id:
Export VAULT_ADDR=https://<Vault_address>:8200
export VAULT_TOKEN=<Vault_token>
export VAULT_NAMESPACE=<Vault_namespace>
curl -H "X-Vault-Token: $(echo $VAULT_TOKEN)" -H "X-Vault-Namespace: $(echo $VAULT_NAMESPACE)" $(echo $VAULT_ADDR)/v1/identity/entity/id?list=true | jq ."data" > entities.json
and the result will look something like (cut down for size):
{
"key_info": {
"2aed0254-aec4-29f5-dd9d-8990f07a72bf": {
"aliases": [
{
"id": "1aa449cd-23a5-845e-6a13-f8a27f086b61",
"mount_accessor": "auth_jwt_9c86b75c",
"mount_path": "auth/gitlab_jwt/",
"mount_type": "jwt",
"name": "job_1897468340"
}
],
"name": "entity_4ffd3b36"
},
"fb5a0c9c-c96a-bb9c-1943-165f3e90ec35": {
"aliases": [
{
"id": "88caf6a6-c1a4-5855-ac3f-fed75f6cf52b",
"mount_accessor": "auth_ns_token_04a630bd",
"mount_path": "auth/token/",
"mount_type": "ns_token",
"name": "hcp-root"
}
],
"name": "entity_7a441cf4"
}
},
"keys": [
"2aed0254-aec4-29f5-dd9d-8990f07a72bf",
"350b0574-6602-3220-3e46-16762c68f005",
"4c8e4f86-6de9-a5ab-43f2-b82ad62952a4",
"6f71be87-adc2-5084-7061-e2f3b664a3da",
"935ad3cf-9d6b-fca7-de7d-ce885c66ebac",
"af23f96e-96af-e731-ef08-755ae0c1efa8",
"fb5a0c9c-c96a-bb9c-1943-165f3e90ec35"
]
}
Counting the “keys” objects should give us a view on these entities, Then we can get their ids and better understand where they are coming from.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment