Description
AIDE needs a reference database, /var/lib/aide/aide.db, built with aideinit from the
current state of the system. aide-common then runs a daily check, which compares the files
with the database and writes a report to /var/log/aide/ (and mails it when a mail transport
is installed):
- from Ubuntu 24.04 (AIDE 0.18 and later), with
dailyaidecheck.timer; - on Ubuntu 20.04 and 22.04 (AIDE 0.16 and 0.17), with the cron job
/etc/cron.daily/aide, whichCRON_DAILY_RUN=noin/etc/default/aideturns off.
This control requires the database to exist and the daily check to be enabled.
Build the database once the system is in its intended state: run this fix after the other
hardening fixes, or rebuild the database afterwards with aideinit -y -f, otherwise the first
reports list every change made by the hardening.
Rationale
The database is the trusted reference; the daily check turns it into detection. Without either, an installed AIDE gives a false sense of protection.
Impact
Building the database reads every covered file: a few minutes and a short burst of disk
activity. The daily check does the same. After legitimate changes (upgrades, configuration),
review the report and update the database (aide --update, then replace aide.db with
aide.db.new).
Setting
| Location | /var/lib/aide/aide.db, dailyaidecheck.timer (20.04 and 22.04 - /etc/cron.daily/aide) |
| Default | No database; daily check enabled when aide-common is installed |
| Recommended | Database present, daily check enabled |
Audit
- Run
ls -l /var/lib/aide/aide.db. The file must exist and not be empty. - Ubuntu 24.04 and later: run
systemctl is-enabled dailyaidecheck.timer. It must printenabled. Ubuntu 20.04 and 22.04:/etc/cron.daily/aidemust be executable and/etc/default/aidemust not setCRON_DAILY_RUN=no. - Read the last report in
/var/log/aide/and check that differences are explained.
Automated: every check must pass. Scanners report each check by its id.
database
The AIDE reference database exists.
script: |
if [ -s /var/lib/aide/aide.db ]; then
ls -l /var/lib/aide/aide.db
else
echo "/var/lib/aide/aide.db missing or empty"
exit 1
fi
timer
dailyaidecheck.timer is enabled.
unit: dailyaidecheck.timer
state: enabled
cron
The daily AIDE cron job is present and not turned off (AIDE 0.16 and 0.17).
script: |
[ -x /etc/cron.daily/aide ] || { echo "/etc/cron.daily/aide missing or not executable"; exit 1; }
v=$(sed -n 's/^[[:space:]]*CRON_DAILY_RUN=//p' /etc/default/aide 2>/dev/null | tail -n 1 | tr -d "\"'")
echo "/etc/cron.daily/aide present, CRON_DAILY_RUN=${v:-yes (default)}"
[ "${v:-yes}" = yes ]
Remediation
- Run
aideinit -y -fand wait for it to finish (a few minutes). - Ubuntu 24.04 and later: run
systemctl enable --now dailyaidecheck.timer. Ubuntu 20.04 and 22.04: runchmod 755 /etc/cron.daily/aideand setCRON_DAILY_RUN=yes(or remove the line) in/etc/default/aide.
| Restart | none |
| Disruption | low |
Rollback
Run systemctl disable --now dailyaidecheck.timer (20.04 and 22.04: set CRON_DAILY_RUN=no in /etc/default/aide) and delete /var/lib/aide/aide.db.
database
command -v aideinit >/dev/null 2>&1 || { echo "AIDE is not installed" >&2; exit 1; }
# umask 027: aideinit would otherwise create its logs readable by everyone
[ -s /var/lib/aide/aide.db ] || (umask 027; aideinit -y -f)
timer
Generated from check timer: the engine writes the fix for every output, it sets the expected value and the check runs again after.
cron
[ -f /etc/cron.daily/aide ] || { echo "AIDE is not installed" >&2; exit 1; }
chmod 755 /etc/cron.daily/aide
if grep -Eq '^[[:space:]]*CRON_DAILY_RUN=' /etc/default/aide 2>/dev/null; then
cb_backup /etc/default/aide
sed -i 's/^[[:space:]]*CRON_DAILY_RUN=.*/CRON_DAILY_RUN=yes/' /etc/default/aide
fi
Handwritten code reads parameters from CB_<NAME> environment variables. Each release turns these fixes into remediate.sh and an Ansible role per profile: dry run by default, a fix runs only when its check fails.
References
- aideinit(8), Ubuntu manual pages Canonical, vendor-doc, accessed 2026-10-19
- systemd.timer(5), Ubuntu manual pages Canonical, vendor-doc, accessed 2026-10-19
- ANSSI-BP-028 v2.0 - Recommandations de configuration d'un système GNU/Linux (R76) ANSSI, guide, accessed 2026-10-19
Mappings
| Framework | ID | Relation | Note |
|---|---|---|---|
| ANSSI-BP-028 - Recommandations de configuration d'un système GNU/Linux2.0 | R76 | equivalent | |
| NIST SP 800-53 Rev. 55.1.1 | SI-7(1) | related |
How this control relates to the other framework's: equivalent, stricter, looser, partial or related.
Threats mitigated
Related controls
- requires
CB-UBU-AUDIT-032Install the AIDE file integrity checker - requires
CB-UBU-AUDIT-033Check the integrity of the audit tools with AIDE - related
CB-UBU-AUDIT-035Keep a protected copy of the AIDE database
People and lifecycle
| Authors |
|
| Verified | 2026-10-19 by Sn0wAlice on 20.04, Proxmox VM, Ubuntu 20.04 cloud image, kernel 5.4.0-216-generic. Fails on stock image; aideinit builds aide.db (about 10 min on 1 vCPU), cron.daily/aide present; passes after reboot. |
| Verified | 2026-10-19 by Sn0wAlice on 22.04, Proxmox VM, Ubuntu 22.04 cloud image, kernel 5.15.0-198-generic. Fails on stock image; aideinit builds aide.db (about 10 min on 1 vCPU), cron.daily/aide present; passes after reboot. |
| Verified | 2026-10-19 by Sn0wAlice on 24.04, Proxmox VM, Ubuntu 24.04 cloud image, kernel 6.8.0-147-generic. Fails on stock image; aideinit builds aide.db, dailyaidecheck.timer enabled; passes after reboot. |
| Verified | 2026-10-19 by Sn0wAlice on 26.04, Proxmox VM, Ubuntu 26.04 cloud image, kernel 7.0.0-38-generic. Fails on stock image; aideinit builds aide.db, dailyaidecheck.timer enabled; passes after reboot. |
| Introduced in | v0.1.0 |
| Created, updated | 2026-10-19, 2026-10-19 |
| Translations | fr |