设为首页收藏本站

LinuxTone | 运维专家网论坛 - 最棒的Linux运维与开源架构技术交流社区!

 找回密码
 注册

用新浪微博连接

一步搞定

QQ登录

只需一步,快速开始

查看: 2059|回复: 1

[系统安全] 使用Chkrootkit 检测系统木马 [复制链接]

LT管理团队

社区首席勤杂工

Rank: 9Rank: 9Rank: 9

签到
68
注册时间
2008-5-19
最后登录
2012-2-3
在线时间
1757 小时
阅读权限
200
积分
12741
帖子
2521
主题
1198
精华
24
UID
1

LT总司令

发表于 2008-6-8 11:04:56 |显示全部楼层
Chkrootkit is a powerful tool to scan your *nux server for trojans. Here i explain how to install it, scan your server and setup a daily automated scanning job that emails you the report.


#Change to root
su -

#Download latest source
wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz

#Unpack the source file using the command
tar xvzf chkrootkit.tar.gz

#Change to chkrootkit source directory
cd chkrootkit

#Compile chkrootkit
make sense

#To run chkrootkit, type
./chkrootkit


A clean system should return many 'nothing found" or not infected. A comprised system may return 'INFECTED" or vulnerable.

Lastly, chkrootkit should run once a day to ensure system safety. The following script created in /etc/cron.daily will scan system one per day and report detected trojan to specified persons via emails:


# cat /etc/cron.daily/chkrootkit.sh
#!/bin/bash

SYSADMIN1=admin1@email.com
SYSADMIN2=admin2@email.com

TMPDIR=/tmp
HOSTNAME=`hostname`
DATE=`date "+%d/%m/%Y %H:%M"`
CHKROOTKIT=/usr/local/chkrootkit-0.46a/chkrootkit
MAIL=mail

# Clean up before its runs
rm -f $TMPDIR/chkrootkit.$$
if [ -f $TMPDIR/chkrootkit.$$ ]; then
echo "Checkroot kit temp files exist in $TMPDIR directory that cannot be removed. This may be an attempt to spoof the checker." | $MAIL -s "$HOSTNAME $DATE ACTIVE SYSTEM ATTACK!" -c $SYSADMIN1 $SYSADMIN2
exit 1
fi

# Check for root kits
$CHKROOTKIT | grep INFECTED > $TMPDIR/chkrootkit.$$
if [ -s $TMPDIR/chkrootkit.$$ ]; then
cat $TMPDIR/chkrootkit.$$ | $MAIL -s "$DATE - ROOTKIT DETECTED ON $HOSTNAME!" -c $SYSADMIN1 $SYSADMIN2
fi

# Clean Up
rm -f $TMPDIR/chkrootkit.$$
感谢大家对linuxtone的支持!

Rank: 8Rank: 8

注册时间
2008-5-26
最后登录
2011-10-8
在线时间
36 小时
阅读权限
150
积分
317
帖子
88
主题
33
精华
5
UID
7

LT粉丝

发表于 2008-7-10 15:15:52 |显示全部楼层
不错不错,受用了

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

IT运维专家网感谢红之盟网络提供带宽支持

合作联系: QQ:67888954/MSN:cnseek@msn.com/mail:netseek@linuxtone.org

Archiver|手机版|感谢所有关心和支持过LinuxTone的朋友们 转载本站内容请注明原作者名及出处 ( 京ICP备08103151 )   |

GMT+8, 2012-2-4 18:00 , Processed in 0.059349 second(s), 12 queries , Memcache On.

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部