Commit e27b6eb
feat(builder): tighten sandbox + reap orphan transient units
Two improvements on top of the live-deploy fixes from earlier today:
1. Revert ProtectSystem=full → strict with an explicit ReadWritePaths
allowlist. Under `full`, /etc and /var were writable to a root
builder subprocess, which let a buildah/git CVE in a malicious repo
persist via /etc/cron.d, sudoers, systemd drop-ins, etc. Under
`strict`, the only writable paths are the per-build work dir,
/var/lib/containers (buildah image store), /run/containers,
/run/netavark, and /run/lock (netavark lock). /tmp and /var/tmp
stay ephemeral via PrivateTmp; /home and /root via ProtectHome.
Also adds a defense-in-depth set that doesn't require path
enumeration: NoNewPrivileges, RestrictSUIDSGID, LockPersonality,
RestrictRealtime, RestrictNamespaces, SystemCallArchitectures=native.
CapabilityBoundingSet and SystemCallFilter are deferred until the
ReadWritePaths set is confirmed stable in the field.
2. Add BuilderCtx::reap_orphan_units() called on coold startup.
systemd-run --pipe --wait tears the transient unit down on SIGTERM
(graceful coold stop), but SIGKILL / OOM / host crash leaves the
unit running under PID 1 until RuntimeMaxSec hits. The sweeper
enumerates coolify-build-*.service on startup, stops any that are
still active, and resets failed state so subsequent dispatches can
reuse names cleanly.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent b6db897 commit e27b6eb
2 files changed
Lines changed: 77 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
75 | 122 | | |
76 | 123 | | |
77 | 124 | | |
| |||
156 | 203 | | |
157 | 204 | | |
158 | 205 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
164 | 215 | | |
165 | | - | |
| 216 | + | |
166 | 217 | | |
167 | 218 | | |
168 | 219 | | |
169 | 220 | | |
170 | 221 | | |
171 | | - | |
| 222 | + | |
172 | 223 | | |
173 | 224 | | |
174 | 225 | | |
| 226 | + | |
| 227 | + | |
175 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
176 | 245 | | |
177 | 246 | | |
178 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
0 commit comments