Skip to content

Commit

Permalink
nixos/wrappers: use normal mount for /run/wrappers
Browse files Browse the repository at this point in the history
We want to get rid of specialFileSystems / earlyMountScript eventually and
there is no need to run this before systemd anymore now that
the wrappers themselves are set up in a systemd unit since NixOS#263203

Also this is needed to make soft-reboot work. We want to make sure
that we remount /run/wrappers with the nosuid bit removed on soft-reboot
but because @earlyMountScript@ happens in initrd, this wouldn't happen
  • Loading branch information
arianvp authored and nikstur committed Jul 20, 2024
1 parent e7279da commit 8afba66
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions nixos/modules/security/wrappers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,6 @@ in
umount = mkSetuidRoot "${lib.getBin pkgs.util-linux}/bin/umount";
};

boot.specialFileSystems.${parentWrapperDir} = {
fsType = "tmpfs";
options = [ "nodev" "mode=755" "size=${config.security.wrapperDirSize}" ];
};

# Make sure our wrapperDir exports to the PATH env variable when
# initializing the shell
environment.extraInit = ''
Expand All @@ -275,6 +270,17 @@ in
mrpx ${wrap.source},
'') wrappers;

systemd.mounts = [{
where = parentWrapperDir;
what = "tmpfs";
type = "tmpfs";
options = lib.concatStringsSep "," ([
"nodev"
"mode=755"
"size=${config.security.wrapperDirSize}"
]);
}];

systemd.services.suid-sgid-wrappers = {
description = "Create SUID/SGID Wrappers";
wantedBy = [ "sysinit.target" ];
Expand Down

0 comments on commit 8afba66

Please sign in to comment.