# One-time bootstrap - Status: SHIPPED in C++ port - Spec: FR-01, FR-11, OPS-01 - Sources: `tosv.cpp` main plus login handler, `archive/tosv.py` legacy, `uploads/paste.txt` vision, SPEC.md 6.1 ## What it is On first run the binary creates `.env.json` with user `admin` and a fresh 16-char pass from the 64-alphabet, then serves a login page. The first POST with those creds sets `used=1`, mints store creds plus a duress value, burns the bootstrap pair forever, and drops a session cookie. The file holds plaintext by design: there is no key yet to encrypt it with, and any obfuscation would be theater. ## How TOSV does it `main` checks `ENVF`, writes JSON if missing. The login handler reads the file, compares bootstrap only when `db.used` is false, and on match issues `store_<8hex>` plus 22-char pass plus `duress:<8hex>`, saves the DB atomically, and audits `bootstrap` with the peer IP. Later logins with bootstrap creds get `denied`, because `used` is set. ## What it protects against Shipped default passwords (there are none: every install mints its own), credential replay (single use kills second logins), and installer-time interception after burn (the file becomes useless). ## Attack realism High for the window it covers. Vaults get popped most often through `admin/admin` defaults and reused installer creds. A random, single-use, self-provisioned pair removes that whole class. The remaining window is first boot to first login on a compromised host, which no software design can close: local root at boot owns the mint. ## Pros No defaults to scan for. Zero operator key ceremony. Self-healing: even a leaked `.env.json` from a running vault authenticates nothing. ## Cons and how the vault resolves them - Plaintext at rest before burn. Resolved three ways: the binary binds [loopback](sec-transport.md) so only local processes reach the login; the burn happens on first use so the window is minutes; the [audit](sec-audit.md) line proves when the burn happened. - Operator loses the pass before first login. Resolved by deleting `.env.json` plus DB and restarting for a fresh mint, documented in the bootstrap recovery runbook (M4). No backdoor needed. - Attacker races the first login. Resolved by loopback bind: only local users can race, and local users with that timing already own the box. Remote racing is impossible without the stunnel front, which the operator adds after bootstrap. ## Residual risk Local root between mint and burn can steal the pair. Accepted: that attacker needs no login at all. Mitigation is operational: bootstrap immediately after first start, on a trusted console. M6: corrupt-env empty logins and pre-bootstrap colon auth are denied, proven on scratch servers. ## See also - [Security index](security.md), [transport](sec-transport.md), [duress](sec-duress.md), [audit](sec-audit.md)