Vault integration¶
Liftway keeps every credential value in HashiCorp Vault KV v2. Nothing secret is stored in PostgreSQL. Liftway signs in to Vault with Kubernetes service-account tokens, so no static Vault token lives in Liftway.
Who uses which role¶
| Identity | Vault role (Helm) | Policy | Used for |
|---|---|---|---|
Controller (<release>-controller) |
vault.controllerRole |
writer: create/update under the credential prefix | Saving credentials from the UI |
Controller (<release>-controller) |
vault.role |
reader: read under your prefix | Reading Git credentials during project sync |
Runner (<release>-runner) |
vault.role |
reader | Reading the credentials of its own step |
Both identities authenticate with a projected token whose audience is vault.audience (default vault), valid for one hour and refreshed by Kubernetes. The runner revokes its Vault token when the step ends; the role's TTL bounds it if the pod dies first.
Never bind the writer policy to the runner ServiceAccount: playbook authors could then overwrite secrets.
Production setup¶
Run as a Vault administrator with a verified VAULT_ADDR and VAULT_CACERT. Check existing mounts and auth paths first; do not overwrite another cluster's Kubernetes auth configuration.
1. Kubernetes auth for this cluster¶
Vault must be able to call this cluster's TokenReview API.
-
Vault runs inside this cluster: give Vault's own ServiceAccount
system:auth-delegatorand configure the mount from inside a Vault pod:kubectl create clusterrolebinding vault-tokenreview \ --clusterrole=system:auth-delegator --serviceaccount=vault:vault vault auth enable -path=kubernetes-prod kubernetes vault write auth/kubernetes-prod/config \ kubernetes_host="https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}" \ kubernetes_ca_cert=@/var/run/secrets/kubernetes.io/serviceaccount/ca.crt -
Vault runs elsewhere: configure the mount with this cluster's API URL, its CA and a dedicated reviewer token, following Vault's Kubernetes auth documentation. Use a separate auth mount per cluster.
2. KV mount and policies¶
# Narrow this to the smallest prefix your automation needs.
path "runway-prod/data/runway/*" {
capabilities = ["read"]
}
# Must match Administration → Settings → Vault configuration (mount + prefix).
path "runway-prod/data/runway/credentials/*" {
capabilities = ["create", "update"]
}
vault policy write runway-prod-reader runway-prod-reader.hcl
vault policy write runway-prod-writer runway-prod-writer.hcl
The backend repository contains the same policies for the default mount secret in deploy/vault/.
3. Roles¶
vault write auth/kubernetes-prod/role/runway-prod-reader \
bound_service_account_names=runway-runner,runway-controller \
bound_service_account_namespaces=runway-prod \
audience=vault policies=runway-prod-reader ttl=15m
vault write auth/kubernetes-prod/role/runway-prod-writer \
bound_service_account_names=runway-controller \
bound_service_account_namespaces=runway-prod \
audience=vault policies=runway-prod-writer ttl=15m
ServiceAccount names are <release>-runner and <release>-controller; adjust them if your release is not runway.
4. Helm values¶
vault:
address: https://vault.example.com:8200
authPath: kubernetes-prod
role: runway-prod-reader
controllerRole: runway-prod-writer
audience: vault
namespace: "" # Vault Enterprise namespace, if any
caSecret: runway-vault-ca # Secret with key ca.crt; omit for a public CA
TLS verification is always on. The CA Secret is mounted into the controller and every runner.
Credential storage settings¶
Administration → Settings → Vault configuration holds the KV v2 mount and base prefix Liftway writes to (defaults secret and runway/credentials). Each save of a credential writes to:
Set these before the first credential is saved, so that they match the writer policy. Changing them later affects new writes only; existing credentials keep their old paths, and the reader policy must still cover them. Writes use check-and-set 0 on fresh paths, so an existing secret is never overwritten.
Verify¶
- Create a test credential of a custom type with one field targeting an environment variable.
-
Create a Bash template that uses it:
-
Launch it. Output
secret receivedproves the writer and the reader work end to end. - Restart Vault (if you may) and launch again: the value must survive.
Vault: Configured on the dashboard only means an address is set.
Local development¶
- With
make up, runmake vault-devfor an in-memory development Vault with both roles and a demo secret atsecret/runway/demo. It loses everything on restart. - With
make dev, you can exportVAULT_ADDR, a short-livedVAULT_TOKENwith the reader policy and optionallyVAULT_CACERTbefore starting. Never use a root token. Saving credentials from the UI additionally needs write rights for that token.
Failure messages¶
| Message | Usual cause |
|---|---|
| Could not store secret in Vault. Check administrator storage settings and controller write policy. | Writer role missing, wrong mount or prefix, policy path mismatch, audience mismatch |
| Credential lookup failed: Vault HTTP 403 (project sync) | Reader policy does not cover the path, or the controller is not bound to the reader role |
| Credential lookup failed: cannot reach Vault | Network, DNS, TLS or wrong address |
| Runner fails before the playbook starts | Runner ServiceAccount not bound to the reader role, wrong authPath, TokenReview failing in Vault |
Vault's audit log shows which role read or wrote which path; use it before changing policies.