Debian 13 trixie
Sponsored Link

AIDE : Host Based IDS2025/08/17

 

Install and configure Host Based IDS (Intrusion Detection System) [AIDE] (Advanced Intrusion Detection Environment).

[1] Install AIDE.
root@dlp:~#
apt -y install aide
[2] Configure AIDE and initialize database. It's possible to use AIDE with default settings but if you'd like to customize settings, change configuration file like follows. It's possible to see details of Setting rules with [man aide.conf].
root@dlp:~#
vi /etc/default/aide
# line 8 : if you do not use Cron job, comment out and turn to [no]

#CRON_DAILY_RUN=yes
root@dlp:~#
vi /etc/aide/aide.conf
# add to last line : set exclude directories if you need

!/var/log
!/var/lib/aide
!/var/lib/apt
!/var/lib/dpkg
!/var/cache
!/run
# initialize database

root@dlp:~#
aide --init --config /etc/aide/aide.conf

Start timestamp: 2025-08-16 10:38:21 +0900 (AIDE 0.19.1)
AIDE successfully initialized database.
New AIDE database written to /var/lib/aide/aide.db.new
Ignored e2fs attributes: EINV

Number of entries:      35461

---------------------------------------------------
The attributes of the (uncompressed) database(s):
---------------------------------------------------

/var/lib/aide/aide.db.new
 SHA256    : FT7AJ72pmThEkfsQBpbp3J84ee3JYt/s
             QLx+iM7DyAE=
 SHA512    : GsTCxSZv5g0gZHdoDwwZ8lNpYr3dTlP9
             pClusP+n4cmOX57iLfAKKxjF/pdIirmf
             w+8XEufKAk8iSMHx08irog==
 STRIBOG256: 2XDpa0TsA42CjHk7t+oyOdAj8Bf/zorZ
             +MLCye8MM0E=
 STRIBOG512: e6HXszQxcY6Gb3R20fVaOYTOHL7EOnjX
             XLNmQhW0NQM61McJtqk57h2LckmGTuT6
             Ugb8gi43NMtkMBLGNfUXdw==
 SHA512/256: Qaq4Bf/uqZUpd4HqUhib+ss8GK/7IHXj
             8+N42DJy/yY=
 SHA3-256  : hLEqvZn53bZO+82MwhhvqpyZNZkUu7w0
             6dEjyUqk3+s=
 SHA3-512  : m7NaoBuRXWLsFmKMjyQjTlBM2QW1H4zB
             J5OmqP6dzHPCpRkS1Uv/k1c+kcFx6isY
             PrnslhOfgrCVV7SFSUddmw==


End timestamp: 2025-08-16 10:38:59 +0900 (run time: 0m 38s)

# copy generated DB to master DB

root@dlp:~#
cp -p /var/lib/aide/aide.db.new /var/lib/aide/aide.db
[3] Run checking.
root@dlp:~#
aide --check --config /etc/aide/aide.conf
# if thete is no unmatch, it displayed [*** Looks okay]

Start timestamp: 2025-08-16 10:39:33 +0900 (AIDE 0.19.1)
AIDE found NO differences between database and filesystem. Looks okay!!
Ignored e2fs attributes: EINV

Number of entries:      35461

---------------------------------------------------
The attributes of the (uncompressed) database(s):
---------------------------------------------------

/var/lib/aide/aide.db
 SHA256    : FT7AJ72pmThEkfsQBpbp3J84ee3JYt/s
             QLx+iM7DyAE=
 SHA512    : GsTCxSZv5g0gZHdoDwwZ8lNpYr3dTlP9
             pClusP+n4cmOX57iLfAKKxjF/pdIirmf
             w+8XEufKAk8iSMHx08irog==
 STRIBOG256: 2XDpa0TsA42CjHk7t+oyOdAj8Bf/zorZ
             +MLCye8MM0E=
 STRIBOG512: e6HXszQxcY6Gb3R20fVaOYTOHL7EOnjX
             XLNmQhW0NQM61McJtqk57h2LckmGTuT6
             Ugb8gi43NMtkMBLGNfUXdw==
 SHA512/256: Qaq4Bf/uqZUpd4HqUhib+ss8GK/7IHXj
             8+N42DJy/yY=
 SHA3-256  : hLEqvZn53bZO+82MwhhvqpyZNZkUu7w0
             6dEjyUqk3+s=
 SHA3-512  : m7NaoBuRXWLsFmKMjyQjTlBM2QW1H4zB
             J5OmqP6dzHPCpRkS1Uv/k1c+kcFx6isY
             PrnslhOfgrCVV7SFSUddmw==


End timestamp: 2025-08-16 10:40:04 +0900 (run time: 0m 31s)

# try to change a file and check again

root@dlp:~#
touch /root/test.txt

root@dlp:~#
aide --check --config /etc/aide/aide.conf
# detected differences like follows

Start timestamp: 2025-08-16 10:40:40 +0900 (AIDE 0.19.1)
AIDE found differences between database and filesystem!!
Ignored e2fs attributes: EINV

Summary:
  Total number of entries:      35462
  Added entries:                1
  Removed entries:              0
  Changed entries:              1

---------------------------------------------------
Added entries:
---------------------------------------------------

f++++++++++++++++++: /root/test.txt

---------------------------------------------------
Changed entries:
---------------------------------------------------

d =.... mc.. .. .  : /root

---------------------------------------------------
Detailed information about changes:
---------------------------------------------------

Directory: /root
 Mtime     : 2025-08-16 10:38:15 +0900        | 2025-08-16 10:40:35 +0900
 Ctime     : 2025-08-16 10:38:15 +0900        | 2025-08-16 10:40:35 +0900
.....
.....
[4] If there is no problem even if some differences are detected, then update database like follows.
root@dlp:~#
aide --update --config /etc/aide/aide.conf
Start timestamp: 2025-08-16 10:42:07 +0900 (AIDE 0.19.1)
AIDE found differences between database and filesystem!!
New AIDE database written to /var/lib/aide/aide.db.new
Ignored e2fs attributes: EINV

Summary:
  Total number of entries:      35462
  Added entries:                1
  Removed entries:              0
  Changed entries:              1

---------------------------------------------------
Added entries:
---------------------------------------------------

f++++++++++++++++++: /root/test.txt

---------------------------------------------------
Changed entries:
---------------------------------------------------

d =.... mc.. .. .  : /root

---------------------------------------------------
Detailed information about changes:
---------------------------------------------------

Directory: /root
 Mtime     : 2025-08-16 10:38:15 +0900        | 2025-08-16 10:40:35 +0900
 Ctime     : 2025-08-16 10:38:15 +0900        | 2025-08-16 10:40:35 +0900
.....
.....

# update database

root@dlp:~#
cp -p /var/lib/aide/aide.db.new /var/lib/aide/aide.db
Matched Content