Skip to content
Secrets in Vault

Secrets in Vault

gpsu reads secrets from HashiCorp Vault or OpenBao directly. You don’t need to run Vault Agent. On this page, Vault means either one.

The GPSU_VAULT_* settings say how to reach Vault and log in. Then use a secret’s <NAME>_VAULT setting in place of its <NAME>_FILE setting. It names a key in a KV version 2 secret as [MOUNT:]PATH#KEY. The mount defaults to secret.

GPSU_VAULT_ADDRESS=https://vault.example:8200
GPSU_VAULT_CA_FILE=/etc/gpsu/vault-ca.pem
GPSU_VAULT_AUTH_METHOD=kubernetes
GPSU_VAULT_AUTH_ROLE=gpsu
GPSU_VAULT_TOKEN_FILE=/var/run/secrets/vault/token
GPSU_STORE_DRIVER=postgres
GPSU_STORE_URI_VAULT=secret:gpsu/database#uri

Name a server’s Vault key when you add it:

gpsu server add r730xd --password-vault gpsu/r730xd#password

See server passwords.

Log in to Vault

GPSU_VAULT_AUTH_METHODSettingsBest for
kubernetesGPSU_VAULT_AUTH_ROLE and GPSU_VAULT_TOKEN_FILE. The file holds a projected service account token.A pod in Kubernetes
jwtGPSU_VAULT_AUTH_ROLE and GPSU_VAULT_TOKEN_FILE. The file holds a JWT that Vault’s JWT auth trusts.A pod when Vault can’t reach the Kubernetes API server
approleGPSU_VAULT_ROLE_ID and GPSU_VAULT_SECRET_ID_FILEA host outside Kubernetes
tokenGPSU_VAULT_TOKEN_FILE. The file holds a Vault token, such as one Vault Agent keeps fresh.Testing

gpsu reads the token file again at each login. A rotated file is therefore used.

Warning

gpsu never renews a token. It logs in again instead. An AppRole secret ID must therefore stay usable for as long as gpsu runs. A single-use or response-wrapped secret ID works only for the first login.

Settings

Each variable has a flag of the same name, such as --vault-address.

VariableDefaultDescription
GPSU_VAULT_ADDRESSThe URL of the Vault server. Setting it turns Vault on.
GPSU_VAULT_AUTH_MOUNTThe method’s nameThe auth method’s mount path. Set it when the method isn’t at its default path.
GPSU_VAULT_CA_FILEA CA file. Vault’s certificate must chain to this CA.
GPSU_VAULT_SERVER_NAMEThe name to verify in Vault’s certificate when it differs from the address’s host
GPSU_VAULT_ALLOW_HTTPfalseAllows an http:// address, such as a Vault Agent listener on the loopback address
GPSU_VAULT_NAMESPACEThe Vault namespace
GPSU_VAULT_TIMEOUT5sHow long one request may take

gpsu never reads VAULT_ or BAO_ environment variables. Set everything with the GPSU_VAULT_* settings.

Tokens

  • gpsu keeps its Vault token in memory only.
  • It logs in again when two thirds of the token’s TTL have passed.
  • It also logs in again whenever Vault refuses the token.
  • It revokes the token when it stops.

When each secret is read

SecretWhen gpsu reads it
PostgreSQL URI (GPSU_STORE_URI_VAULT)Once at startup
Seal keys (GPSU_SEAL_KEY_VAULT, GPSU_SEAL_PREVIOUS_KEY_VAULT)Once at startup
The identity provider’s client secretAt each start
Each iDRAC passwordAt each iDRAC login. A rotated password takes effect at the next login.

When Vault or a secret is missing

IfThen
Vault can’t be reachedgpsu logs in to each iDRAC with the last password that iDRAC accepted.
A secret a startup setting names is missing at startupgpsu doesn’t start. It changes no fan speed.
A server’s password is missinggpsu can’t log in. That server stays in iDRAC auto.