| はじめての自宅サーバ構築 - Fedora/CentOS - | Last Update | 2008/05/16 | |
| It opened to 2004/09/19. 当サイトはFedora9で運用しています |
Visitors Pageviews Today(IP/PV) |
3,251,070 12,000,148 1,539/8,805 |
|
デルではおとくなキャンペーン実施中! |
レノボ Web 広告限定ストア(キャンペーン&新着情報) |
chkrootkitモジュールは日々バージョンアップしています。 最新版は『chkrootkit.org』で確認してください。 chkrootkitのダウンロード # wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz --14:32:51-- ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz => `chkrootkit.tar.gz' ftp.pangeia.com.br をDNSに問いあわせています... 完了しました。 ftp.pangeia.com.br[200.239.53.35]:21 に接続しています... 接続しました。 anonymous としてログインしています... ログインしました! ==> SYST ... 完了しました。 ==> PWD ... 完了しました。 ==> TYPE I ... 完了しました。 ==> CWD /pub/seg/pac ... 完了しました。 ==> PASV ... 完了しました。 ==> RETR chkrootkit.tar.gz ... 完了しました。 長さ: 37,791 (確証はありません) 100%[====================================>] 37,791 7.09K/s ETA 00:00 14:33:04 (7.09 KB/s) - `chkrootkit.tar.gz' を保存しました [37791] ダウンロードしたファイルを展開 # tar zxvf chkrootkit.tar.gz chkrootkit-0.47 chkrootkit-0.47/ACKNOWLEDGMENTS chkrootkit-0.47/COPYRIGHT chkrootkit-0.47/Makefile chkrootkit-0.47/README : : : chkrootkit-0.47/chkrootkit.lsm chkrootkit-0.47/chkutmp.c chkrootkit-0.47/chkwtmp.c chkrootkit-0.47/ifpromisc.c chkrootkit-0.47/strings.c 展開されたパスへ移動してコンパイル # cd chkrootkit-0.47 # make sense gcc -DHAVE_LASTLOG_H -o chklastlog chklastlog.c gcc -DHAVE_LASTLOG_H -o chkwtmp chkwtmp.c gcc -DHAVE_LASTLOG_H -D_FILE_OFFSET_BITS=64 -o ifpromisc ifpromisc.c gcc -o chkproc chkproc.c gcc -o chkdirs chkdirs.c gcc -o check_wtmpx check_wtmpx.c gcc -static -o strings-static strings.c gcc -o chkutmp chkutmp.c 実行パスへコピー # cp -p chkrootkit /usr/sbin/ |
# yum -y install chkrootkit |
chkrootkitの実行
# chkrootkit
ROOTDIR is `/'
Checking `amd'... not found
Checking `basename'... not infected
Checking `biff'... not found
Checking `chfn'... not infected
Checking `chsh'... not infected
:
:
Checking `w55808'... not infected
Checking `wted'... nothing deleted
Checking `scalper'... not infected
Checking `slapper'... not infected
Checking `z2'... nothing deleted
#
画面にに"INFECTED"が出力しなければ問題ありません
|
シェルスクリプトを作成
# vi /root/chkrootkit.sh
#!/bin/sh
echo "Job Name (chkrootkit.sh)"
echo " 開始(`date +"%k時%M分%S秒"`)"
/usr/bin/chkrootkit > /var/log/chkrootkit.log
grep INFECTED /var/log/chkrootkit.log
rm -f /var/log/chkrootkit.log
echo " 終了(`date +"%k時%M分%S秒"`)"
作成したシェルスクリプトに実行権を与える
# chmod 700 /root/chkrootkit.sh
プログラムを定期的に実行するcrondの設定ファイルを編集する
# crontab -e
毎日06:00にrootkit検知チェックを行う
00 06 * * * /root/chkrootkit.sh
cronジョブで送られてくるメールが文字化けを起こす場合は、以下を追加する
00 06 * * * /root/chkrootkit.sh | nkf -j
nkfは文字コードを変換します。
JISコードに変換する事により文字化けを回避する事が可能。
nkfのパラメータは以下の様になります
-e EUCコードに変換
-s シフトJISコードに変換
-j JISコードに変換
|
Job Name (chkrootkit.sh)この時、bindshellが”INFECTED”になりますが、メールサーバ(SMTP)のPostfixに関連があるみたいです。
開始( 6時00分00秒)
Checking `bindshell'... INFECTED (PORTS: 465)
終了( 6時00分16秒)