SV-268094r1130990_rule
V-268094
SRG-OS-000042-GPOS-00020
ANIX-00-000270
CAT II
10
Configure NixOS to generate audit records for any successful/unsuccessful use of the "mount" syscall.
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=b32 -S mount -F auid>=1000 -F auid!=unset -k privileged-mount"
"-a always,exit -F arch=b64 -S mount -F auid>=1000 -F auid!=unset -k privileged-mount"
];
Rebuild and switch to the new NixOS configuration:
$ sudo nixos-rebuild switch
Verify NixOS generates an audit record for any successful/unsuccessful use of the "mount" syscall with the following command:
$ sudo auditctl -l | grep -w "\-S mount"
-a always,exit -F arch=b32 -S mount -F auid>=1000 -F auid!=-1 -k privileged-mount
-a always,exit -F arch=b64 -S mount -F auid>=1000 -F auid!=-1 -k privileged-mount
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-268094
False
ANIX-00-000270
Verify NixOS generates an audit record for any successful/unsuccessful use of the "mount" syscall with the following command:
$ sudo auditctl -l | grep -w "\-S mount"
-a always,exit -F arch=b32 -S mount -F auid>=1000 -F auid!=-1 -k privileged-mount
-a always,exit -F arch=b64 -S mount -F auid>=1000 -F auid!=-1 -k privileged-mount
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