act_runner runs as a systemd service on a dedicated VM; jobs run in Docker containers, one fresh container per job. The design decision is recorded in kasun/homelab-infrastructure-as-code#82.
Steps
Dedicated SSH key for the runner VM on the Ansible node (~/.ssh/runner_vm, created before the VM, public key in runnerAnsibleSshPublicKey of 01-proxmox-infra). The inventory uses it only for the runner host, never the general deploy key. Access to the runner VM is as sensitive as the CI credentials
Base setup: install qemu-guest-agent (the VM has the agent enabled in Proxmox, the cloud image doesn't ship it), unattended security updates
Role docker: install Docker Engine from Docker's apt repo, pinned version
Role gitea_runner: dedicated user act_runner without sudo, in the docker group (note: that is root-equivalent on the VM; the VM boundary is the real isolation)
Download a pinned act_runner binary and verify its SHA-256
Template config.yaml, 0600, owned by act_runner:
runner.capacity: 1
a unique label mapped to a pinned job image, e.g. runner-vm:docker://<image>@sha256:...
container.docker_host: "-" so job containers don't get the Docker socket (check the current act_runner docs for the exact semantics)
no privileged, no extra valid_volumes
systemd unit with hardening that still lets the runner reach Docker: NoNewPrivileges=yes, ProtectSystem=strict, ProtectHome=yes, PrivateTmp=yes, ReadWritePaths= limited to the runner's dirs
Registration: the playbook asks for the token with vars_prompt (private: true, no_log: true) and only registers when .runner doesn't exist. The token is not stored anywhere (no .env, no OpenBao): generate a fresh one in Gitea when needed and reset it right after registering
Register at user level (kasun) so both homelab-* repos can use it, not instance-wide
Prune old job images and volumes regularly (systemd timer with docker system prune --filter until=...)
Switch the workflows' runs-on to the new label and run each one once on the new runner
Retire the old runner: deregister it in Gitea, remove the gitea-runner service and GITEA_RUNNER_REGISTRATION_TOKEN from the Docker host's compose file and .env, delete /home/pi/docker/gitea-runner/ (its .runner file is a working credential), then reset the registration token
Tools
Ansible, act_runner, Docker, systemd hardening.
Done when
A test workflow with runs-on: <new label> succeeds on the new runner
A test job can't see the Docker socket (ls /var/run/docker.sock fails inside the job)
The Docker runner is gone and its token is deregistered
The runner host in the inventory uses ~/.ssh/runner_vm, and that key works on no other host
Portfolio evidence
systemd-analyze security act_runner output
Screenshot of the runner in Gitea and a successful job
Part of the security roadmap. Keep the evidence below for the write-up (README / blog post).
## Why
The runner VM (kasun/homelab-infrastructure-as-code#82) needs a reproducible, hardened runner setup. Afterwards the old Docker runner can be retired.
**Enterprise practice:** configuration management for build agents, short-lived registration secrets, least privilege for the agent.
Depends on kasun/homelab-infrastructure-as-code#82.
## Design
act_runner runs as a systemd service on a dedicated VM; jobs run in Docker containers, one fresh container per job. The design decision is recorded in kasun/homelab-infrastructure-as-code#82.
## Steps
- [ ] Dedicated SSH key for the runner VM on the Ansible node (`~/.ssh/runner_vm`, created before the VM, public key in `runnerAnsibleSshPublicKey` of `01-proxmox-infra`). The inventory uses it only for the runner host, never the general deploy key. Access to the runner VM is as sensitive as the CI credentials
- [ ] Base setup: install `qemu-guest-agent` (the VM has the agent enabled in Proxmox, the cloud image doesn't ship it), unattended security updates
- [ ] Role `docker`: install Docker Engine from Docker's apt repo, pinned version
- [ ] Role `gitea_runner`: dedicated user `act_runner` without sudo, in the `docker` group (note: that is root-equivalent on the VM; the VM boundary is the real isolation)
- [ ] Download a pinned `act_runner` binary and verify its SHA-256
- [ ] Template `config.yaml`, `0600`, owned by `act_runner`:
- `runner.capacity: 1`
- a unique label mapped to a pinned job image, e.g. `runner-vm:docker://<image>@sha256:...`
- `container.docker_host: "-"` so job containers **don't** get the Docker socket (check the current act_runner docs for the exact semantics)
- no `privileged`, no extra `valid_volumes`
- [ ] systemd unit with hardening that still lets the runner reach Docker: `NoNewPrivileges=yes`, `ProtectSystem=strict`, `ProtectHome=yes`, `PrivateTmp=yes`, `ReadWritePaths=` limited to the runner's dirs
- [ ] Registration: the playbook asks for the token with `vars_prompt` (`private: true`, `no_log: true`) and only registers when `.runner` doesn't exist. The token is **not stored** anywhere (no `.env`, no OpenBao): generate a fresh one in Gitea when needed and reset it right after registering
- [ ] Register at user level (`kasun`) so both `homelab-*` repos can use it, not instance-wide
- [ ] Prune old job images and volumes regularly (systemd timer with `docker system prune --filter until=...`)
- [ ] Switch the workflows' `runs-on` to the new label and run each one once on the new runner
- [ ] Retire the old runner: deregister it in Gitea, remove the `gitea-runner` service and `GITEA_RUNNER_REGISTRATION_TOKEN` from the Docker host's compose file and `.env`, delete `/home/pi/docker/gitea-runner/` (its `.runner` file is a working credential), then reset the registration token
## Tools
Ansible, act_runner, Docker, systemd hardening.
## Done when
- A test workflow with `runs-on: <new label>` succeeds on the new runner
- A test job can't see the Docker socket (`ls /var/run/docker.sock` fails inside the job)
- The Docker runner is gone and its token is deregistered
- The runner host in the inventory uses `~/.ssh/runner_vm`, and that key works on no other host
## Portfolio evidence
- [ ] `systemd-analyze security act_runner` output
- [ ] Screenshot of the runner in Gitea and a successful job
---
_Part of the security roadmap. Keep the evidence below for the write-up (README / blog post)._
claude-botBot
added this to the Security Roadmap 1: Secure container supply chain milestone 2026-12-03 04:39:32 +01:00
claude-botBot
changed title from Roadmap 1.2: Install and register act_runner on the runner LXC to Roadmap 1.2: Install and register act_runner on the runner VM2026-12-04 18:25:44 +01:00
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.
Why
The runner VM (kasun/homelab-infrastructure-as-code#82) needs a reproducible, hardened runner setup. Afterwards the old Docker runner can be retired.
Enterprise practice: configuration management for build agents, short-lived registration secrets, least privilege for the agent.
Depends on kasun/homelab-infrastructure-as-code#82.
Design
act_runner runs as a systemd service on a dedicated VM; jobs run in Docker containers, one fresh container per job. The design decision is recorded in kasun/homelab-infrastructure-as-code#82.
Steps
~/.ssh/runner_vm, created before the VM, public key inrunnerAnsibleSshPublicKeyof01-proxmox-infra). The inventory uses it only for the runner host, never the general deploy key. Access to the runner VM is as sensitive as the CI credentialsqemu-guest-agent(the VM has the agent enabled in Proxmox, the cloud image doesn't ship it), unattended security updatesdocker: install Docker Engine from Docker's apt repo, pinned versiongitea_runner: dedicated useract_runnerwithout sudo, in thedockergroup (note: that is root-equivalent on the VM; the VM boundary is the real isolation)act_runnerbinary and verify its SHA-256config.yaml,0600, owned byact_runner:runner.capacity: 1runner-vm:docker://<image>@sha256:...container.docker_host: "-"so job containers don't get the Docker socket (check the current act_runner docs for the exact semantics)privileged, no extravalid_volumesNoNewPrivileges=yes,ProtectSystem=strict,ProtectHome=yes,PrivateTmp=yes,ReadWritePaths=limited to the runner's dirsvars_prompt(private: true,no_log: true) and only registers when.runnerdoesn't exist. The token is not stored anywhere (no.env, no OpenBao): generate a fresh one in Gitea when needed and reset it right after registeringkasun) so bothhomelab-*repos can use it, not instance-widedocker system prune --filter until=...)runs-onto the new label and run each one once on the new runnergitea-runnerservice andGITEA_RUNNER_REGISTRATION_TOKENfrom the Docker host's compose file and.env, delete/home/pi/docker/gitea-runner/(its.runnerfile is a working credential), then reset the registration tokenTools
Ansible, act_runner, Docker, systemd hardening.
Done when
runs-on: <new label>succeeds on the new runnerls /var/run/docker.sockfails inside the job)~/.ssh/runner_vm, and that key works on no other hostPortfolio evidence
systemd-analyze security act_runneroutputPart of the security roadmap. Keep the evidence below for the write-up (README / blog post).
Roadmap 1.2: Install and register act_runner on the runner LXCto Roadmap 1.2: Install and register act_runner on the runner VM