SV-268099r1131000_rule
V-268099
SRG-OS-000042-GPOS-00020
ANIX-00-000360
CAT II
10
Configure NixOS to generate audit records for any attempts to use the "chown", "fchown", "fchownat", and "lchown" system calls.
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 lchown,fchown,chown,fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod"
"-a always,exit -F arch=b64 -S chown,fchown,lchown,fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod"
];
Rebuild and switch to the new NixOS configuration:
$ sudo nixos-rebuild switch
Verify NixOS generates an audit record upon attempts to use the "chown", "fchown", "fchownat", and "lchown" system calls.
Check the auditing rules currently loaded into the audit daemon with the following command:
$ sudo auditctl -l | grep chown
-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F auid>=1000 -F auid!=-1 -F key=perm_mod
-a always,exit -F arch=b64 -S chown,fchown,lchown,fchownat -F auid>=1000 -F auid!=-1 -F key=perm_mod
If the command does not return an audit rule for "chown", "fchown", "fchownat", and "lchown", 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-268099
False
ANIX-00-000360
Verify NixOS generates an audit record upon attempts to use the "chown", "fchown", "fchownat", and "lchown" system calls.
Check the auditing rules currently loaded into the audit daemon with the following command:
$ sudo auditctl -l | grep chown
-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F auid>=1000 -F auid!=-1 -F key=perm_mod
-a always,exit -F arch=b64 -S chown,fchown,lchown,fchownat -F auid>=1000 -F auid!=-1 -F key=perm_mod
If the command does not return an audit rule for "chown", "fchown", "fchownat", and "lchown", 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