AIDE - Advanced Intrusion Detection Environment
提供:MDWiki
目次 |
インストール
今回は pkg_add を使った。
freebsd# pkg_add -r aide
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.2-release/Latest/aide.tbz... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.2-release/All/mhash-0.9.9.9_1.tbz... Done.
If you want to finish setting up AIDE, don't forget to customise your
own aide.conf in /usr/local/etc/aide.conf. You will also need to run
the following commands:
cd /var/db/aide
aide --init
mv databases/aide.db.new databases/aide.db
You may want to change the permissions of the /var/adm/aide/ directory tree.
For your reference, a copy of the original aide.conf is supplied in
/usr/local/etc/aide.conf.sample.
freebsd#
make を使う場合は以下のとおり。
freebsd# cd /usr/ports/security/aide freebsd# make [...] cc -O2 -pipe -I/usr/local/include -fno-strict-aliasing -static -O2 -pipe -I/usr/local/include -fno-strict-aliasing -static\ -L/usr/local/lib -pthread -static -L/usr/local/lib -pthread -o aide conf_yacc.o conf_lex2.o getopt.o getopt1.o gnu_regex.o\ error.o md.o db.o commandconf.o db_file.o db_disk.o db_lex2.o db_sql.o gen_list.o list.o do_md.o base64.o symboltable.o\ compare_db.o be.o util.o snprintf.o fopen.o aide.o -lm -lmhash -lcrypt -lz gmake[2]: Leaving directory `/usr/ports/security/aide/work/aide-0.13.1/src' Making all in doc gmake[2]: Entering directory `/usr/ports/security/aide/work/aide-0.13.1/doc' gmake[2]: Nothing to be done for `all'. gmake[2]: Leaving directory `/usr/ports/security/aide/work/aide-0.13.1/doc' gmake[2]: Entering directory `/usr/ports/security/aide/work/aide-0.13.1' gmake[2]: Nothing to be done for `all-am'. gmake[2]: Leaving directory `/usr/ports/security/aide/work/aide-0.13.1' gmake[1]: Leaving directory `/usr/ports/security/aide/work/aide-0.13.1' freebsd# make install [...]
/usr/local/bin に入るので、動作を確認する。
freebsd# /usr/local/bin/aide -v Aide 0.13.1 Compiled with the following options: WITH_MMAP WITH_LSTAT WITH_READDIR WITH_MHASH CONFIG_FILE = "/usr/local/etc/aide.conf" freebsd#
設定
まず、データベースを作らないといけない。インストールすると所定の位置に作られるファイルを移してやる。手順は、上記にあるとおり、
cd /var/db/aide
aide --init
mv databases/aide.db.new databases/aide.db
である。ただ、FreeBSD で実際にやるとデータベースは違うところに入るので、以下を参照。
freebsd# /usr/local/bin/aide --init AIDE, version 0.13.1 ### AIDE database at /usr/local/etc/aide.db.new initialized. freebsd# cd /usr/local/etc freebsd# cp aide.db.new aide.db freebsd# ls -la [...] -rw-r--r-- 1 root wheel 151 Oct 5 14:02 aide.conf -r--r--r-- 1 root wheel 4140 Jan 6 2011 aide.conf.sample -rw------- 1 root wheel 76446 Oct 5 14:09 aide.db -rw------- 1 root wheel 76446 Oct 5 14:07 aide.db.new -r--r--r-- 1 root wheel 4140 Oct 5 13:59 aide.init.conf [...]
設定ファイルは /usr/local/etc/aide.conf なので、これに以下のとおり小さく設定してみる。
freebsd# cat /usr/local/etc/aide.conf # made by Takayuki Kawamoto on 5th October 2011. SecureRule = p+i+n+u+g+s+b+m+c+md5+sha1 /bin SecureRule /sbin SecureRule !/var/log/.* /etc SecureRule
そして、試しに integrity チェックする。
freebsd# /usr/local/bin/aide --update AIDE, version 0.13.1 ### All files match AIDE database. Looks okay! ### New AIDE database written to /usr/local/etc/aide.db.new freebsd#
そして、/bin に hoge というファイルを作るとどうなるか、確認してみる。
freebsd# touch hoge freebsd# /usr/local/bin/aide --update AIDE found differences between database and filesystem!! Start timestamp: 2011-10-05 14:16:06 Summary: Total number of files: 555 Added files: 1 Removed files: 0 Changed files: 1 --------------------------------------------------- Added files: --------------------------------------------------- added: /bin/hoge --------------------------------------------------- Changed files: --------------------------------------------------- changed: /bin -------------------------------------------------- Detailed information about changes: --------------------------------------------------- Directory: /bin Mtime : 2011-02-18 10:51:12 , 2011-10-05 14:16:06 Ctime : 2011-10-04 18:07:21 , 2011-10-05 14:16:06 freebsd#
定期実行の仕方
cron で動かす。
0 12 * * * nice -19 /usr/local/bin/aide | mail -s "AIDE Check" takayuki.kawamoto@*******.co.jp
これで毎日正午に実行される(nice コマンドは実行順序を上げているだけなので、なくてもよい)。標準出力の値がそのままメールに入るので、
Date: Wed, 5 Oct 2011 15:45:38 +0900 (JST) From: root@********.co.jp (Charlie Root) To: takayuki.kawamoto@********.co.jp AIDE, version 0.13.1 ### All files match AIDE database. Looks okay!
のようになる。
参考
- AIDE home
- RHEL 4 にホストベースの侵入検知(IDS)ツール「aide」をインストールする
- How To Configure The AIDE (Advanced Intrusion Detection Environment) File Integrity Scanner For Your Website
リンク
- セキュリティ関連メモ のトップページへ
- メインページへ