Skip to content

Commit

Permalink
Merge pull request #18365 from NixOS/fix-sshd-failure
Browse files Browse the repository at this point in the history
Make /var/empty immutable (with chattr +i)
  • Loading branch information
edolstra authored Sep 7, 2016
2 parents 4a265a6 + 8f95e6f commit 70be99c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions nixos/modules/system/activation/activation-script.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 70be99c

Please sign in to comment.