You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL;DR — Add a tool and a UI that create a project (= linux user) after deployment. Today this needs a Nix edit plus nixos-rebuild switch. Build it on the native backend (#325), where agentbox apply already does the work. Gate it behind the deployment password, which is the admin credential.
This body is the current state of the discussion. The comments below hold the working detail.
The ask
During deployment we create a linux user with a password for HTTP basic auth. The user is the isolated env. One user can run many agents (see #321) which some customized settings, but for real isolation we'd need a new user.
Suggest to add a tool+UI to create a new user. This could be on the root (see #221) with a new route for scope access to allow adding linux user = project. If so, the root UI needs to change to remove the redirect and to explain user = project (without using too much slang).
Settled
The deployment password is the admin credential. It authenticates the box owner, never a project. So "add project" sits behind it, not behind a project user's basic auth. "Root" in the earlier comments means the root route, not uid 0. The scope is the admin scope: web login admin, its own hash and its own cookie, and admin is a reserved project name. No uid-0 daemon anywhere.
The mechanism already exists.cmd_apply in bin/agentbox (refactor(native): Ubuntu/RHEL backend — no nixos-infect (#154 Phase 4) #325) creates the login, renders the per-user env, drop-ins, sudoers and Caddyfile, enables that user's four template instances, and disables the instances of a user that left the config. So "add a project" is one validated users: entry in /etc/agent-box/config.yaml, then agentbox apply. No second spec file.
Privilege, with no uid 0. Whoever can write config.yaml is root-equivalent, because apply renders sudoers.d fragments and unit drop-ins from it. So the admin daemon never writes that file and never runs as root. Instead a narrow wrapper — agent-box-project add|set-password|rm NAME — behind one sudoers line, the same shape as agent-box-session and agent-box-webhook.
/ stops being served by a project's settings daemon. Today it proxies to rootUser's daemon with AGENT_BOX_HOME=1 (modules/agent-box.nix.in:2374). That daemon runs as an unprivileged project user, and that project's agent can reach its socket. A separate admin daemon owns /; the per-user daemons keep zero privileged actions.
The single-project box does not change. Admin may enter any project, so a sign-in at / mints the chosen project's cookie and lands in the workspace. No picker. The picker appears with two or more projects. So the redirect stays, but it means "admin opens the only project".
Each project gets its own password, set by admin at creation. A per-project password matters when you hand one project to a different person. Native first_boot currently hashes the same deployment password into every /etc/agent-box/<user>.hash (bin/agentbox:927); that loop must write the admin hash only.
#325 must gain an auth-secrets oneshot first./run/agent-box-web/env holds WEB_PASSWORD_HASH_* and WEB_COOKIE_SECRET_*. Only apply --first-boot writes it (bin/agentbox:938), and caddy.service requires it with no - prefix (bin/agentbox:285). /run is tmpfs, and cloud-init runs first-boot once. So a native box loses its whole web front door on the first reboot, and a project added later has no hash and no cookie secret in that file. Fix: port webAuthSecretsService to the native renderer as a oneshot, RequiredBy=caddy.service. Reported on #325.
Related: #321 (profiles: many agents in one project), #221 (the /user/session path hierarchy), #127 (users are the trust boundary, sessions are the unit of work), #154 / #295 / #325 (the native refactor), #25 (plaintext deployment password), #313 (the other privileged affordance on the same page).
TL;DR — Add a tool and a UI that create a project (= linux user) after deployment. Today this needs a Nix edit plus
nixos-rebuild switch. Build it on the native backend (#325), whereagentbox applyalready does the work. Gate it behind the deployment password, which is the admin credential.This body is the current state of the discussion. The comments below hold the working detail.
The ask
Settled
admin, its own hash and its own cookie, andadminis a reserved project name. No uid-0 daemon anywhere.nixos-rebuildround-trip, because Portability: native Ubuntu/RHEL support (Nix-without-NixOS) — refactor tracker #154 Phase 4 removes that path. NixOS boxes get the same button at Phase 5, when the option tree renders the same spec.cmd_applyinbin/agentbox(refactor(native): Ubuntu/RHEL backend — no nixos-infect (#154 Phase 4) #325) creates the login, renders the per-user env, drop-ins, sudoers and Caddyfile, enables that user's four template instances, and disables the instances of a user that left the config. So "add a project" is one validatedusers:entry in/etc/agent-box/config.yaml, thenagentbox apply. No second spec file.config.yamlis root-equivalent, becauseapplyrenderssudoers.dfragments and unit drop-ins from it. So the admin daemon never writes that file and never runs as root. Instead a narrow wrapper —agent-box-project add|set-password|rm NAME— behind one sudoers line, the same shape asagent-box-sessionandagent-box-webhook./stops being served by a project's settings daemon. Today it proxies torootUser's daemon withAGENT_BOX_HOME=1(modules/agent-box.nix.in:2374). That daemon runs as an unprivileged project user, and that project's agent can reach its socket. A separate admin daemon owns/; the per-user daemons keep zero privileged actions./mints the chosen project's cookie and lands in the workspace. No picker. The picker appears with two or more projects. So the redirect stays, but it means "admin opens the only project".first_bootcurrently hashes the same deployment password into every/etc/agent-box/<user>.hash(bin/agentbox:927); that loop must write the admin hash only.Blocker
#325 must gain an auth-secrets oneshot first.
/run/agent-box-web/envholdsWEB_PASSWORD_HASH_*andWEB_COOKIE_SECRET_*. Onlyapply --first-bootwrites it (bin/agentbox:938), andcaddy.servicerequires it with no-prefix (bin/agentbox:285)./runis tmpfs, and cloud-init runs first-boot once. So a native box loses its whole web front door on the first reboot, and a project added later has no hash and no cookie secret in that file. Fix: portwebAuthSecretsServiceto the native renderer as a oneshot,RequiredBy=caddy.service. Reported on #325.Plan
agent-box-projectwrapper, plus its one sudoers line.Related: #321 (profiles: many agents in one project), #221 (the
/user/sessionpath hierarchy), #127 (users are the trust boundary, sessions are the unit of work), #154 / #295 / #325 (the native refactor), #25 (plaintext deployment password), #313 (the other privileged affordance on the same page).