Skip to content

Sudo rs

security.sudo-rs.configFile

This string contains the contents of the {file}sudoers file.

Type: strings concatenated with "\n"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.defaultOptions

Options used for the default rules, granting root and the wheel group permission to run any command as any user.

Type: list of string

Default

[ ]

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.enable

Whether to enable a memory-safe implementation of the {command}sudo command, which allows non-root users to execute commands as root . Type: boolean

Default

false

Example

true

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.execWheelOnly

Only allow members of the wheel group to execute sudo by setting the executable's permissions accordingly. This prevents users that are not members of wheel from exploiting vulnerabilities in sudo such as CVE-2021-3156.

Type: boolean

Default

false

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.extraConfig

Extra configuration text appended to {file}sudoers.

Type: strings concatenated with "\n"

Default

""

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.extraRules

Define specific rules to be in the {file}sudoers file. More specific rules should come after more general ones in order to yield the expected behavior. You can use mkBefore/mkAfter to ensure this is the case when configuration options are merged.

Type: list of (submodule)

Default

[ ]

Example

`#!nix [ # Allow execution of any command by all users in group sudo, # requiring a password.

# Allow execution of "/home/root/secret.sh" by user backup, database # and the group with GID 1006 without a password. { users = [ "backup" "database" ]; groups = [ 1006 ]; commands = [ { command = "/home/root/secret.sh"; options = [ "SETENV" "NOPASSWD" ]; } ]; }

# Allow all users of group bar to run two executables as user foo # with arguments being pre-set. { groups = [ "bar" ]; runAs = "foo"; commands = [ "/home/baz/cmd1.sh hello-sudo" { command = ''/home/baz/cmd2.sh ""''; options = [ "SETENV" ]; } ]; } ] `

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.extraRules.*.commands

The commands for which the rule should apply.

Type: list of (string or (submodule))

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.extraRules.*.groups

The groups / GIDs this rule should apply for.

Type: list of (string or signed integer)

Default

[ ]

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.extraRules.*.host

For what host this rule should apply.

Type: string

Default

"ALL"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.extraRules.*.runAs

Under which user/group the specified command is allowed to run.

A user can be specified using just the username: "foo". It is also possible to specify a user/group combination using "foo:bar" or to only allow running as a specific group with ":bar".

Type: string

Default

"ALL:ALL"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.extraRules.*.users

The usernames / UIDs this rule should apply for.

Type: list of (string or signed integer)

Default

[ ]

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.package

The sudo-rs package to use. Type: package

Default

pkgs.sudo-rs

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix

security.sudo-rs.wheelNeedsPassword

Whether users of the wheel group must provide a password to run commands as super user via {command}sudo.

Type: boolean

Default

true

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/security/sudo-rs.nix