feat(terra): pass-broker for Telegram-approved Proton Pass access

A Rust daemon running as its own system user holds terra's only pass-cli
session, an agent PAT scoped to the HomeLab vaults. `pass-broker get` asks
it for an item; per-item rules decide auto/ask/deny, and "ask" sends a
Telegram prompt that only darman's account can approve (10-min grant for
darman@*/root@*). Requests whose client is gone are dropped or withdrawn,
and the client gives up after 30s without an answer.

scripts/deploy uses the broker exclusively when its socket exists. Covered
by checks.pass-broker (fake pass-cli + Telegram). Secrets added for all
hosts; only terra runs the broker so far.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 01:48:46 +02:00
co-authored by Claude Opus 5.5
parent e6ceacb63b
commit 3dccafe2b8
22 changed files with 2645 additions and 13 deletions
+15
View File
@@ -51,6 +51,14 @@ empty password, so the script resolves the title among `--filter-state active` i
first; a plain `pass-cli item view --item-title` silently returns the trashed copy and
you get an interactive prompt with no explanation.
On terra the values come from **pass-broker** (`services/identity/pass-broker.nix`), not
from anyone's own pass-cli session: it runs as its own user with an agent PAT scoped to
the HomeLab vaults and releases an item only after a tap on its Telegram bot. When the
socket exists, deploy uses it exclusively; a refused tap falls back to the interactive prompt.
**Claude: fetch Proton Pass items only via `pass-broker get --item <title> --reason <why>`**,
never `pass-cli login` yourself, and never print a value you fetched. Values go into
variables or pipes, as `scripts/deploy` does.
`HOMELAB_KEXEC_TARBALL` (+ `_CPIO` / `_GZIP`) makes `kexec`/`kexec-local` reuse a
prebuilt installer instead of rebuilding ~500MB. The VM test below uses this.
@@ -77,6 +85,9 @@ nix build .#checks.x86_64-linux.kexec-local -L
# VM test of luna's app hosting on mars (hosts/mars/luna-sites.nix): podman socket
# proxy, registry validation, caddy routes, reboot persistence
nix build .#checks.x86_64-linux.luna-sites -L
# VM test of pass-broker with fake pass-cli + Telegram: approve/deny/expiry,
# grants, policy, uid check
nix build .#checks.x86_64-linux.pass-broker -L
```
`checks.kexec-local` is the only way to exercise `kexec-local` at all: it jumps the
@@ -210,6 +221,10 @@ kept its ssh host key. Run it after ANY change to the kexec paths.
- **`kexec-local` stages on `/var/tmp`, not `/tmp`**: `kexec-run.sh` appends a fresh cpio
to `kexec/initrd` in place and execs binaries from that dir, so a size-capped or
`noexec` tmpfs gives a half-written initrd or a bare "Permission denied".
- **sops-nix values must be STRINGS.** `sops --set '["id"] 123'` stores `type:int`; the
build-time check only sees key names and passes, then activation's sops-install-secrets
fails with "is not a string" and installs NONE of the new secrets. The old generation
stays, so it looks like only the new keys are missing. Quote it: `'["id"] "123"'`.
- **A sops secret a USER service reads needs `owner`, not a mode.** `luna-voiced`
(`services/desktop/luna-voice.nix`) runs as darman's user unit, and a user manager
cannot read root:root 0400 — `LoadCredential` does not bridge that gap either.