#author("2018-09-06T16:02:38+09:00","","")

#author("2018-09-06T16:03:38+09:00","","")

[[CentOS7]]

*AIDE : ホスト型IDS [#n38c95ad]

ホスト型 IDS (Intrusion Detection System) の AIDE (Advanced Intrusion Detection Environment) のインストールと設定です。

**AIDE をインストールします。 [#tf440e7c]

|BGCOLOR(black):COLOR(white):|c
|[root@localhost ~]# yum -y install aide|

AIDE を設定してデータベースを初期化します。設定はデフォルトのままでも利用できますが、監視対象を調整する場合は設定ファイルを変更します。 設定ルールについては、設定ファイルの 26-84行目あたりで説明してありますので参考にしてください。

|BGCOLOR(black):COLOR(white):|c
|[root@localhost ~]# vi /etc/aide.conf|
|&color(lightpink){# 例として、/var/log の監視を変更}; &br; /var/log   p+u+g+i+n+acl+selinux+xattrs &br;  &br; &color(lightpink){# データベース初期化}; &br;|
|[root@localhost ~]# aide --init|
|AIDE, version 0.15.1 &br;  &br; ### AIDE database at /var/lib/aide/aide.db.new.gz initialized. &br;  &br; &color(lightpink){# 生成された DB をマスター DB へコピー}; &br; |
|[root@localhost ~]# cp -p /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz|



**チェックを実行します。 [#fe02fba8]
|BGCOLOR(black):COLOR(white):|c

|&color(lightpink){# チェック実行};|
|[root@localhost ~]# aide --check|
|&color(lightpink){# DB との差分がない場合は以下のように Okay と表示される}; &br;  &br; AIDE, version 0.15.1 &br;  &br; ### All files match AIDE database. Looks okay! &br;  &br; &color(lightpink){# 任意のファイルを変更して再度チェック実行}; &br; |
|[root@localhost ~]# chmod 640 /root/anaconda-ks.cfg|
|[root@localhost ~]# aide --check|
|&color(lightpink){# 以下のように差分が検出される}; &br;  &br; AIDE 0.15.1 found differences between database and filesystem!! &br; Start timestamp: 2015-06-17 19:55:20 &br;  &br; Summary: &br;   Total number of files:        39039 &br;   Added files:                  0 &br;   Removed files:                0 &br;   Changed files:                1 &br;  &br;  &br; --------------------------------------------------- &br; Changed files: &br; --------------------------------------------------- &br;  &br; changed: /root/anaconda-ks.cfg &br;  &br; --------------------------------------------------- &br; Detailed information about changes: &br; --------------------------------------------------- &br;  &br;  &br; File: /root/anaconda-ks.cfg &br;  Perm     : -rw-------                       , -rw-r----- &br;  Ctime    : 2015-05-24 02:22:04              , 2015-06-19 11:55:15 &br;  ACL      : old = A: &br; ---- &br; user::rw- &br; group::--- &br; other::--- &br; ---- &br;                   D: <NONE> &br;             new = A: &br; ---- &br; user::rw- &br; group::r-- &br; other::--- &br; ---- &br;                   D: <NONE> &br; |



チェック実行と、変更が検出されたが内容に問題ない場合にデータベースの更新を行う場合は以下のようにします。

|BGCOLOR(black):COLOR(white):|c
|[root@localhost ~]# aide --update|
| &br; AIDE 0.15.1 found differences between database and filesystem!! &br; Start timestamp: 2015-06-17 19:56:31 &br;  &br; Summary: &br;   Total number of files:        39039 &br;   Added files:                  0 &br;   Removed files:                0 &br;   Changed files:                1 &br;  &br;  &br; --------------------------------------------------- &br; Changed files: &br; --------------------------------------------------- &br;  &br; changed: /root/anaconda-ks.cfg &br; ..... &br; ..... &br;  &br; &color(lightpink){# データベース更新}; &br; |
|[root@localhost ~]# cp -p /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz|


定期的にチェックするよう Cron に登録します。 チェック結果のログファイル [/var/log/aide/aide.log] はチェックの都度上書きされる上に、差分がない場合はゼロバイトでの上書きになるため、 チェック結果を毎回保存しておきたい場合は、シェルスクリプトで対応するか、毎回メールで結果を送信する等の工夫が必要です。

|BGCOLOR(black):COLOR(white):|c
|&color(lightpink){# 例として、毎日午前一時にチェック実行し、結果を root 宛にメールで送信};|
|[root@localhost ~]# vi /etc/cron.d/aide|
|00 01 * * * /usr/sbin/aide --update | mail -s 'Daily Check by AIDE' root|

|00 01 * * * /usr/sbin/aide --update &#124; mail -s 'Daily Check by AIDE' root|


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS