ci(runners): isolate the CI capsule in forgejo-runners, enforce baseline on forgejo #72
Loading…
Reference in a new issue
No description provided.
Delete branch "wt/t_2bbe34a8"
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?
What and why
Finding F6 (cluster netsec audit): every Forgejo runner ran a
privileged: truedind sidecar with the runner container as uid 0, and no namespace in the cluster enforced Pod Security, so the next privileged pod would also be accepted silently.A container runtime cannot run unprivileged in a pod on these nodes (measured three ways — cgroup fs mounted read-only, rootless dind cannot mount procfs,
procMount: UnmaskedneedshostUsers: falsewhere subuid maps and/dev/net/tunare refused; seedocs/pod-security.md). PSA has no per-workload exemption, so the only way to make any namespace enforce is to put the CI capsule somewhere that is allowed to be privileged.This PR does exactly that:
forgejo-runnerswithenforce: privileged+warn/audit: restricted— contains the three runner Deployments, their PVCs,forgejo-runner-config, the two registration-token Secrets, and the prune SA/Role/RoleBinding/ConfigMap/CronJob;forgejonow enforcesbaseline(+ warn/audit restricted). Forgejo, the CNPG Postgres cluster and the cluster-backup CronJob all pass baseline (verified by server-side dry-run before flipping);cnpg_actions_*panels keepnamespace="forgejo"— that label is the Postgres namespace);docs/pod-security.mdrewritten for the two enforced namespaces; stale runner rows indocs/cluster-overview.mdand the commands indocs/arm64-runner-dind.mdupdated.No privileged flag, hostPath or image was added anywhere; job containers stay unprivileged (
container.privileged: false).Storage was rebound, not recreated
runner.ini(the registration uuid) and the dind data-roots live on the PVCs. The two staticlocal-staticPVs on rpi and the dynamic local-path PV on siriussec were kept and rebound to the new claims by name:claimRef, re-created the PVCs with the samevolumeName;reclaimPolicy: Retainfor the move, deleted/recreated the claim, then restoredDelete.Proof after the move: all three
runner.iniuuids unchanged (91124ee3…,4e07c1e9…,a41aad73…), dind image counts identical (19 / 2 / 31), canary files written before the move still present, all three runners2/2 Runningand polling Forgejo within seconds.Acceptance
kubectl -n forgejo get pods -o jsonpath='{..securityContext.privileged}'→false false(notrue).0660 root:1000viadockerd --group 1000.kubectl get ns forgejo -o jsonpath='{.metadata.labels}'includespod-security.kubernetes.io/enforce: baseline; a privileged pod there is nowForbidden: violates PodSecurity "baseline:latest", while the same shape is admitted (with warnings) inforgejo-runners.t_2bbe34a8.warn/audit: restricted(cluster-owned ones out-of-band;flux-systemaudit label added now).