git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/sudo: default rule should be first

In /etc/sudoers, the last-matched rule will override all previously-matched rules. Thus, make the default rule show up first (but still allow some wiggle room for a user to `mkBefore` it), before any user-defined rules.

commit13e2c75c932adac6a198e35b04e2cb9a1eaf86cf authorCole Helbling <cole.e.helbling@outlook.com> dateSun 10 May 2020, 21:49 (7 years ago) parent02ff18c
1 file changed+3−1
nixos/modules/security/sudo.nix+3−1
nixos/modules/security/sudo.nix+3−1
@@ -173,7 +173,9 @@ in
173173
174174 config = mkIf cfg.enable {
175175
176− security.sudo.extraRules = [
176+ # We `mkOrder 600` so that the default rule shows up first, but there is
177+ # still enough room for a user to `mkBefore` it.
178+ security.sudo.extraRules = mkOrder 600 [
177179 { groups = [ "wheel" ];
178180 commands = [ { command = "ALL"; options = (if cfg.wheelNeedsPassword then [ "SETENV" ] else [ "NOPASSWD" "SETENV" ]); } ];
179181 }