Replace root-SSH deploy with least-privilege chroot user #8
Labels
No labels
bug
enhancement
in-progress
needs-info
needs-triage
p0
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/nixos#8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
forgejo-actiondeploy key currently has root SSH access on the forgejo container (git.cloonar.com), authorized via root'sauthorizedKeys. This matches the pre-existing admin model — the shared RSA infleet.nix:15already grants root there — but it's a wider blast radius than the runner actually needs.Goal: replace root SSH with a dedicated low-privilege deploy user whose only capability is updating the SFTP chroots.
Target shape
bento-deploy) on the forgejo container./home/chroot/<host>/config/,/home/chroot/<host>/logs/,/home/chroot/<host>/last_change_date, set up viasystemd.tmpfiles.rulesinfleet.nix.forgejo-actionSSH key authorizes login asbento-deploywithcommand="..."pinning to a fixed deploy script; remove the key from root'sauthorizedKeysonce this lands.SSH_ORIGINAL_COMMAND) and performs the bento-styleinstall/rsync --chown/touch last_change_dateoperations within its narrow permission surface.Why this is deferred
The PR adopting Forgejo Actions for deploys (path A in ADR-0002) ships first as a literal translation of
bento deploy. Path B is net-new infra (new user, new tmpfiles rules, restricted-shell glue, possibly a chroot-ownership rework) and was scoped out to keep the migration focused.Open subquestions
command="..."+ arg validation vs sshd-levelForceCommand.rsync --deletesurvives the constrained shell, or whether to switch to plainsftpput/rm sequences for atomicity.References
docs/adr/0002-deploy-via-forgejo-action.md) — "Considered options" lists path B as a deferred alternative; path C (chroot-restructure) is a related but distinct rewrite..forgejo/workflows/deploy.ymlandscripts/sync-host— current path A implementation.