RootKit Hunter

RootKit Hunterとは
UNIXシステムの不正アクセス・ファイルの改ざんなどを検知するツールです。

■ インストール
公式からダウンロードします。
http://www.rootkit.nl/projects/rootkit_hunter.html
※ 今回のバージョンはrkhunter-1.3.4です。

ダウンロードしてきたファイルを適当なディレクトリに配置します。

解凍
[root@example ~]# tar xfz rkhunter-1.3.4.tar.gz

作成されたディレクトリに移動
[root@example ~]# cd rkhunter-1.3.4

インストール
[root@example ~]# ./installer.sh --layout /usr/local --install

■ 定期的に実行・データベースの更新をする場合
定期的に実行するために、cronにcron用シェルを登録します。
当ブログのPostfixの設定が完了していないと、メールが送られないかもしれません。

# cron日時実行用ディレクトリに移動
[root@example ~]# cd /etc/cron.daily/

cron用のシェルを作成します。
[root@example ~]# vi /etc/cron.daily/rkhunter
# ↓↓↓以下の内容で保存します。↓↓↓

#!/bin/bash
(
/usr/local/bin/rkhunter --versioncheck
/usr/local/bin/rkhunter --update
/usr/local/bin/rkhunter -c --skip-keypress --cronjob
) | /bin/mail -s "[Rootkit Hunter] example `date +%Y-%m-%d`" root@example.com

パーミッションの変更
[root@example ~]# chmod 755 rkhunter

■ 基本コマンド

実行
[root@example ~]# /usr/local/bin/rkhunter -c

データベース情報の更新
[root@example ~]# /usr/local/bin/rkhunter --update

バージョンの確認
[root@example ~]# /usr/local/bin/rkhunter --versioncheck

###
# オプション
# --update :Rootkitデータベースを更新する。
# --versioncheck :RootkitHunterのバージョンを確認する。
# --cronjob :cron用の出力する。
# --nocolors :カラー表示しない。
# --createlogfile :実行時のログを/var/log/rkhunter.log に保存する。