git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #18365 from NixOS/fix-sshd-failure

Make /var/empty immutable (with chattr +i)

commit70be99c6459b236bf4cc12eb11182f9a72438085 authorEelco Dolstra <eelco.dolstra@logicblox.com> dateWed 7 Sep 2016, 11:18 (10 years ago) parent4a265a68f95e6f
1 file changed+14−7
nixos/modules/system/activation/activation-script.nix+14−7
nixos/modules/system/activation/activation-script.nix+14−7
@@ -12,11 +12,13 @@ let
1212 '';
1313 });
1414
15− path = map getBin
16− [ pkgs.coreutils pkgs.gnugrep pkgs.findutils
17− pkgs.glibc # needed for getent
18− pkgs.shadow
19− pkgs.nettools # needed for hostname
15+ path = with pkgs; map getBin
16+ [ coreutils
17+ gnugrep
18+ findutils
19+ glibc # needed for getent
20+ shadow
21+ nettools # needed for hostname
2022 ];
2123
2224in
@@ -137,8 +139,13 @@ in
137139
138140 mkdir -m 1777 -p /var/tmp
139141
140− # Empty, read-only home directory of many system accounts.
141− mkdir -m 0555 -p /var/empty
142+ # Empty, immutable home directory of many system accounts.
143+ mkdir -p /var/empty
144+ # Make sure it's really empty
145+ ${pkgs.e2fsprogs}/bin/chattr -i /var/empty
146+ find /var/empty -mindepth 1 -delete
147+ chmod 0555 /var/empty
148+ ${pkgs.e2fsprogs}/bin/chattr +i /var/empty
142149 '';
143150
144151 system.activationScripts.usrbinenv = if config.environment.usrbinenv != null