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#uriName a server’s Vault key when you add it:
gpsu server add r730xd --password-vault gpsu/r730xd#passwordSee server passwords.
Log in to Vault
GPSU_VAULT_AUTH_METHOD | Settings | Best for |
|---|---|---|
kubernetes | GPSU_VAULT_AUTH_ROLE and GPSU_VAULT_TOKEN_FILE. The file holds a projected service account token. | A pod in Kubernetes |
jwt | GPSU_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 |
approle | GPSU_VAULT_ROLE_ID and GPSU_VAULT_SECRET_ID_FILE | A host outside Kubernetes |
token | GPSU_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.
| Variable | Default | Description |
|---|---|---|
GPSU_VAULT_ADDRESS | The URL of the Vault server. Setting it turns Vault on. | |
GPSU_VAULT_AUTH_MOUNT | The method’s name | The auth method’s mount path. Set it when the method isn’t at its default path. |
GPSU_VAULT_CA_FILE | A CA file. Vault’s certificate must chain to this CA. | |
GPSU_VAULT_SERVER_NAME | The name to verify in Vault’s certificate when it differs from the address’s host | |
GPSU_VAULT_ALLOW_HTTP | false | Allows an http:// address, such as a Vault Agent listener on the loopback address |
GPSU_VAULT_NAMESPACE | The Vault namespace | |
GPSU_VAULT_TIMEOUT | 5s | How 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
| Secret | When 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 secret | At each start |
| Each iDRAC password | At each iDRAC login. A rotated password takes effect at the next login. |
When Vault or a secret is missing
| If | Then |
|---|---|
| Vault can’t be reached | gpsu logs in to each iDRAC with the last password that iDRAC accepted. |
| A secret a startup setting names is missing at startup | gpsu doesn’t start. It changes no fan speed. |
| A server’s password is missing | gpsu can’t log in. That server stays in iDRAC auto. |