git.iko.soy/typeable/nixpkgs
on master help sign in
Make /var/empty immutable

Fixes #14910 and #18358 Deployed to an existing server, restarted sshd and polkit to verify they don't fail.

commit3877ec5b2ff7436f4962ac0fe3200833cf78cb8b authorDomen Kožar <domen@dev.si> dateTue 6 Sep 2016, 17:14 (10 years ago) parent9ab141c
1 file changed+13−5
nixos/modules/system/activation/activation-script.nix+13−5
nixos/modules/system/activation/activation-script.nix+13−5
@@ -12,11 +12,14 @@ 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
22+ e2fsprogs # needed for chattr
2023 ];
2124
2225in
@@ -137,8 +140,13 @@ in
137140
138141 mkdir -m 1777 -p /var/tmp
139142
143+ # Make sure it's really empty
144+ chattr -i /var/empty
145+ rm -rf /var/empty
146+
140147 # Empty, read-only home directory of many system accounts.
141148 mkdir -m 0555 -p /var/empty
149+ chattr +i /var/empty
142150 '';
143151
144152 system.activationScripts.usrbinenv = if config.environment.usrbinenv != null