KeePass Secret Bundle¶
Set up one small KeePass unlocking scaffold and use it to supply any number of API keys or credentials, each pulled from a single database without retyping the master password for every value.
Example¶
exec source name keepass_password selector override
env-alias:
SECRETS_KEEPASS_FILE:
name: null
exec: "cat ${HOME}/.config/keepass.file"
SECRETS_KEEPASS_PASSWORD:
name: null
exec: "cat $(cat ${HOME}/.config/keepass.password)"
CLOUD_API_TOKEN:
source: "env:SECRETS_KEEPASS_FILE"
selector: "cloud/portal:Password"
keepass_password: "env:SECRETS_KEEPASS_PASSWORD"
override: false
CI_REGISTRY_TOKEN:
source: "env:SECRETS_KEEPASS_FILE"
selector: "devops/registry:Password"
keepass_password: "env:SECRETS_KEEPASS_PASSWORD"
override: false
MONITORING_PUSH_KEY:
source: "env:SECRETS_KEEPASS_FILE"
selector: "ops/monitoring:Password"
keepass_password: "env:SECRETS_KEEPASS_PASSWORD"
override: false
Walkthrough:
SECRETS_KEEPASS_FILEandSECRETS_KEEPASS_PASSWORDareexec-based,name: nulldefinitions that locate the KeePass database and its master password once. They are reusable as-is across every project because they only hold the pointer-file logic, not the secrets.- Each later value is then a self-contained lookup:
sourcepoints at the database file andkeepass_passwordsupplies the master password, both viaenv:references to the scaffold.selectornames the entry to pull (group/title:Field). override: falsemeans an already-exported token is left alone, so repeated invocations do not re-unlock the database for a value that is already set this session.- Add as many lookups as you like — every value is unlocked from the same one-time scaffold.
Keepass setup
This pattern expects a small one-time setup: ${HOME}/.config/keepass.file contains the path to your .kdbx database, and ${HOME}/.config/keepass.password points to a file holding a KeePass key or password. keepassxc-cli must be on PATH. Env Alias keeps the database locked between invocations; it only reads the requested entry while the alias runs.