Merge master into staging-next
This commit is contained in:
@@ -61,6 +61,17 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
security.sudo.execWheelOnly = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Only allow members of the <code>wheel</code> group to execute sudo by
|
||||
setting the executable's permissions accordingly.
|
||||
This prevents users that are not members of <code>wheel</code> from
|
||||
exploiting vulnerabilities in sudo such as CVE-2021-3156.
|
||||
'';
|
||||
};
|
||||
|
||||
security.sudo.configFile = mkOption {
|
||||
type = types.lines;
|
||||
# Note: if syntax errors are detected in this file, the NixOS
|
||||
@@ -216,9 +227,20 @@ in
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
|
||||
security.wrappers = {
|
||||
sudo.source = "${cfg.package.out}/bin/sudo";
|
||||
sudoedit.source = "${cfg.package.out}/bin/sudoedit";
|
||||
security.wrappers = let
|
||||
owner = "root";
|
||||
group = if cfg.execWheelOnly then "wheel" else "root";
|
||||
setuid = true;
|
||||
permissions = if cfg.execWheelOnly then "u+rx,g+x" else "u+rx,g+x,o+x";
|
||||
in {
|
||||
sudo = {
|
||||
source = "${cfg.package.out}/bin/sudo";
|
||||
inherit owner group setuid permissions;
|
||||
};
|
||||
sudoedit = {
|
||||
source = "${cfg.package.out}/bin/sudoedit";
|
||||
inherit owner group setuid permissions;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [ sudo ];
|
||||
|
||||
Reference in New Issue
Block a user