Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Sep 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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