vault
vault
¶
Vault passphrase CLI verbs — session unlock / lock plus passphrase management.
The unlock/lock pair drives the session-tier slot of the SQLCipher
passphrase resolution chain: unlock lands a passphrase on the
session-unlock tmpfs file; lock removes it. Everything else lives
under vault passphrase:
vault passphrase sealpromotes the current passphrase into a machine-boundsystemd-credscredential.vault passphrase to-keyringmoves it from whichever tier holds it now into the OS keyring (the recommended upgrade path off the session-file / plaintext-config tiers).vault passphrase revealresolves and prints the current passphrase (to/dev/ttyby default, or stdout with--allow-redirect) and offers to mark the recovery key as saved.vault passphrase acknowledgemarks the current passphrase as saved without displaying it — the silent ack a TUI / CI captures.vault passphrase destroyclears every persistent tier so the vault becomes irrecoverable without an external copy of the passphrase.
Each container mounts its own short-lived
VaultProxy
that resolves the passphrase on demand. vault unlock / vault
lock therefore only manage the passphrase tier; a supervisor that's
already running keeps the passphrase it resolved at spawn, so picking
up a changed tier means starting a fresh task (delete the matching
one — per the no-state-preservation rule).
VAULT_COMMANDS = (CommandDef(name='vault', help='Vault passphrase management', children=(CommandDef(name='unlock', help='Provision the credentials-DB passphrase for this session (tmpfs file)', handler=_handle_vault_unlock), CommandDef(name='lock', help='Remove the session-unlock tmpfs file', handler=_handle_vault_lock), CommandDef(name='list', help='Inventory stored credentials (and optionally proxy tokens)', handler=_handle_vault_list, args=(ArgDef(name='--include-tokens', action='store_true', help='Also show proxy-token rows (token values are masked)'), ArgDef(name='--json', dest='as_json', action='store_true', help='Machine-readable JSON output'))), _PASSPHRASE_GROUP)),)
module-attribute
¶
__all__ = ['VAULT_COMMANDS']
module-attribute
¶
handle_vault_seal(*, cfg=None, key='auto')
¶
Seal the credentials-DB passphrase into a systemd-creds credential.
Adds the systemd-creds tier to the resolution chain: machine-bound
(TPM2 + host key, or either alone), survives reboot, no OS
keyring required. After sealing, every new supervisor resolves the
passphrase via systemd-creds decrypt on start — no operator
interaction needed at boot, no plaintext-on-disk.
Requires an already-resolvable passphrase — typically from a fresh
vault unlock in the current session.
Source code in src/terok_sandbox/commands/vault.py
handle_vault_to_keyring(*, cfg=None)
¶
Move the current passphrase from its current tier into the OS keyring.
Resolves the passphrase via the chain (or prompts as a last resort),
writes it to the keyring, flips credentials.use_keyring to true
in config.yml, clears any plaintext credentials.passphrase /
credentials.passphrase_command wiring, and removes the
session-file and sealed systemd-creds copies.
The validate-before-destroy ordering is deliberate: if the keyring write fails, the source tier is still intact.