umbra audio bc031dd079 Bootstrap: one file, and it works with or without root
Enrolling a node meant a person reading instructions and running them, with a
credential typed into a terminal. That does not scale, and it makes the controller a
courier. The flow is now: an administrator renders a script, hands over one curl, and
the node sets itself up.

`GET /api/node/agent` serves the agent to a credentialed node. A node credential
already implies "run what the controller sends" - that is what claiming a job is - so
this adds no authority; it removes the hand-copying. `POST /api/compute/pairing-script`
renders the bootstrap, minting a pairing code server-side so a code pasted into a
request body cannot be one issued earlier for something else.

## The exclusive/shared distinction, encoded

The script asks whether it has root and branches. With root: `/opt/umbra`, a system
unit, and the agent running as a dedicated `umbra-node` account with NoNewPrivileges and
ProtectSystem=strict. Without: the user's own directories and a user unit. Both layouts
are in the output and the runtime decides, because whoever renders the script does not
always know how the person at the machine will run it.

The credential goes in a 0600 file referenced by systemd's EnvironmentFile. Three
alternatives were rejected and the reasons are in the code: a unit file is
world-readable, a config holding a secret ends up in a backup, and the agent
deliberately refuses to read the key from its config when the environment can carry it.

## Verified on node 238, not just reasoned about

Ran it as `umbra` with no root: paired, installed, registered, and the agent went
`online`. Six defects found only by running it:

- `$BOOTSTRAP_VERSION` was interpolated into the shell body but never declared as a
  shell variable. `set -u` caught it on the first line that used it.
- The agent fetch sent no credential and got a 401 - correct behaviour, wrong script.
- `ExecStart` pointed at the agent file directly. It has no shebang, so the kernel
  tried to run it as a binary: "Exec format error", a service in a restart loop, and
  nothing on the controller. Now invoked through `python3` explicitly, and the file is
  644 rather than 755 because it is source.
- `sed -i` with no backup suffix is GNU-only; BSD reads the next argument as a suffix,
  so on macOS it would leave the unit unfiltered and install hardening directives that
  cannot work. Replaced with a portable filter.
- Pairing a name already in use surfaced as a bare 500 from a UniqueViolation. Now
  `node_name_taken`, with an answer that says pairing does not replace an existing node.
- The agent logged "claim failed: node_scope_required" every second, forever. A
  read-only credential can never gain compute:claim, so this is permanent, and a
  warning that cannot change trains a reader to ignore warnings. Announced once.

## A privilege bug the pinned tests caught

The bootstrap renderer declared an administrator dependency while sitting on the *node*
router. A node could have called it to mint itself a credential for any node name. It
is now `POST /api/compute/pairing-script` on the admin router, above the agent-surface
marker so `test_every_node_route_uses_node_credential_authentication` keeps meaning
something.

Also worth noting: a node cannot be DELETEd from the database, because the pairing-code
reuse trigger refuses the `ON DELETE SET NULL` cascade. That is correct - the status
enum has `retired` and the admin route drains and retires, so removal is a status
change, not a row deletion. Found by trying to clean up after a failed test run.

525 passed, 27 skipped. Test nodes boot-test-1..3 are retired, not deleted.
2026-10-03 09:53:28 -07:00

UmbraTrans local bootstrap workspace

This workspace contains the unprivileged agent-comm server requested by the Oldbox handoff. It does not contain the UmbraTrans application source: no application bundle was present locally. A staged archive, if present, is left untouched.

Layout

  • agent_comm/ — Python 3.11+ standard-library, stdio-only MCP server.
  • agent_comm/tests/ — dependency-free unit tests.
  • umbratrans_web/ — phase-1 account/user-management backend slice (FastAPI, Argon2id, sessions, admin routes, in-memory and local JSON development repositories). It does not connect to PostgreSQL; see umbratrans_web/README.md.
  • umbratrans_web/migrations/ — proposed, unapplied phase-1 identity SQL and its rollback.
  • opencode.json — non-secret OpenCode registration for the confirmed NAS2 mailbox.
  • agent-comm.local.example.json — non-secret local fallback registration.
  • .env.example — non-secret environment template.
  • DATA-SEPARATION.md — development/production boundary.

Confirmed NAS2 mailbox

The oldbox desktop account mounted NAS2 netbackup through its user GVfs session and confirmed the UmbraTrans directory readable, searchable, and writable. The server requires the explicit NAS deployment mode, the enclosing GVfs mount, and an affirmative mount confirmation:

/run/user/1002/gvfs/smb-share:server=nas2.local,share=netbackup/UmbraTrans/agent-mailbox

Run read-only health checks:

cd /home/umbra/src/UmbraTrans
AGENT_COMM_MODE=nas \
AGENT_COMM_NAS_MOUNT=/run/user/1002/gvfs \
AGENT_COMM_NAS_CONFIRMED=1 \
AGENT_COMM_ROOT='/run/user/1002/gvfs/smb-share:server=nas2.local,share=netbackup/UmbraTrans/agent-mailbox' \
/home/umbra/.local/bin/uv run python -m agent_comm --check

If the user GVfs session is absent, do not guess another path or broaden share permissions. Use the private local fallback documented in agent-comm.local.example.json, or have a privileged operator restore the confirmed user mount.

The server speaks newline-delimited MCP JSON-RPC over stdin/stdout. It opens no network socket and never executes queued instructions.

OpenCode registration

opencode.json contains the exact NAS configuration and paths only. It must never contain passwords, tokens, private keys, or other secrets. A Mac-side reader still needs separate configuration and verification before an outbox message can be considered received.

Development workflow

The project uses uv and a workspace-local virtual environment:

cd /home/umbra/src/UmbraTrans
/home/umbra/.local/bin/uv sync --python /usr/bin/python3
/home/umbra/.local/bin/uv run python -m unittest discover -s agent_comm/tests -v
/home/umbra/.local/bin/uv run ruff check .
/home/umbra/.local/bin/uv run ruff format --check .
/home/umbra/.local/bin/uv run python -m compileall -q agent_comm
make check

The tests cover schema and size validation, atomic no-overwrite writes, restrictive modes, path traversal, symlink refusal, secret-pattern redaction, inbox processing, and read-only initialization.

The account-management slice has its own targets:

cd /home/umbra/src/UmbraTrans
/home/umbra/.local/bin/uv run pytest umbratrans_web/tests
make web-check

Its tests use the in-memory repository and generated per-run passwords; they never read a production configuration, never connect to a database, and contain no credential material.

Backups

scripts/umbratrans_backup.sh is installed root-owned as /usr/local/sbin/umbratrans-backup and scheduled by the enabled umbratrans-backup.timer. It writes only to the confirmed NAS2 netbackup/UmbraTrans/backups tree:

  • PostgreSQL: pg_dump custom-format logical dump, never a live data-directory copy.
  • Configuration: PostgreSQL configuration files only.
  • Workspace: source/configuration archive excluding .venv, Git internals, runtime data, local mailboxes, and secret-bearing files.

Each file is staged outside the share, published with an atomic rename as umbra, checksummed, and verified after publication. Retention is 30 days for PostgreSQL/configuration/manifests and 14 days for workspace archives; stale temporary files older than one hour are removed. The timer fails closed if the user GVfs mount is absent and does not mount or broaden the NAS share.

The current first-run backup set is present under:

/run/user/1002/gvfs/smb-share:server=nas2.local,share=netbackup/UmbraTrans/backups

Check timer status with systemctl status umbratrans-backup.timer and the last run with journalctl -u umbratrans-backup.service.

Description
UmbraTrans control system: repository, API, and compute substrate.
Readme Apache-2.0 3 MiB
Languages
Python 75.5%
JavaScript 10.7%
PLpgSQL 6.2%
HTML 3.4%
CSS 2.2%
Other 2%