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>
32 lines
946 B
Rust
32 lines
946 B
Rust
//! pass-broker — hands Proton Pass items to darman's processes (Claude
|
|
//! included) only after a Telegram approval.
|
|
//!
|
|
//! The daemon runs as its own system user and holds the only pass-cli session
|
|
//! (an agent PAT), so nothing running as darman can read it directly. Clients
|
|
//! talk to it over a unix socket; see services/identity/pass-broker.nix.
|
|
|
|
mod client;
|
|
mod config;
|
|
mod daemon;
|
|
mod pass;
|
|
mod proto;
|
|
mod telegram;
|
|
|
|
use anyhow::Result;
|
|
|
|
const USAGE: &str = "usage: pass-broker get --item <title> --reason <why> [--vault <name>] [--field <name>]
|
|
pass-broker daemon";
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<()> {
|
|
let args: Vec<String> = std::env::args().skip(1).collect();
|
|
match args.first().map(String::as_str) {
|
|
Some("daemon") => daemon::run().await,
|
|
Some("get") => client::get(&args[1..]).await,
|
|
_ => {
|
|
eprintln!("{USAGE}");
|
|
std::process::exit(2);
|
|
}
|
|
}
|
|
}
|