<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LinuxByte &#187; chkrootkit</title>
	<atom:link href="http://www.linuxbyte.org/tag/chkrootkit/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxbyte.org</link>
	<description>一个Linux Blog</description>
	<lastBuildDate>Thu, 26 Jan 2012 08:13:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>使用chkrootkit工具保护服务器</title>
		<link>http://www.linuxbyte.org/chkrootkit-minihowto.html</link>
		<comments>http://www.linuxbyte.org/chkrootkit-minihowto.html#comments</comments>
		<pubDate>Thu, 17 Jul 2008 17:35:16 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[系统网络安全]]></category>
		<category><![CDATA[chkrootkit]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/?p=179</guid>
		<description><![CDATA[      在保护linux 服务器时除了Tripwire 这样强大工具外，还有一个简单又好用的工具&#8211;chkrootkit。chkrootkit 顾名思义是监测系统是否被安装了rootkit 的一个安全工具。 安装chkrootkit，你可以自... ]]></description>
			<content:encoded><![CDATA[<p>      在保护linux 服务器时除了Tripwire 这样强大工具外，还有一个简单又好用的工具&#8211;chkrootkit。chkrootkit 顾名思义是监测系统是否被安装了rootkit 的一个安全工具。</p>
<p><strong>安装chkrootkit</strong>，你可以自己去 <a href="http://www.chkrootkit.org/download/">http://www.chkrootkit.org/download/</a> 下载源码包，然后自己编译，也可以和我一样偷懒用别人做好的二进制包.<span id="more-179"></span></p>
<p>centos 下用非官方源安装chkrootkit:<br />
首先添加dag 源for centos（我的系统是centos5.2）</p>
<blockquote>
<p style="padding-left: 30px;"># vi /etc/yum.repos.d/dag.repo<br />
[dag]<br />
name=Dag RPM Repository for Red Hat Enterprise Linux<br />
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag<br />
gpgcheck=1<br />
enabled=1
</p>
<p style="padding-left: 30px;"># rpm &#8211;import <a href="http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt">http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt</a></p>
<p style="padding-left: 30px;">yum 安装chkrootkit<br />
# yum update<br />
# yum install chkrootkit</p>
</blockquote>
<p><strong>chkrootkit的应用</strong><br />
chkrootkit 的使用非常简单直接运行 chkrootkit 命令，然后会有如下输出</p>
<p style="padding-left: 30px;">ROOTDIR is `/&#8217;<br />
Checking `amd&#8217;&#8230; not found<br />
Checking `basename&#8217;&#8230; not infected<br />
Checking `biff&#8217;&#8230; not found<br />
Checking `chfn&#8217;&#8230; not infected<br />
Checking `chsh&#8217;&#8230; not infected<br />
Checking `cron&#8217;&#8230; not infected<br />
Checking `crontab&#8217;&#8230; not infected<br />
Checking `date&#8217;&#8230; not infected<br />
Checking `du&#8217;&#8230; not infected<br />
Checking `dirname&#8217;&#8230; not infected<br />
Checking `echo&#8217;&#8230; not infected<br />
Checking `egrep&#8217;&#8230; not infected<br />
Checking `env&#8217;&#8230; not infected<br />
.<br />
.<br />
.</p>
<p>如果有rootkit会报<span style="color: #ff0000;">“INFECTED”</span> 所以可以直接用chkrootkit -n|grep &#8216;INFECTED&#8217;更直接一些。</p>
<p>定时检测并在出问题时给管理员发邮件。<br />
创建如下脚本chkrootkit.sh并放入crontab 定时运行。
</p>
<p style="padding-left: 30px;"># cat chkrootkit.sh<br />
#!/bin/bash<br />
PATH=/usr/bin:/bin
</p>
<p style="padding-left: 30px;">TMPLOG=`mktemp`</p>
<p style="padding-left: 30px;"># Run the chkrootkit<br />
/usr/bin/chkrootkit &gt; $TMPLOG</p>
<p style="padding-left: 30px;"># Output the log<br />
cat $TMPLOG | logger -t chkrootkit</p>
<p style="padding-left: 30px;"># bindshe of SMTPSllHow to do some wrongs<br />
if [ ! -z "$(grep 465 $TMPLOG)" ] &amp;&amp; \<br />
   [ -z $(/usr/sbin/lsof -i:465|grep bindshell) ]; then<br />
   sed -i &#8216;/465/d&#8217; $TMPLOG<br />
   fi</p>
<p style="padding-left: 30px;"># If the rootkit have been found,mail root<br />
[ ! -z "$(grep INFECTED $TMPLOG)" ] &amp;&amp; \<br />
grep INFECTED $TMPLOG | mail -s “chkrootkit report in `hostname`” root</p>
<p># chmod 700 chkroot.sh<br />
# <span class="command">mv chkrootkit /etc/cron.daily</span></p>
<p><span class="command">这样系统会每天运行chkrootkit 检测系统，并在检测到rootkit 时给root 发一封邮件。</span></p>
<p><span class="command"><strong>把给root 用户的系统邮件转发的管理员的gmail 邮箱</strong></span></p>
<p><span class="command">虽然可以登陆到系统去看系统邮件，但显然能用gmail 查看是更方便的选择。<br />
1.安装sendmail 邮件转发要用到sendmail，<br />
# yum sendmail<br />
# /etc/intit.d/sendmail start (sendmail服务)</span><span class="command"><br />
2.设置转发，编辑/etc/aliases，在文件最后加入<br />
root: <a href="mailto:youname@gmail.com">youname@gmail.com</a> 然后运行newaliases 命令更新aliases<br />
 这样系统就会把给root 的邮件转发的你gmail 邮箱里去了。</span></p>
<p><span class="command">本文中严重参考<a title="入侵监测系统的构建（ chkrootkit ）" href="http://www.centospub.com/make/chkrootkit.html" target="_blank"><strong>入侵监测系统的构建（ chkrootkit ）</strong></a> 一文，感谢该文作者的工作。</span></p>
<h2  class="related_post_title">其他大家爱看的文字</h2><ul class="related_post"><li><a href="http://www.linuxbyte.org/ubuntu-810-anzhuang-peizhi.html" title="ubuntu 8.10 安装配置小记">ubuntu 8.10 安装配置小记</a></li><li><a href="http://www.linuxbyte.org/ubuntu-9-10-xia-tian-jia-xp-yin-dao.html" title="Ubuntu 9.10 下添加XP 引导">Ubuntu 9.10 下添加XP 引导</a></li><li><a href="http://www.linuxbyte.org/zeng-jia-ping-lun-qian-tao.html" title="增加评论嵌套">增加评论嵌套</a></li><li><a href="http://www.linuxbyte.org/gai-shan-chromium-zai-linux-xia-de-zi-ti.html" title="改善chromium 在linux 下的字体">改善chromium 在linux 下的字体</a></li><li><a href="http://www.linuxbyte.org/novell-acquire-platespin.html" title="Novell收购虚拟管理软件厂商PlateSpin ">Novell收购虚拟管理软件厂商PlateSpin </a></li><li><a href="http://www.linuxbyte.org/pidgin-240-released.html" title="Pidgin 2.4.0 发布">Pidgin 2.4.0 发布</a></li><li><a href="http://www.linuxbyte.org/bash-quick-reference-bash-redirection.html" title="Bash的输入输出重定向">Bash的输入输出重定向</a></li><li><a href="http://www.linuxbyte.org/opengl-3_0.html" title="OpenGL 3.0规范正式发布">OpenGL 3.0规范正式发布</a></li><li><a href="http://www.linuxbyte.org/tips-for-apache-php-security.html" title="apache,php安全小技巧">apache,php安全小技巧</a></li><li><a href="http://www.linuxbyte.org/selinux-howto.html" title=" SELinux 的howto文档下载"> SELinux 的howto文档下载</a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2008<br />
Source: <a href="http://www.linuxbyte.org/chkrootkit-minihowto.html">使用chkrootkit工具保护服务器</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/chkrootkit" rel="tag">chkrootkit</a><br/>
</small></p>
	<p style="margin:3px 0 0 0;">标签：<a href="http://www.linuxbyte.org/tag/chkrootkit" title="chkrootkit" rel="tag">chkrootkit</a></p>

<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/chkrootkit-minihowto.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

