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

vault write --format=json auth/approle/login ... does not return auth.entity_id field #6806

Closed
yeonwoonj opened this issue May 31, 2019 · 0 comments · Fixed by #6819
Closed
Assignees
Milestone

Comments

@yeonwoonj
Copy link

Describe the bug
vault write --format=json auth/approle/login role_id=<role_id> secret_id=<secret_id> does not return auth.entity_id whereas curl -X POST ... $VAULT_ADDR/v1/auth/approle/login does.

To Reproduce

  1. setup an approle according to https://learn.hashicorp.com/vault/identity-access-management/iam-authentication#steps
  2. use vault to login with your role_id and secret_id as follows:
$ vault write --format=json auth/approle/login role_id=<role_id> secret_id=<secret_id> | jq .auth
{
  "client_token": "...",
  "accessor": "...",
  "policies": [
    "default",
    "..."
  ],
  "token_policies": [
    "default",
    "..."
  ],
  "identity_policies": null,
  "metadata": {
    "role_name": "..."
  },
  "orphan": true,
  "lease_duration": 3600,
  "renewable": true
}
  1. There you can't find entity_id field.
  2. use curl to directly send a request for REST API
curl --request POST --data '{"role_id": "<role_id>", "secret_id": "<secret_id>"}' $VAULT_ADDR/v1/auth/approle/login | jq .auth
{
  "client_token": "...",
  "accessor": "...",
  "policies": [
    "default",
    "..."
  ],
  "token_policies": [
    "default",
    "..."
  ],
  "metadata": {
    "role_name": "..."
  },
  "lease_duration": 3600,
  "renewable": true,
  "entity_id": "...",
  "token_type": "service",
  "orphan": true
}
  1. response body contains entity_id

Expected behavior
entity_id field is included in the output of the vault write --format=json auth/approle/login ... too.

Environment:

  • Vault Server Version (retrieve with vault status): Version 1.1.2
  • Vault CLI Version (retrieve with vault version): Vault v1.1.2 ('0082501623c0b704b87b1fbc84c2d725994bac54')
  • Server Operating System/Architecture: Linux/amd64

Vault server configuration file(s):

listener "tcp" {
  address     = "<hostname>:8200"
  tls_disable = 0
  tls_cert_file = "/config/cert.pem"
  tls_key_file = "/config/cert.key"
}

storage "file" {
  path = "/vault/file/data"
}

Additional context

Otherwise, getting the entity id of an approle is not possible from the vault cli (automatically in a script) as far as I can see.

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

Successfully merging a pull request may close this issue.

3 participants