Pcornel
Linux · Security

Auditd

Cheat sheet · https://pcornel.dk/topic.php?topic=2852

Back to the Topic

Answer

auditd records security-relevant events from the kernel audit system: logins, privilege use, file access watched by rules, and SELinux denials, in /var/log/audit/audit.log.

Remember

Add rules in /etc/audit/rules.d/*.rules and load with augenrules --load. Search with ausearch, summarise with aureport. Forward audit logs off the host. Too many rules cost performance.

First checks

  • auditctl -l — loaded audit rules
  • sestatus / aa-status — SELinux or AppArmor state
  • ss -tulpn — listening services
  • journalctl -u sshd -g 'Failed' — failed logins
  • ausearch -m avc,user_login -ts today — audit events (auditd)

Commands

sudo

Verify in this order

event in the kernel → audit rule matches → record written by auditd → searched and forwarded

Where it usually breaks

First mismatch in identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2852

Confirmation

Confirm action

Continue?