SV-268091r1130983_rule
V-268091
SRG-OS-000042-GPOS-00020
ANIX-00-000210
CAT II
10
Configure NixOS to generate audit records for all execution of privileged functions.
Add the following Nix code to the NixOS Configuration, usually located in /etc/nixos/configuration.nix or /etc/nixos/flake.nix:
security.audit.rules = [
"-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k execpriv"
"-a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k execpriv"
"-a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k execpriv "
"-a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k execpriv "
];
Rebuild and switch to the new NixOS configuration:
$ sudo nixos-rebuild switch
Verify NixOS generates audit records for all execution of privileged functions with the following command:
$ sudo auditctl -l | grep execve
-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k execpriv
-a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k execpriv
-a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k execpriv
-a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k execpriv
If the command does not return the example output, this is a finding.
Note: The "-k" allows for specifying an arbitrary identifier. The string following "-k" does not need to match the example output above.
V-268091
False
ANIX-00-000210
Verify NixOS generates audit records for all execution of privileged functions with the following command:
$ sudo auditctl -l | grep execve
-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k execpriv
-a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k execpriv
-a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k execpriv
-a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k execpriv
If the command does not return the example output, this is a finding.
Note: The "-k" allows for specifying an arbitrary identifier. The string following "-k" does not need to match the example output above.
M
5658