Files
r-vdp 1ac3c5dc99 nixos/shadow: use file capabilities for newuidmap/newgidmap
Writing a multi-line /proc/<pid>/[ug]id_map only requires
CAP_SETUID/CAP_SETGID over the parent user namespace, not full root.
shadow's own --with-fcaps install mode (70971457b761) sets exactly
cap_setuid+ep / cap_setgid+ep, and Arch, Fedora and Debian have shipped
these binaries with file capabilities instead of setuid for years.

The setuid variant already drops to the same single capability before
the uid_map write (see lib/idmapping.c), so the privilege at the point
attacker-controlled data reaches the kernel is unchanged. The reduction
is in the startup window: with file capabilities the process never has
euid 0 and never holds the full capability set during NSS lookups,
/etc/subuid parsing and /proc/<pid> opening.

The only functional difference is that mapping host uid 0 into a child
namespace additionally needs CAP_SETFCAP, which the setuid path got
implicitly. NixOS never puts uid 0 into auto-allocated subuid ranges,
and granting it manually is a deliberate root-equivalent configuration;
the release notes document the override for that case.

nixosTests.{shadow,podman,docker-rootless} pass; the latter two
exercise newuidmap/newgidmap via rootless containers.

Supersedes #461172.

Co-authored-by: Rasheeq Azad <rasheeqhere@gmail.com>
2026-06-01 00:18:28 +03:00
..
2025-12-02 16:34:27 +01:00
2024-07-22 07:47:00 +08:00
2024-12-19 10:06:55 +01:00
2025-12-09 21:05:56 +01:00
2026-05-01 20:39:14 -04:00
2025-07-24 13:55:40 +02:00
2025-05-23 13:02:18 -06:00
2025-03-31 16:25:04 +03:30
2025-10-22 00:13:25 +02:00
2025-07-24 13:55:40 +02:00
2025-02-18 09:53:01 +01:00
2025-04-01 20:10:43 +02:00
2025-10-18 12:01:19 +03:00
2025-09-22 02:46:54 +02:00
2026-04-13 14:22:11 +02:00
2026-05-25 23:45:07 +02:00
2024-08-09 23:31:24 +08:00
2025-02-18 15:02:34 +01:00
2025-02-26 22:24:17 +01:00
2025-07-15 20:41:31 +02:00
2025-04-01 20:10:43 +02:00
2026-01-22 18:37:56 -03:00
2025-10-29 20:50:20 +01:00
2025-07-24 13:55:40 +02:00
2026-01-22 00:00:18 +01:00
2025-10-10 01:56:08 +02:00
2025-08-20 17:54:38 +02:00
2024-09-18 23:20:57 +02:00
2025-04-19 19:45:05 +02:00
2025-07-24 13:55:40 +02:00
2024-05-22 14:55:16 +09:00
2026-03-27 19:31:06 +01:00
2025-06-02 16:07:07 +02:00
2025-06-02 02:48:30 +02:00
2026-03-31 18:33:50 +08:00
2025-10-05 10:50:41 +02:00
2025-12-11 23:54:41 +01:00
2025-04-01 20:10:43 +02:00
2025-08-08 10:09:50 +02:00
2025-03-26 22:08:23 +02:00