mirror of
https://github.com/elitak/nixos-infect
synced 2025-03-14 13:46:59 +00:00
fix: enable unprivileged user namespaces for successful group resolution
Added `sysctl kernel.unprivileged_userns_clone=1` to ensure proper group name resolution for higher GIDs during the infection process. This resolves issues where commands like `id` fail in restricted environments lacking user namespace support.
This commit is contained in:
parent
5ef3f953d3
commit
f6e5478657
1 changed files with 8 additions and 0 deletions
|
@ -317,7 +317,15 @@ checkEnv() {
|
|||
|
||||
infect() {
|
||||
# Add nix build users
|
||||
|
||||
# Ensure kernel.unprivileged_userns_clone is enabled to prevent issues where
|
||||
# certain commands (e.g., `id`) fail to resolve group names for higher GIDs.
|
||||
# This setting is particularly important for environments where user namespaces
|
||||
# are restricted, which can lead to failures during the infection process.
|
||||
sysctl kernel.unprivileged_userns_clone=1
|
||||
|
||||
# FIXME run only if necessary, rather than defaulting true
|
||||
|
||||
groupadd nixbld -g 30000 || true
|
||||
for i in {1..10}; do
|
||||
useradd -c "Nix build user $i" -d /var/empty -g nixbld -G nixbld -M -N -r -s "$(which nologin)" "nixbld$i" || true
|
||||
|
|
Loading…
Add table
Reference in a new issue