ตู้เซฟรหัส
vaultctl
A zero-knowledge, password-gated credentials vault that runs on your own box: everything encrypted at rest, one master password, nothing leaving the machine.
AES-256-GCM PBKDF2 600k go cli + flask service MIT
ปัญหาที่แก้ · the problem
Keys end up in the worst places
Secrets spread: a .env per project, tokens in shell history,
a password in a note the agent can read. Hosted secret managers solve it by asking for an
account, a bill and trust in someone else's infrastructure.
vaultctl takes the other path. It is a small Flask service that encrypts everything with a key derived from one master password, keeps that key in memory only while unlocked, and answers on loopback. The threat model is stated plainly: the machine is yours, the password is yours, and if you lose the password the data is gone.
how it works
One password in, one encrypted file out
key derivation and storage
master password ──▶ PBKDF2-HMAC-SHA256 (600,000 iterations) ──▶ 32-byte key
key + value ──▶ AES-256-GCM (fresh random 12-byte nonce) ──▶ credentials.enc (0600)
| Key derivation | PBKDF2-HMAC-SHA256, 600,000 iterations, per-vault salt |
| Encryption | AES-256-GCM, a fresh random nonce for every value |
| At rest | credentials.enc, mode 0600, useless without the password |
| Sessions | HttpOnly cookie plus a CSRF token, 30-minute idle expiry |
| Brute force | Exponentially increasing delay after a wrong password |
| Dependencies | Service: Python 3, Flask, cryptography. CLI + TUI: one static Go binary |
The derived key lives in process memory and nowhere else. Restart the service, or run
vaultctl lock, and every session is gone; unlocking again
re-derives the key from the password.
three ways in
A UI for humans, a CLI for everything else
web ui · go cli · terminal dashboard
-
Web UI
Set the master password, add and edit entries at
127.0.0.1:8787. An optional Svelte SPA can sit in front on:8788and proxies/api/*back to the vault. -
CLI
list,get,set,delete,copy,status,lock,audit,exec. One Go binary; point it at any instance withVAULT_URL. -
Terminal UI
vaultctl uiopens a full-screen dashboard in the same binary (Bubble Tea): live search, masked prompts, clipboard copy over SSH, keyboard CRUD, audit view. -
HTTP API
The three surfaces are the same API. Mutations need the
X-CSRF-Tokenreturned by/api/unlock.
vaultctl list # entry names only
vaultctl get NOUS_API_KEY # print to stdout (trusted shells only)
vaultctl set MY_TOKEN # masked prompt, keeps it out of shell history
vaultctl copy NOUS_API_KEY # clipboard over OSC52 (works over SSH)
vaultctl audit 50 # last 50 decisions, never values
vaultctl ui # terminal dashboard
Output adapts to where it goes: a terminal gets the styled interface, a pipe gets
plain text or JSON. list prints one name per line when
redirected, status prints JSON, and
--json forces machine output on any command.
safe consumption
The agent uses the key, it never sees it
vaultctl get prints a value to stdout, which means it lands
in your terminal, the transcript, and any log that captures output.
vaultctl exec is the safer path: it resolves the value
internally, injects it into the child process environment, and masks every occurrence
(and any fragment of six characters or more) in the child's stdout and stderr.
vaultctl exec NOUS_API_KEY -- my-tool --auth # env name defaults to the entry name
vaultctl exec NOUS_API_KEY --env AUTH_TOKEN -- my-tool # or pick the variable
vaultctl exec NOUS_API_KEY -- python3 -c 'import os; print(len(os.environ["NOUS_API_KEY"]))'
The child's exit code is propagated, so exec composes like a
normal command. This is the piece that makes the vault useful to an agent: a tool can be
handed a credential without the credential ever entering the conversation.
audit trail
A record of access, never a record of secrets
Every unlock, list, get, set and delete is appended to
data/audit.jsonl (mode 0600) as one JSON object per line. The
log records the decision and the reason, so a failed attempt is visible without the value
behind it being visible at all.
{"ts":"2026-10-28T04:48:56Z","action":"get","name":"NOUS_API_KEY","decision":"allow","reason":"ok","remote":"127.0.0.1"}
{"ts":"2026-10-28T04:51:02Z","action":"get","name":"DEPLOY_KEY","decision":"deny","reason":"locked","remote":"127.0.0.1"}
http api
The whole surface
base url http://127.0.0.1:8787
| Endpoint | Method | Purpose |
|---|---|---|
| /api/status | GET | init and unlock state |
| /api/setup | POST | first-time master password |
| /api/unlock | POST | open a session, returns the CSRF token |
| /api/lock | POST | close the session |
| /api/entries | GET | list entry names |
| /api/entries/<name> | GET | read one value |
| /api/entries | POST | create or update |
| /api/entries/<name> | DELETE | remove one |
| /api/change-password | POST | rotate the master password |
| /api/audit | GET | last N audit records |
development
Build against a mock, not against your secrets
The repository is the dev tree, not the live service. Run
./run.sh with no flags and you get a mock vault: in memory,
seeded with fake entries, any password unlocks it, but the same HTTP surface. Point
VAULT_URL at it and every consumer keeps working.
./run.sh # mock vault (default) on 127.0.0.1:8787
VAULT_PORT=9787 ./run.sh # mock on another port
VAULT_REAL=1 ./run.sh # the real encrypted vault
ข้อจํากัด · known limits
What it will not do
- Lose the master password and the data is unrecoverable. There is no reset, no backdoor and no support key. That is the threat model, not a bug.
- One password, one person. There are no users, roles or sharing. Every holder of the password has the whole vault.
- Loopback by default. Put a proxy and TLS in front if you need it from elsewhere, and think twice before exposing the port at all.
- No sync, no replication. The store is one encrypted file on one host. Back it up outside the box you run it on.
-
Python service, not a single file. Flask plus
cryptographyis the runtime; the vault is a small service, not a static executable. (The CLI and TUI are a single Go binary, but the store itself runs as a process.)