rig/commands
cluade-reviewer-andresmgsl 7f2501d0fe
Some checks failed
ci / check (pull_request) Failing after 7s
ci / install (pull_request) Successful in 4s
ci / db-integration (pull_request) Successful in 4s
labels / labels (pull_request) Failing after 7s
fix: refuse a PATH without /usr/sbin, before the token prompt
Reported from a real ci-box: `rig forgejo-runner install` read a registration
token off the operator's terminal and then died with

  …/forgejo-runner-install.sh: line 250: useradd: command not found

rig checked `id -u` and concluded it could administer the machine. Being root
and being able to FIND the admin binaries are different facts, and only the
first was asserted. `su` without `-`, sudo with a sanitised secure_path, and
several container images all produce a root shell with no /usr/sbin on PATH,
which is where useradd lives.

Three call sites had it: both runner installers and users apply. The last is
the worst — it runs mid-convergence, so a PATH-shorn root could fail partway
through a user sweep rather than before it starts.

require_admin_bins refuses rather than repairing PATH itself: a command that
quietly prepends /usr/sbin teaches the operator nothing and leaves a
misconfigured host misconfigured. The message names the remedy and,
deliberately, not this script — echoing an internal path back at someone who
typed `rig forgejo-runner install` is the unhelpful half of the original error.

It sits beside each root check, so identity and capability are asserted
together and before anything is spent. A secret typed for a run that could
never succeed is the avoidable half of this bug, and there is a test for
exactly that ordering.

Closes #139

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 18:39:03 +00:00
..
lib fix: refuse a PATH without /usr/sbin, before the token prompt 2026-08-01 18:39:03 +00:00
bootstrap-tenant.sh test: drive cron converge against stubbed systemctl 2026-07-25 19:11:13 +00:00
bootstrap-undo.sh feat: Forgejo-native CI — a ci-box tenant and a forgejo-runner family 2026-07-27 20:40:54 +00:00
bootstrap.sh fix: emit BOX_MANUAL line-by-line; bare command for single candidate 2026-07-29 22:38:32 +00:00
coolify-backup-install.sh fix: release channel is tag-only; revert coolify Documentation= 2026-07-29 14:45:40 +00:00
coolify-install.sh feat(bootstrap)!: machine roles carry a -server suffix; staging-server restored 2026-07-20 00:36:00 +00:00
db.sh feat(db): bring ad-hoc dump/restore on-box as rig db 2026-07-17 15:16:35 +00:00
forgejo-runner-install.sh fix: refuse a PATH without /usr/sbin, before the token prompt 2026-08-01 18:39:03 +00:00
forgejo-runner-remove.sh fix: one checksum policy, labeler coverage, orphaned-unit removal 2026-07-27 21:19:33 +00:00
forgejo-runner-status.sh test(forgejo-runner): drive the liveness note's state boundary 2026-07-31 20:13:23 +00:00
manifest.sh feat: /etc/rig/manifest — which rig converged this machine, and when 2026-07-20 12:48:39 +00:00
platform.sh feat(platform): ID names the machine — a namespaced sha256 of /etc/machine-id, computed at run time, stored nowhere (#95) 2026-07-24 07:48:45 +00:00
runner-install.sh fix: refuse a PATH without /usr/sbin, before the token prompt 2026-08-01 18:39:03 +00:00
runner-remove.sh fix: headless credential prompts refuse loudly, naming their variable (#42) 2026-07-19 12:15:08 +00:00
runner-repoint.sh fix: headless credential prompts refuse loudly, naming their variable (#42) 2026-07-19 12:15:08 +00:00
runner-status.sh fix(runner): install refuses a box registered to another repo 2026-07-13 14:57:28 +00:00
template-lint.sh test: cover machine template registry 2026-07-25 11:00:21 +00:00
users-apply.sh fix: refuse a PATH without /usr/sbin, before the token prompt 2026-08-01 18:39:03 +00:00
users-close-root.sh fix: don't read a missing /run/sshd as a broken sshd config 2026-07-20 17:58:10 +00:00
users-status.sh fix(users): review findings — invoker gate, real SSH revocation, StrictModes-shaped close-root gate, trait-aware box role 2026-07-17 20:01:19 +00:00