Docs · Use secrets
Machine identities
A machine identity is how anything that isn't a person reads your secrets. Owners and admins make them in the console.
Making one
- Name: letters, digits,
-and_. It shows in the audit log asapprole:lw-<team>.<name>. - Folder: the one folder it reaches, such as
prod/orapp/web/. Leave it empty for your whole tenant. - Access: read, or read and write.
The answer shows the role_id (it names the identity and isn't secret) and the secret_id (a secret, shown only this once; the site never stores it). Your plan sets how many identities you can have: Free 2, Pro 20, Scale 200.
Logging in
export VAULT_ADDR=https://vault.lunaor.com
# a machine identity made in the console logs in (Vault's AppRole): a token for an hour
export VAULT_TOKEN=$(curl -sf "$VAULT_ADDR/v1/auth/approle/login" \
-d "{\"role_id\":\"$ROLE_ID\",\"secret_id\":\"$SECRET_ID\"}" | jq -r .auth.client_token)The token lasts an hour (24 hours at most). Log in again when it runs out, not with a long-lived token.
export VAULT_ADDR=https://vault.lunaor.com
export VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id="$ROLE_ID" secret_id="$SECRET_ID")When a secret ID leaks
Delete the identity in the console: its logins stop at once, and tokens it already handed out end within the hour. Make a new one with the same folder and access, and update the place that held the old IDs.