SV-268167r1131139_rule
V-268167
SRG-OS-000476-GPOS-00221
ANIX-00-001820
CAT II
10
Configure NixOS to generate audit logs on account creations and modifications.
Add the following Nix code to the NixOS Configuration, usually located in /etc/nixos/configuration.nix or /etc/nixos/flake.nix:
security.audit.rules = [
"-w /etc/sudoers -p wa -k identity"
"-w /etc/passwd -p wa -k identity"
"-w /etc/shadow -p wa -k identity"
"-w /etc/gshadow -p wa -k identity"
"-w /etc/group -p wa -k identity"
"-w /etc/security/opasswd -p wa -k identity"
];
Rebuild and switch to the new NixOS configuration:
$ sudo nixos-rebuild switch
Verify NixOS is configured to generate audit records on account events with the following command:
$ sudo auditctl -l | grep /etc
-w /etc/sudoers -p wa -k identity
-w /etc/passwd -p wa -k identity
-w /etc/shadow -p wa -k identity
-w /etc/gshadow -p wa -k identity
-w /etc/group -p wa -k identity
-w /etc/security/opasswd -p wa -k identity
If the output from the command does not include the example output, this is a finding.
V-268167
False
ANIX-00-001820
Verify NixOS is configured to generate audit records on account events with the following command:
$ sudo auditctl -l | grep /etc
-w /etc/sudoers -p wa -k identity
-w /etc/passwd -p wa -k identity
-w /etc/shadow -p wa -k identity
-w /etc/gshadow -p wa -k identity
-w /etc/group -p wa -k identity
-w /etc/security/opasswd -p wa -k identity
If the output from the command does not include the example output, this is a finding.
M
5658