The audit system should collect information about usage of privileged commands for all users.
These are commands with suid or sgid bits on and they are specially risky in local block
device partitions not mounted with noexec and nosuid options. Therefore, these partitions
should be first identified by the following command:
findmnt -n -l -k -it $(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) | grep -Pv "noexec|nosuid"
For all partitions listed by the previous command, it is necessary to search for
setuid / setgid programs using the following command:
$ sudo find PARTITION -xdev -perm /6000 -type f 2>/dev/null
For each setuid / setgid program identified by the previous command, an audit rule must be
present in the appropriate place using the following line structure:
-a always,exit -F path=PROG_PATH -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged
If the auditd
daemon is configured to use the augenrules
program to read
audit rules during daemon startup, add the line to a file with suffix .rules
in the
/etc/audit/rules.d
directory, replacing the PROG_PATH part with the full path
of that setuid / setgid identified program.
If the auditd
daemon is configured to use the auditctl
utility instead, add
the line to the /etc/audit/audit.rules
file, also replacing the PROG_PATH part
with the full path of that setuid / setgid identified program.