Files
nix-bitcoin/modules
Jonas Nick 34a18f92ee netns-isolation: fix netns-exec being executable by all normal users
The `netns-exec` wrapper was created with `group = ""`, which makes the
`security.wrappers` activation run `chown ${allowedUser}:`. GNU chown
resolves the trailing colon to the owner's login group, and because the
operator is defined with `isNormalUser = true`, that group is the shared
group `users`. Together with mode 550, this made the wrapper executable
by every normal user on the host instead of only by `allowedUser`.

The wrapper carries `cap_sys_admin=ep` and the NixOS security wrapper
performs no owner check, so any normal user could enter `nb-joinmarket`,
the only netns that `netns-exec` permits. This exposes joinmarketd's
unauthenticated control port on 127.0.0.1 inside that netns and allows
sending packets from the joinmarket netns address. This can only ever become a
problem if there's a second, normal user on the host.

Use mode 500 so that only `allowedUser` can execute the wrapper. Also
set the group to `root`, so that `users` doesn't silently become an
authorized group again if the mode is ever loosened.

The netns-isolation test asserted this property with
`runuser -u clightning -- netns-exec nb-bitcoind ip a`, which fails
regardless of the file mode, because `clightning` is a system user with
its own group and `nb-bitcoind` is not in netns-exec's allowlist.
Replace it with a check that a normal user is denied by the exec
permissions, and assert the reason for each failure instead of only the
exit status.
2026-08-09 19:40:39 +00:00
..
2024-11-27 21:35:46 +01:00
2024-07-18 20:57:00 +02:00
2024-07-20 22:41:18 +02:00
2024-07-18 20:57:00 +02:00
2026-05-11 08:15:49 +00:00
2026-05-11 08:14:22 +00:00
2025-06-02 10:46:55 +02:00
2023-10-31 13:44:04 +01:00
2024-11-27 18:48:24 +01:00
2024-07-18 20:57:00 +02:00
2024-07-18 20:57:00 +02:00
2024-07-18 20:57:00 +02:00