Why
You want to know when files/folders change on your server. Unauthorized changes could indicate a security breach or compromise. AIDE (Advanced Intrusion Detection Environment) monitors file system changes and alerts you to modifications.How It Works
AIDE creates a database of file checksums, permissions, and attributes. It then periodically scans the system and compares against this database to detect any changes. When differences are found, it reports what has been added, removed, or modified.Goals
- AIDE installed and configured to monitor critical system files and folders
- Daily automated scans with email alerts for any detected changes
Notes
- After you make legitimate changes to monitored files/folders, you’ll need to update the AIDE database
- The initial database creation can take some time depending on what you’re monitoring
- You’ll want to customize which files/folders AIDE monitors based on your needs
References
- https://aide.github.io/
- https://www.cyberciti.biz/faq/debian-ubuntu-linux-software-integrity-checking-with-aide/
- https://kifarunix.com/how-to-install-and-configure-aide-on-debian-10-buster/
- https://wiki.archlinux.org/index.php/AIDE
man aide
Installation and Setup
Configure AIDE
Make a backup of AIDE’s configuration file The default configuration file
/etc/aide/aide.conf:/etc/aide/aide.conf is well commented and you should take a look at it and customize based on your requirements. The default settings monitor many important system directories.Pay special attention to the paths that AIDE monitors. Add or remove paths based on your specific needs and server configuration.
Configure automatic execution
Configure AIDE to run daily by modifying Set these options in
/etc/default/aide:/etc/default/aide:| Setting | Value | Description |
|---|---|---|
CRON_DAILY_RUN | yes | Enable daily cron job |
MAILTO | root | Send reports to root |
QUIETREPORTS | no | Include full reports in emails |
Initialize the AIDE database
Create the initial AIDE database:This will scan your system and create the database. It may take several minutes.
On Debian systems,
aideinit creates the database at /var/lib/aide/aide.db.new. After confirming it’s correct, it moves it to /var/lib/aide/aide.db.Updating The Database
Every time you make legitimate changes to files/folders that AIDE monitors, you’ll need to update the database to capture those changes:Daily Automated Scans
If you setCRON_DAILY_RUN to yes in /etc/default/aide, then cron will execute /etc/cron.daily/aide every day and email you the output with any detected changes.