Interview Prep/Linux/User Lifecycle, Auditing & Time Sync

Write auditd rules to watch sensitive files and privileged commands.

IntermediateProductionUser Lifecycle, Auditing & Time Sync
Answer
# /etc/audit/rules.d/50-custom.rules
-w /etc/passwd -p wa -k identity
-w /etc/shadow -p wa -k identity
-w /etc/sudoers -p wa -k sudoers
-w /etc/sudoers.d/ -p wa -k sudoers
-w /etc/ssh/sshd_config -p wa -k sshd
-a always,exit -F arch=b64 -S execve -F euid=0 -F auid>=1000 -F auid!=4294967295 -k root_cmds
-e 2
sudo augenrules --load

-p wa = write and attribute changes; -k tags events for searching; -e 2 makes rules immutable until reboot.

All Linux questions Roadmap: Linux

More on User Lifecycle, Auditing & Time Sync