git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #79674 from Infinisil/sudoers-extraRules

nixos/sudo: Fix extraRules example rendering

commit8d77e3537bf05d5a7cfefce0031914a473ac72b4 authorworldofpeace <worldofpeace@protonmail.ch> dateSun 9 Feb 2020, 20:05 (7 years ago) parent637bb9fcb1f1b4
1 file changed+19−17
nixos/modules/security/sudo.nix+19−17
nixos/modules/security/sudo.nix+19−17
@@ -71,23 +71,25 @@ in
7171 this is the case when configuration options are merged.
7272 '';
7373 default = [];
74− example = [
75− # Allow execution of any command by all users in group sudo,
76− # requiring a password.
77− { groups = [ "sudo" ]; commands = [ "ALL" ]; }
78−
79− # Allow execution of "/home/root/secret.sh" by user `backup`, `database`
80− # and the group with GID `1006` without a password.
81− { users = [ "backup" "database" ]; groups = [ 1006 ];
82− commands = [ { command = "/home/root/secret.sh"; options = [ "SETENV" "NOPASSWD" ]; } ]; }
83−
84− # Allow all users of group `bar` to run two executables as user `foo`
85− # with arguments being pre-set.
86− { groups = [ "bar" ]; runAs = "foo";
87− commands =
88− [ "/home/baz/cmd1.sh hello-sudo"
89− { command = ''/home/baz/cmd2.sh ""''; options = [ "SETENV" ]; } ]; }
90− ];
74+ example = literalExample ''
75+ [
76+ # Allow execution of any command by all users in group sudo,
77+ # requiring a password.
78+ { groups = [ "sudo" ]; commands = [ "ALL" ]; }
79+
80+ # Allow execution of "/home/root/secret.sh" by user `backup`, `database`
81+ # and the group with GID `1006` without a password.
82+ { users = [ "backup" "database" ]; groups = [ 1006 ];
83+ commands = [ { command = "/home/root/secret.sh"; options = [ "SETENV" "NOPASSWD" ]; } ]; }
84+
85+ # Allow all users of group `bar` to run two executables as user `foo`
86+ # with arguments being pre-set.
87+ { groups = [ "bar" ]; runAs = "foo";
88+ commands =
89+ [ "/home/baz/cmd1.sh hello-sudo"
90+ { command = '''/home/baz/cmd2.sh ""'''; options = [ "SETENV" ]; } ]; }
91+ ]
92+ '';
9193 type = with types; listOf (submodule {
9294 options = {
9395 users = mkOption {