Skip to content

Commit 05d0df8

Browse files
committed
fix(podman): retain workload signal capability
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent c8967ac commit 05d0df8

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎.agents/skills/debug-openshell-cluster/SKILL.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ When `userns` is configured (e.g. `userns = "auto"` or `userns = "keep-id"`):
262262
rootful Podman uses absolute host IDs (e.g. `uidmap = ["0:1000:1", "1:100000:65536"]`).
263263
- `nomap` (without hyphen) is accepted as input but canonicalized to `no-map`
264264
for Podman's API.
265+
- A workload remains in `stopping` until Podman resorts to `SIGKILL`: inspect
266+
supervisor logs for `failed to signal entrypoint process group`. The
267+
supervisor must retain `CAP_KILL` so its root process can forward `SIGTERM`
268+
to a workload that runs as the sandbox user.
265269

266270
### Step 6: Check Kubernetes Helm Gateways
267271

‎crates/openshell-driver-podman/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ The container spec in `container.rs` sets these security-critical fields:
8181
|---|---|---|
8282
| `user` | `0:0` | The supervisor needs root inside the container for namespace creation, proxy setup, Landlock, seccomp, and filesystem preparation. |
8383
| `cap_drop` | Selected unneeded defaults | Podman's default capability set is already restricted. The driver drops capabilities the supervisor does not need. |
84-
| `cap_add` | `SYS_ADMIN`, `NET_ADMIN`, `SYS_PTRACE`, `SYSLOG`, `DAC_READ_SEARCH`, `SETPCAP` | Grants supervisor-only capabilities required for namespace setup, process identity, bypass diagnostics, and child bounding-set cleanup. Policy DNS binds an unprivileged supervisor port and does not require `NET_BIND_SERVICE`. |
84+
| `cap_add` | `SYS_ADMIN`, `NET_ADMIN`, `SYS_PTRACE`, `SYSLOG`, `DAC_READ_SEARCH`, `SETPCAP`, `KILL` | Grants supervisor-only capabilities required for namespace setup, process identity, bypass diagnostics, child bounding-set cleanup, and forwarding shutdown signals to a workload that runs as the sandbox user. Policy DNS binds an unprivileged supervisor port and does not require `NET_BIND_SERVICE`. |
8585
| `no_new_privileges` | `true` | Prevents privilege escalation after exec. |
8686
| `seccomp_profile_path` | `unconfined` | The supervisor installs its own policy-aware BPF filter. A container-level profile can block Landlock/seccomp syscalls during setup. |
8787
| `mounts` | Private tmpfs at `/run/netns` | Lets the supervisor create named network namespaces in rootless Podman. |

‎crates/openshell-driver-podman/src/container.rs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,8 +1114,6 @@ pub fn build_container_spec_for_image(
11141114
"DAC_OVERRIDE".into(),
11151115
// Not needed: the supervisor does not create setuid/setgid executables.
11161116
"FSETID".into(),
1117-
// Not needed: the supervisor does not send signals to arbitrary processes.
1118-
"KILL".into(),
11191117
// Not needed: the supervisor does not bind privileged ports (<1024).
11201118
"NET_BIND_SERVICE".into(),
11211119
// Not in Podman's default set but explicitly denied in case the image
@@ -1146,6 +1144,9 @@ pub fn build_container_spec_for_image(
11461144
// Child setup clears the capability bounding set before exec, which
11471145
// requires CAP_SETPCAP in the supervisor until drop_privileges().
11481146
"SETPCAP".into(),
1147+
// Forwarding shutdown signals to the canonical workload process
1148+
// group after it drops to the sandbox UID requires CAP_KILL.
1149+
"KILL".into(),
11491150
],
11501151
// SETUID, SETGID, SETPCAP, CHOWN, and FOWNER are intentionally kept from
11511152
// Podman's default set and not dropped:
@@ -1885,6 +1886,7 @@ mod tests {
18851886
"missing DAC_READ_SEARCH"
18861887
);
18871888
assert!(added.contains(&"SETPCAP"), "missing SETPCAP");
1889+
assert!(added.contains(&"KILL"), "missing KILL");
18881890

18891891
// SETUID and SETGID are NOT in cap_add — they remain available from the
18901892
// default bounding set because we no longer use cap_drop:ALL. Verify they
@@ -1916,6 +1918,10 @@ mod tests {
19161918
!dropped.contains(&"SETPCAP"),
19171919
"SETPCAP must not be dropped (needed for child bounding-set clear)"
19181920
);
1921+
assert!(
1922+
!dropped.contains(&"KILL"),
1923+
"KILL must not be dropped (needed to signal the sandbox workload on shutdown)"
1924+
);
19191925
assert!(
19201926
!dropped.contains(&"ALL"),
19211927
"must not use cap_drop:ALL in rootless Podman"

0 commit comments

Comments
 (0)