2 AM and the Challenge of Tracking Modified Files
A PagerDuty alert fires in the dead of night: an API cluster on Fedora Server has suddenly crashed. You SSH in to check journalctl, but the logs are completely clean. There are no signs of SSH brute-force attempts, and SELinux is still running in Enforcing mode. Yet your gut tells you something is off when the file size of /usr/bin/sudo differs by 48 bytes compared to another node in the cluster. Even worse, the attacker used touch -r to replicate the exact modification timestamp (mtime), completely bypassing standard time-based filters.
When you suspect a server has been breached, the most agonizing question is always: Which files did the attacker modify, add, or delete? Basic commands like ls or find are virtually useless at this stage. Fedora maintains a rapid release cycle, averaging a major release every six months. While this pace delivers cutting-edge features, it also demands that sysadmins closely monitor every filesystem change. That is precisely where AIDE proves its worth.
How AIDE Works Under the Hood
AIDE (Advanced Intrusion Detection Environment) is an open-source File Integrity Monitoring (FIM) tool. It operates much like Tripwire, but is lighter and simpler to integrate.
AIDE’s core concept centers on snapshot comparison. During initial setup, AIDE scans all specified directories and extracts metadata for every file: permissions, owner/group, size, inode number, link count, and most crucially, SHA-256 or SHA-512 cryptographic hashes. All of this data is compiled into a baseline database.
During subsequent periodic scans, AIDE compares the live filesystem against the baseline database. An attacker might modify /bin/login to plant a backdoor or inject authentication bypass rules into /etc/pam.d/system-auth. No matter how meticulously they spoof timestamps, the file’s hash inevitably changes—and AIDE will catch the discrepancy immediately.
Deploying and Configuring AIDE on Fedora Server
Step 1: Install AIDE via DNF
AIDE is available in Fedora’s official repositories. Open your terminal and run the installation command:
sudo dnf install -y aide
Once installed, verify the version to ensure the binary runs properly:
aide -v
Step 2: Fine-Tune /etc/aide.conf to Eliminate False Positives
The default configuration file resides at /etc/aide.conf. Leaving it at default settings will flood your inbox with hundreds of false alarms daily due to log rotation and system cache files.
Open the configuration file in a text editor:
sudo nano /etc/aide.conf
First, organize the attributes you want to inspect into distinct rulesets:
# Strict rule for system binaries and libraries
MY_STRICT = p+i+n+u+g+s+b+m+c+sha256
# Configuration file rule: monitors content, hashes, and permissions
MY_CONFIG = p+u+g+m+c+sha256
# Directory rule: monitors permissions and directory listings only
MY_DIR = p+i+n+u+g
Next, define the directories to monitor and exclude. Add the following lines to your configuration file:
# Monitor executables and shared libraries
/bin MY_STRICT
/sbin MY_STRICT
/usr/bin MY_STRICT
/usr/sbin MY_STRICT
/lib64 MY_STRICT
# Monitor system configurations and kernel files
/etc MY_CONFIG
/boot MY_STRICT
# EXCLUDE frequently changing paths (prefix with !)
!/etc/mtab
!/etc/adjtime
!/var/log
!/var/spool
!/var/tmp
!/tmp
!/var/cache
The exclamation mark ! tells AIDE to ignore paths with volatile contents, saving your server from unnecessary disk I/O overhead.
Step 3: Initialize the Baseline Database
The system needs a clean baseline snapshot while the server is still in a pristine state. Initialize the database using:
sudo aide --init
Scanning typically takes 1 to 3 minutes on an NVMe SSD for roughly 50,000 files. Once complete, AIDE generates a new file at /var/lib/aide/aide.db.new.gz. Rename it to put it into active service:
sudo mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
Restrict read permissions on the database file to prevent regular users from accessing it:
sudo chmod 0600 /var/lib/aide/aide.db.gz
Security note: If an attacker gains root access, they could overwrite this database. On critical production systems, consider shipping aide.db.gz off-site to a dedicated backup server or mounting the directory as read-only after scanning.
Step 4: Test Unauthorized Modification Detection
Simulate a compromise scenario where an intruder drops a backdoor script and modifies the SSH configuration.
# Create a simulated backdoor script in a binary directory
sudo touch /usr/local/bin/malicious_backdoor.sh
sudo chmod +x /usr/local/bin/malicious_backdoor.sh
# Append a suspicious configuration line to SSH config
echo "# Malicious edit test" | sudo tee -a /etc/ssh/sshd_config
Now, run a comprehensive integrity check:
sudo aide --check
Within seconds, AIDE outputs a detailed report in your terminal:
AIDE 0.18 found differences between database and filesystem!!
Summary:
Total number of entries: 48215
Added entries: 1
Removed entries: 0
Changed entries: 1
---------------------------------------------------
Added entries:
---------------------------------------------------
f+++++++++: /usr/local/bin/malicious_backdoor.sh
---------------------------------------------------
Changed entries:
---------------------------------------------------
f c : /etc/ssh/sshd_config
Detailed information about changes:
File: /etc/ssh/sshd_config
Size : 3645 , 3667
Mtime : 2026-11-20 10:15:22 , 2026-11-25 02:14:05
SHA256 : 8f4a1c... , e3b0c4...
Both the newly added script file and the size discrepancy in sshd_config are clearly flagged.
Step 5: Automate Scans Using Systemd Timers
Instead of running manual checks, configure Systemd to automatically trigger integrity scans during off-peak hours every day.
Create a service unit file at /etc/systemd/system/aidecheck.service:
[Unit]
Description=AIDE File Integrity Check
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/aide --check
StandardOutput=journal
StandardError=journal
Next, create a timer unit at /etc/systemd/system/aidecheck.timer to schedule daily scans at 3:00 AM:
[Unit]
Description=Run AIDE check daily at 3am
[Timer]
OnCalendar=*-*-* 03:00:00
Persistent=true
[Install]
WantedBy=timers.target
Reload the systemd configuration and enable the timer:
sudo systemctl daemon-reload
sudo systemctl enable --now aidecheck.timer
Verify the timer schedule with: systemctl list-timers aidecheck.timer.
Following maintenance or package upgrades via sudo dnf upgrade, your filesystem will naturally undergo massive changes. Be sure to update your baseline database right away:
sudo aide --update
sudo mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
Conclusion
AIDE will not block an active exploit in real time. Instead, it delivers forensic clarity on exactly what was altered. By defining sensible exclusion rules, securing your snapshot database, and refreshing it after every planned update, you can cut incident investigation times from hours down to minutes.
