Merge pull request #18365 from NixOS/fix-sshd-failure

Make /var/empty immutable (with chattr +i)
This commit is contained in:
Eelco Dolstra 2016-09-07 11:18:49 +02:00 committed by GitHub
commit 70be99c645

View File

@ -12,11 +12,13 @@ let
'';
});
path = map getBin
[ pkgs.coreutils pkgs.gnugrep pkgs.findutils
pkgs.glibc # needed for getent
pkgs.shadow
pkgs.nettools # needed for hostname
path = with pkgs; map getBin
[ coreutils
gnugrep
findutils
glibc # needed for getent
shadow
nettools # needed for hostname
];
in
@ -137,8 +139,13 @@ in
mkdir -m 1777 -p /var/tmp
# Empty, read-only home directory of many system accounts.
mkdir -m 0555 -p /var/empty
# Empty, immutable home directory of many system accounts.
mkdir -p /var/empty
# Make sure it's really empty
${pkgs.e2fsprogs}/bin/chattr -i /var/empty
find /var/empty -mindepth 1 -delete
chmod 0555 /var/empty
${pkgs.e2fsprogs}/bin/chattr +i /var/empty
'';
system.activationScripts.usrbinenv = if config.environment.usrbinenv != null