Delivery
Secrets reach apps, CI and servers with identities of their own
No person's token in a pipeline, and no .env file on a disk. Each machine logs in as itself, gets a token for an hour, and reads only its folder.
Machine identities On Lockwell
In the console, an owner or admin makes an identity for a server, a CI job or a laptop. It gets read, or read and write, access to one folder, or to the whole team space. It's Vault's AppRole: a role_id that names it and a secret_id shown once. Each login gets a token good for an hour. Delete the identity and its logins stop at once; tokens it already handed out end within the hour.
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)Environment variables, no .env file On Lockwell
Start any process with its secrets in its environment. Paste this small shell function into your entrypoint or CI. It reads each folder through Vault's merged view, fills in references, and exports every field. Later folders override earlier ones.
# lw_env <tenant> <folder/>...: export every secret in the folders as variables, later folders winning.
# A secret's "value" field is named after the secret (DATABASE_URL); another field is NAME_FIELD (DB_PASSWORD).
lw_env() {
t=$1; shift
for f in "$@"; do
j=$(curl -sf -H "X-Vault-Token: $VAULT_TOKEN" "$VAULT_ADDR/v1/$t/resolved/$f?values=true&resolve=true") \
|| { echo "lw_env: can't read $t/$f" >&2; return 1; }
eval "$(printf '%s' "$j" | jq -r '.data.secrets[] | .name as $n | (.data // {}) | to_entries[]
| (if .key == "value" then $n else "\($n)_\(.key)" end | ascii_upcase | gsub("[^A-Z0-9_]"; "_")) as $k
| "export \($k)=\(.value | if type == "string" then . else tojson end | @sh)"')"
done
}lw_env lw-<team> shared/ prod/ && exec ./server --port 8080vault-run, Vault's own binary that does this, isn't published as a download for Lockwell yet. The function above uses only curl and jq.
CI pipelines On Lockwell
Keep the identity's role_id and secret_id in your CI's own secret settings. The job logs in at its start and reads what it needs. On GitHub Actions, mask every value before using it:
# .github/workflows/deploy.yml: LOCKWELL_ROLE_ID and LOCKWELL_SECRET_ID in the repository's secrets
- name: Secrets from Lockwell
env:
VAULT_ADDR: https://vault.lunaor.com
ROLE_ID: ${{ secrets.LOCKWELL_ROLE_ID }}
SECRET_ID: ${{ secrets.LOCKWELL_SECRET_ID }}
run: |
TOKEN=$(curl -sf "$VAULT_ADDR/v1/auth/approle/login" \
-d "{\"role_id\":\"$ROLE_ID\",\"secret_id\":\"$SECRET_ID\"}" | jq -r .auth.client_token)
J=$(curl -sf -H "X-Vault-Token: $TOKEN" "$VAULT_ADDR/v1/lw-<team>/resolved/ci/?values=true&resolve=true")
# mask every value in the job's log, then hand each secret to the later steps
echo "$J" | jq -r '.data.secrets[].data // {} | .[] | tostring | "::add-mask::" + .'
echo "$J" | jq -r '.data.secrets[] | .name as $n | (.data // {}) | to_entries[]
| "\(if .key == "value" then $n else "\($n)_\(.key)" end | ascii_upcase | gsub("[^A-Z0-9_]"; "_"))=\(.value | tostring)"' >> "$GITHUB_ENV"More, including GitLab and a leak check that fails the build, in Secrets in CI.
Any language, over HTTP On Lockwell
It's Vault's KV v2 API, so HashiCorp's client libraries for KV and AppRole work, and so does plain HTTP. Log in once, keep the token for its hour, and read /v1/lw-<team>/data/<path>.
Servers
Move your first app's secrets in an afternoon.
Free for up to 100 secrets and 2 machine identities. Every teammate is free on every plan.