SV-268152r1131105_rule
V-268152
SRG-OS-000362-GPOS-00149
ANIX-00-001450
CAT II
10
Configure NixOS to prevent unauthorized users from using nix.
Add the following Nix code to the NixOS Configuration, usually located in /etc/nixos/configuration.nix or /etc/nixos/flake.nix:
nix.settings.allowed-users = [ "root" "@wheel" ];
Note: Extra usergroups may be permitted by adding them with the format "@group" (e.g.: "@users").
Rebuild and switch to the new NixOS configuration:
$ sudo nixos-rebuild switch
Verify NixOS prevents unauthorized users from using nix with the following command:
$ grep -R allowed-users /etc/nixos/
/etc/nixos/configuration.nix:nix.settings.allowed-users = [ "root" "@wheel" ];
If any other groups or users are included in "nix.settings.allowed-users" other than "root" and "wheel", or the configuration setting does not exist, this is a finding.
V-268152
False
ANIX-00-001450
Verify NixOS prevents unauthorized users from using nix with the following command:
$ grep -R allowed-users /etc/nixos/
/etc/nixos/configuration.nix:nix.settings.allowed-users = [ "root" "@wheel" ];
If any other groups or users are included in "nix.settings.allowed-users" other than "root" and "wheel", or the configuration setting does not exist, this is a finding.
M
5658