Installing and Configuring auditd
You'll learn how to set up the auditd daemon, write audit rules, and configure real-time event processing for comprehensive system activity monitoring.
What is auditd Configuration?
Now that you understand the Linux Auditing Framework's purpose, it's time to actually deploy it. Installing auditd puts the daemon in place; configuring it means defining what to watch and how to respond. Think of it like installing security cameras (the daemon) and then programming which areas to monitor and where to send alerts (the rules and dispatcher).
Installing auditd
On most Linux distributions, installation is straightforward:
# Debian/Ubuntu
sudo apt-get install auditd audispd-plugins
# RHEL/CentOS
sudo yum install audit audit-libs
# Enable and start the service
sudo systemctl enable auditd
sudo systemctl start auditd
Understanding audit.rules Syntax
The /etc/audit/rules.d/audit.rules file defines what the system watches. Rules follow this pattern:
# Watch a file for writes
-w /etc/passwd -p wa -k passwd_changes
# Watch system calls by a specific user
-a always,exit -F arch=b64 -S open -F auid=1000 -k user_file_access
-w= watch a file/directory-p= permissions (r=read, w=write, x=execute, a=attribute)-k= key/tag for filtering logs-a= append rule with action and list-F= field filter (arch, syscall, user ID)
Configuring the Audit Dispatcher
The audit dispatcher (audispd) processes events in real-time, sending them to plugins for immediate action (SIEM forwarding, alerts, etc.). Configure in /etc/audisp/audispd.conf and /etc/audisp/plugins.d/:
# Enable syslog plugin
active = yes
direction = out
path = /sbin/audisp-syslog
Key Takeaway: auditd installation provides the monitoring engine, audit.rules define what to monitor with specific syntax for files and syscalls, and the audit dispatcher enables real-time event forwarding to security tools.