Roadmap 1.1: Provision a VM for the CI runner #82

Open
opened 2026-12-03 04:39:32 +01:00 by claude-bot · 0 comments

Why

The Gitea runner currently runs as the gitea/runner:latest container on the Docker host, next to Gitea, Postgres and all other services. A job that reaches the Docker socket effectively has root on that host. Build and deploy jobs should run on a dedicated machine with its own blast radius.

The runner stays outside the k3s cluster on purpose: 01 and 02 create and repair the cluster, so the runner can't depend on it. This is the homelab version of an enterprise management plane; recovery when everything is down is pulumi up from the workstation.

Enterprise practice: isolated build agents with their own kernel, separated from production workloads, provisioned as code.

Design

  • A VM, not an LXC. Jobs run in Docker, and Docker in an unprivileged LXC needs nesting + keyctl, which widens the shared-kernel attack surface towards the Proxmox host. The runner holds the most powerful credentials (Proxmox, pfSense, Pulumi), so it gets its own kernel
  • act_runner runs as a systemd service on the VM (installed with Ansible, see kasun/homelab-ansible#18)
  • Jobs run in Docker containers, one fresh container per job, thrown away afterwards. Jobs don't get the Docker socket (container.docker_host: "-"), and capacity: 1

Steps

  • Define the VM in 01-proxmox-infra: full clone of the Ubuntu Noble template on pve-b550, 2 vCPU, 4 GB RAM, 20 GB disk, fixed MAC with a pfSense DHCP reservation, SSH key login only (no password). The Ansible node gets a dedicated key used only for this VM (runnerAnsibleSshPublicKey), so its access can be revoked on its own
  • Set proxmox-infra:runnerIp in the private config repo and push it before the PR
  • Proxmox firewall on the VM: inbound SSH only from the Ansible node and the Proxmox hosts (whoever can SSH in can read the CI credentials during the next deploy); outbound only DNS (pfSense), Gitea and the Pulumi state Postgres on the Docker host (ports 3000/5432 only), the Proxmox API (pve1 to pve3), the pfSense API, SSH to the k3s nodes (02) and the k3s API via the control-plane VIP. Drop and log the rest of the private ranges. The internet stays open for registries, npm and NTP: the Proxmox firewall filters by IP, so a domain allowlist would need an egress proxy (follow-up). The datacenter firewall on pve-b550 is enabled with ACCEPT policies so the VM rules apply
  • Enable Proxmox backups for the VM
  • Export the IP as a stack output and add the host to the Ansible inventory

Tools

Pulumi (Proxmox provider), Proxmox VE firewall.

Done when

  • pulumi up creates the VM and it gets its reserved IP
  • SSH from the Ansible node with its dedicated key works; SSH from any other LAN host is refused
  • From the VM, only the allowed LAN ports are reachable: nc -zv <docker host> 3000 and 5432 work, nc -zv <docker host> 22 and any other LAN host (e.g. TrueNAS) time out. Postgres has to stay reachable because it holds the Pulumi state; limit it further with a Postgres user that can only access the state database

Portfolio evidence

  • qm config output and the firewall rule set
  • Decision record in docs/decisions/: why a VM with act_runner + Docker job containers, and not
    • an LXC with Docker: needs nesting + keyctl; Proxmox itself recommends Docker in a VM; a kernel exploit from a job would land on the Proxmox host
    • host mode: no Docker, but jobs share leftovers and can read the runner's .runner credential; the security gain is small because deploy secrets are in the job environment either way
    • runner pods in k3s: circular dependency, since 01/02 build the cluster; Gitea has no mature per-job pod autoscaler like GitHub's ARC
    • Docker on the shared host: jobs could reach Gitea, Postgres and their data

Part of the security roadmap. Keep the evidence below for the write-up (README / blog post).

## Why The Gitea runner currently runs as the `gitea/runner:latest` container on the Docker host, next to Gitea, Postgres and all other services. A job that reaches the Docker socket effectively has root on that host. Build and deploy jobs should run on a dedicated machine with its own blast radius. The runner stays **outside the k3s cluster** on purpose: `01` and `02` create and repair the cluster, so the runner can't depend on it. This is the homelab version of an enterprise management plane; recovery when everything is down is `pulumi up` from the workstation. **Enterprise practice:** isolated build agents with their own kernel, separated from production workloads, provisioned as code. ## Design - A **VM**, not an LXC. Jobs run in Docker, and Docker in an unprivileged LXC needs `nesting` + `keyctl`, which widens the shared-kernel attack surface towards the Proxmox host. The runner holds the most powerful credentials (Proxmox, pfSense, Pulumi), so it gets its own kernel - act_runner runs as a systemd service on the VM (installed with Ansible, see kasun/homelab-ansible#18) - Jobs run in **Docker containers**, one fresh container per job, thrown away afterwards. Jobs don't get the Docker socket (`container.docker_host: "-"`), and `capacity: 1` ## Steps - [x] Define the VM in `01-proxmox-infra`: full clone of the Ubuntu Noble template on pve-b550, 2 vCPU, 4 GB RAM, 20 GB disk, fixed MAC with a pfSense DHCP reservation, SSH key login only (no password). The Ansible node gets a **dedicated key used only for this VM** (`runnerAnsibleSshPublicKey`), so its access can be revoked on its own - [x] Set `proxmox-infra:runnerIp` in the private config repo and push it before the PR - [ ] Proxmox firewall on the VM: inbound SSH only from the Ansible node and the Proxmox hosts (whoever can SSH in can read the CI credentials during the next deploy); outbound only DNS (pfSense), Gitea and the Pulumi state Postgres on the Docker host (ports 3000/5432 only), the Proxmox API (pve1 to pve3), the pfSense API, SSH to the k3s nodes (02) and the k3s API via the control-plane VIP. Drop and log the rest of the private ranges. The internet stays open for registries, npm and NTP: the Proxmox firewall filters by IP, so a domain allowlist would need an egress proxy (follow-up). The datacenter firewall on pve-b550 is enabled with ACCEPT policies so the VM rules apply - [ ] Enable Proxmox backups for the VM - [ ] Export the IP as a stack output and add the host to the Ansible inventory ## Tools Pulumi (Proxmox provider), Proxmox VE firewall. ## Done when - `pulumi up` creates the VM and it gets its reserved IP - SSH from the Ansible node with its dedicated key works; SSH from any other LAN host is refused - From the VM, only the allowed LAN ports are reachable: `nc -zv <docker host> 3000` and `5432` work, `nc -zv <docker host> 22` and any other LAN host (e.g. TrueNAS) time out. Postgres has to stay reachable because it holds the Pulumi state; limit it further with a Postgres user that can only access the state database ## Portfolio evidence - [ ] `qm config` output and the firewall rule set - [ ] Decision record in `docs/decisions/`: why a VM with act_runner + Docker job containers, and not - **an LXC with Docker**: needs `nesting` + `keyctl`; Proxmox itself recommends Docker in a VM; a kernel exploit from a job would land on the Proxmox host - **host mode**: no Docker, but jobs share leftovers and can read the runner's `.runner` credential; the security gain is small because deploy secrets are in the job environment either way - **runner pods in k3s**: circular dependency, since `01`/`02` build the cluster; Gitea has no mature per-job pod autoscaler like GitHub's ARC - **Docker on the shared host**: jobs could reach Gitea, Postgres and their data --- _Part of the security roadmap. Keep the evidence below for the write-up (README / blog post)._
claude-bot Bot added this to the Security Roadmap 1: Secure container supply chain milestone 2026-12-03 04:39:32 +01:00
claude-bot Bot added the Kind/Security
Priority
High
2
security-roadmap
labels 2026-12-03 04:39:32 +01:00
claude-bot Bot added this to the Security Roadmap project 2026-12-03 04:39:38 +01:00
claude-bot Bot changed title from Roadmap 1.1: Provision an unprivileged LXC for the CI runner to Roadmap 1.1: Provision a VM for the CI runner 2026-12-04 18:25:44 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kasun/homelab-infrastructure-as-code#82