HashiCorp Vault
Workloads authenticate with the Vault identity their role issues a token for.
Workloads authenticate with the Vault identity their role issues a token for.
Identity proof
The token has to come from https://vault.acme.com/v1/identity/oidc, and its sub claim has to match the workload you named. We compare that claim byte for byte, with no wildcards.
Every token also has to name your workspace as its audience. Ask for this audience and no other. A token requested for two audiences fails every exchange.
Console fields
| Field | Example | Advanced | What it pins |
|---|---|---|---|
| Issuer URL | https://vault.acme.com/v1/identity/oidc | no | Your Vault address with /v1/identity/oidc appended, reachable from the internet. |
| Entity ID | 3d2c1b0a-9f8e-4d7c-8b6a-5f4e3d2c1b0a | no | The sub of a token the role issues. Many machines on one role share it. |
The console also asks which project and environment this identity reaches and which role it gets, with the credential lifetime behind Advanced.
Trust
Built from the example answers above:
| What | Value |
|---|---|
| Issuer | https://vault.acme.com/v1/identity/oidc |
| Claim compared | sub |
| Subject | 3d2c1b0a-9f8e-4d7c-8b6a-5f4e3d2c1b0a |
| Identity name | vault-5f4e3d2c1b0a |
We name the identity for you, so the form never asks for one.
Console snippet
# vault write identity/oidc/key/penv allowed_client_ids="YOUR_WORKSPACE_ID"
# vault write identity/oidc/role/penv key=penv client_id="YOUR_WORKSPACE_ID"
T=$(vault read -field=token identity/oidc/token/penv)
C=$(T="$T" jq -n '{token:env.T}' | curl -sS "https://penv.cloud/api/v1/auth/oidc" \
-H 'content-type: application/json' --data-binary @- | jq -r .credential)
PENV_TOKEN="$C" penv pullThe snippet finishes with penv pull, which writes a file. We recommend penv run for a process; penv pull is for a host that needs a file on disk. Connect your CI has the wrapped step.
Related
- Machine identity
- Connect a Platform in the console
- HashiCorp Vault documentation: the subject is the value most often set wrong