Skip to content

File integrity monitoring on production Linux servers

How to deploy file integrity monitoring on production Linux without drowning in false positives — what to watch, what to ignore, and how to respond.

File integrity monitoring is one of those controls that’s either invaluable or completely ignored, depending on whether the alerts are signal or noise. The difference is almost entirely in what you tell it to watch. Point AIDE at the root filesystem with defaults and you’ll get an email a day until someone disables it.

What’s happening

A production Linux server has files that change constantly for legitimate reasons — log files, package caches, journal databases, application temp directories — and files that should never change between releases. The most useful FIM policy treats those two sets very differently. The least useful FIM policy puts them in the same alert stream and trains the operator to ignore both.

How to verify

Before deploying, baseline what actually changes on the host over 48 hours of normal operation. With AIDE:

sudo aide --init
sudo mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
sleep 172800
sudo aide --check | head -200

The first run after baseline tells you everything that legitimately changes during normal operation. Anything in that output that you can’t explain — by package update, application activity, or scheduled job — is what your policy needs to alert on. Everything else should be excluded by path, not by silencing the report.

The fix

A useful AIDE policy in /etc/aide/aide.conf covers three buckets:

# Critical binaries and config — alert on any change
/usr/bin       f+p+u+g+s+m+c+sha256
/usr/sbin      f+p+u+g+s+m+c+sha256
/etc           f+p+u+g+s+m+c+sha256

# Authentication and SSH — alert on any change, separate channel
/etc/passwd    f+p+u+g+s+m+c+sha256
/etc/shadow    f+p+u+g+s+m+c+sha256
/etc/sudoers.d f+p+u+g+s+m+c+sha256
/root/.ssh     f+p+u+g+s+m+c+sha256
/home          f+p+u+g+sha256

# Web roots — alert on PHP and JS changes outside deploy windows
/var/www       f+p+u+g+sha256

# Explicitly excluded — noisy and not security-relevant
!/var/log
!/var/cache
!/var/lib/mysql
!/var/lib/postgresql
!/tmp
!/proc
!/sys

Run aide --check from a daily cron, but route the output through a wrapper that suppresses changes inside known deploy windows — a release will legitimately touch /var/www and you don’t want to ignore the report on the day that matters.

Pair this with package-database verification — rpm -Va or debsums -c — which catches a modified binary that was originally installed from a package. AIDE notices the change; package verification tells you it shouldn’t have been possible.

For long-lived servers, the database itself becomes a target. Store the baseline on a write-once medium or copy it to a separate host after each refresh; an attacker who can rewrite aide.db.gz makes the whole tool lie quietly.

We treat FIM rollout, baseline maintenance, and alert routing as part of every long-lived environment under Environment Management.