Untrusted work (PR checks) and trusted work (deploys) must not share a runner or credentials. A runner is only as safe as the least trusted job it accepts.
Enterprise practice: runner groups per trust level, deploy runners restricted to protected branches, no access to the container engine from jobs.
Steps
Checks runner (on docker)
Check container.docker_host in the act_runner config. If it is empty, act_runner mounts the Docker socket into job containers, which gives every PR job control over all containers on docker (Gitea, Postgres, apps). Set it to - so the socket isn't mounted
Set container.valid_volumes to an empty list, so workflows can't mount host paths
Make sure the checks runner holds no deploy keys or secrets
Deploy runner (on ansible)
Dedicated unprivileged user (act_runner), no sudo
Registered to this repo only, label ansible:host
Own SSH key for docker, separate from personal keys
Deploy workflows trigger only on push to main or workflow_dispatch, never on pull_request
Replace actions/checkout with a plain git fetch step, so no third-party code runs on this runner; then remove nodejs from the LXC
Set runner.capacity: 1, so deploys never run in parallel
No PR job can reach the Docker socket or a deploy key, and the deploy runner runs only first-party code from main.
Untrusted work (PR checks) and trusted work (deploys) must not share a runner or credentials. A runner is only as safe as the least trusted job it accepts.
**Enterprise practice:** runner groups per trust level, deploy runners restricted to protected branches, no access to the container engine from jobs.
## Steps
### Checks runner (on `docker`)
- [ ] Check `container.docker_host` in the act_runner config. If it is empty, act_runner mounts the Docker socket into job containers, which gives every PR job control over all containers on `docker` (Gitea, Postgres, apps). Set it to `-` so the socket isn't mounted
- [ ] Set `container.valid_volumes` to an empty list, so workflows can't mount host paths
- [ ] Make sure the checks runner holds no deploy keys or secrets
### Deploy runner (on `ansible`)
- [x] Dedicated unprivileged user (`act_runner`), no sudo
- [x] Registered to this repo only, label `ansible:host`
- [x] Own SSH key for `docker`, separate from personal keys
- [ ] Deploy workflows trigger only on `push` to `main` or `workflow_dispatch`, never on `pull_request`
- [ ] Replace `actions/checkout` with a plain `git fetch` step, so no third-party code runs on this runner; then remove `nodejs` from the LXC
- [ ] Set `runner.capacity: 1`, so deploys never run in parallel
## Tools
act_runner config (`config.yaml`), Gitea workflow triggers.
## Done when
No PR job can reach the Docker socket or a deploy key, and the deploy runner runs only first-party code from `main`.
Update: the checks runner on docker (the gitea-runner container) is being retired by #18. Its replacement is a dedicated runner VM (kasun/homelab-infrastructure-as-code#82) with Docker job containers, docker_host: "-" and empty valid_volumes, so the "Checks runner" steps above move to #18.
Open point for this ticket: the new VM runner is planned to serve PR checks for both homelab-* repos and the infra deploys of homelab-infrastructure-as-code (Proxmox, pfSense, Pulumi credentials). That mixes trust levels, which this ticket says to avoid. Options: register a second runner instance with its own label on the same VM for PR checks only (weaker, same host), or a separate small checks VM. To decide before #18 is done.
Update: the checks runner on `docker` (the `gitea-runner` container) is being retired by #18. Its replacement is a dedicated runner VM (kasun/homelab-infrastructure-as-code#82) with Docker job containers, `docker_host: "-"` and empty `valid_volumes`, so the "Checks runner" steps above move to #18.
Open point for this ticket: the new VM runner is planned to serve PR checks for both `homelab-*` repos **and** the infra deploys of homelab-infrastructure-as-code (Proxmox, pfSense, Pulumi credentials). That mixes trust levels, which this ticket says to avoid. Options: register a second runner instance with its own label on the same VM for PR checks only (weaker, same host), or a separate small checks VM. To decide before #18 is done.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Untrusted work (PR checks) and trusted work (deploys) must not share a runner or credentials. A runner is only as safe as the least trusted job it accepts.
Enterprise practice: runner groups per trust level, deploy runners restricted to protected branches, no access to the container engine from jobs.
Steps
Checks runner (on
docker)container.docker_hostin the act_runner config. If it is empty, act_runner mounts the Docker socket into job containers, which gives every PR job control over all containers ondocker(Gitea, Postgres, apps). Set it to-so the socket isn't mountedcontainer.valid_volumesto an empty list, so workflows can't mount host pathsDeploy runner (on
ansible)act_runner), no sudoansible:hostdocker, separate from personal keyspushtomainorworkflow_dispatch, never onpull_requestactions/checkoutwith a plaingit fetchstep, so no third-party code runs on this runner; then removenodejsfrom the LXCrunner.capacity: 1, so deploys never run in parallelTools
act_runner config (
config.yaml), Gitea workflow triggers.Done when
No PR job can reach the Docker socket or a deploy key, and the deploy runner runs only first-party code from
main.Update: the checks runner on
docker(thegitea-runnercontainer) is being retired by #18. Its replacement is a dedicated runner VM (kasun/homelab-infrastructure-as-code#82) with Docker job containers,docker_host: "-"and emptyvalid_volumes, so the "Checks runner" steps above move to #18.Open point for this ticket: the new VM runner is planned to serve PR checks for both
homelab-*repos and the infra deploys of homelab-infrastructure-as-code (Proxmox, pfSense, Pulumi credentials). That mixes trust levels, which this ticket says to avoid. Options: register a second runner instance with its own label on the same VM for PR checks only (weaker, same host), or a separate small checks VM. To decide before #18 is done.