AIDE : インストール
2025/01/03 |
ホスト型 IDS (Intrusion Detection System), AIDE (Advanced Intrusion Detection Environment) のインストールと設定です。 |
|
[1] | AIDE をインストールします。 |
[root@dlp ~]# dnf -y install aide
|
[2] | AIDE を設定してデータベースを初期化します。設定はデフォルトのままでも利用できますが、監視対象を調整する場合は設定ファイルを変更します。 |
[root@dlp ~]#
vi /etc/aide.conf # 27行目から : 設定ルールの説明 # These are the default rules. # #p: permissions #i: inode: #n: number of links #u: user #g: group #s: size #b: block count #m: mtime #a: atime #c: ctime #S: check for growing size #acl: Access Control Lists #selinux SELinux security context #xattrs: Extended file attributes #md5: md5 checksum #sha1: sha1 checksum #sha256: sha256 checksum #sha512: sha512 checksum #rmd160: rmd160 checksum #tiger: tiger checksum ..... ..... # データベース初期化 [root@dlp ~]# aide --init Start timestamp: 2025-01-03 09:58:47 +0900 (AIDE 0.18.6) AIDE successfully initialized database. New AIDE database written to /var/lib/aide/aide.db.new.gz Number of entries: 56061 --------------------------------------------------- The attributes of the (uncompressed) database(s): --------------------------------------------------- /var/lib/aide/aide.db.new.gz MD5 : 2BrNIRp9abnzQYvw225hGg== SHA1 : aEBvOYrTDQAFXruTp8VI44GsLiI= SHA256 : 4hVpzwva9X5GiC+q6RQcCB5/j1yqreHt 7kjGRX9IA2o= SHA512 : ZNqMSwbD0ajPCrIQxf9Yg+1w0QnhKDLY VjcpZ3O8Betts1QyGue57cWq2tI4+ymx wYfwlFy8nmkvA9u/eeN1Ag== RMD160 : 88yBrD0urLBUUapGpK3+2EaDjvw= End timestamp: 2025-01-03 09:58:59 +0900 (run time: 0m 12s) # 生成された DB をマスター DB へコピー [root@dlp ~]# cp -p /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
|
[3] | チェックを実行します。 |
# チェック実行 [root@dlp ~]# aide --check # DB との差分がない場合は以下のように [Looks okay] と表示される Start timestamp: 2025-01-03 10:04:41 +0900 (AIDE 0.18.6) AIDE found NO differences between database and filesystem. Looks okay!! Number of entries: 56061 --------------------------------------------------- The attributes of the (uncompressed) database(s): --------------------------------------------------- /var/lib/aide/aide.db.gz MD5 : GyTINo5u1lyxVLBoAEB5yA== SHA1 : R+u6XmMrUC6GSewaSBv9RV/9Wm4= SHA256 : rqRTQmUS25zSR7bCN4DF/TnIyTmHqO5N UOR7sa9JcNQ= SHA512 : UB3TRfHlxLK//7zCZON8Q544eCpnBeR9 5NVoHl175wCd0/g8SzoICIIjQP0mTrc/ fZWgg7VJ8TeJUYUzn2C8vA== RMD160 : dRx1mGFTnP5r+PRBSS0wwZCgei4= End timestamp: 2025-01-03 10:05:17 +0900 (run time: 0m 36s) # 以下のように差分が検出される Start timestamp: 2025-01-03 10:05:56 +0900 (AIDE 0.18.6) AIDE found differences between database and filesystem!! Summary: Total number of entries: 56061 Added entries: 0 Removed entries: 0 Changed entries: 1 --------------------------------------------------- Changed entries: --------------------------------------------------- f = p.. .c...A.. : /root/anaconda-ks.cfg --------------------------------------------------- Detailed information about changes: --------------------------------------------------- File: /root/anaconda-ks.cfg Perm : -rw------- | -rw-r----- Ctime : 2024-12-14 18:35:49 +0900 | 2025-01-03 10:05:51 +0900 ACL : A: user::rw- | A: user::rw- A: group::--- | A: group::r-- A: other::--- | A: other::--- ..... ..... |
[4] | チェック実行と、変更が検出されたが内容に問題ない場合にデータベースの更新を行う場合は以下のようにします。 |
[root@dlp ~]#
aide --update Start timestamp: 2025-01-03 10:07:42 +0900 (AIDE 0.18.6) AIDE found differences between database and filesystem!! New AIDE database written to /var/lib/aide/aide.db.new.gz Summary: Total number of entries: 56061 Added entries: 0 Removed entries: 0 Changed entries: 1 --------------------------------------------------- Changed entries: --------------------------------------------------- f = p.. .c...A.. : /root/anaconda-ks.cfg --------------------------------------------------- Detailed information about changes: --------------------------------------------------- File: /root/anaconda-ks.cfg Perm : -rw------- | -rw-r----- Ctime : 2024-12-14 18:35:49 +0900 | 2025-01-03 10:05:51 +0900 ACL : A: user::rw- | A: user::rw- A: group::--- | A: group::r-- A: other::--- | A: other::--- ..... ..... # データベース更新 [root@dlp ~]# cp -p /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
|
[5] | 定期的にチェックするよう Cron に登録します。 チェック結果のログファイル [/var/log/aide/aide.log] はチェックの都度上書きされるため、 チェック結果を毎回保存しておきたい場合は、シェルスクリプトで対応するか、毎回メールで結果を送信する等の工夫が必要です。 |
00 01 * * * root /usr/sbin/aide --update | mail -s 'Daily Check by AIDE' root
|
|