<?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>Tue, 22 Jun 2010 15:10:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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 &#8220;chkrootkit report in `hostname`&#8221; 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>
<h3  class="related_post_title">其他大家爱看的文字</h3><ul class="related_post"><li><a href="http://www.linuxbyte.org/haiku-os-opensource-beos.html" title="Haiku OS项目要以开源形式促BeOS复兴">Haiku OS项目要以开源形式促BeOS复兴</a></li><li><a href="http://www.linuxbyte.org/install-ubuntu-8_0_4-from-harddisk.html" title="硬盘安装ubuntu 8.04">硬盘安装ubuntu 8.04</a></li><li><a href="http://www.linuxbyte.org/firefox-de-shu-biao-shou-shi-cha-jian-firegestures.html" title="Firefox 的鼠标手势插件FireGestures">Firefox 的鼠标手势插件FireGestures</a></li><li><a href="http://www.linuxbyte.org/debian-gnulinux-50-fa-bu.html" title="Debian GNU/Linux 5.0 发布 ">Debian GNU/Linux 5.0 发布 </a></li><li><a href="http://www.linuxbyte.org/gnu-gpl-v2-en.html" title="GNU GENERAL PUBLIC LICENSE Version 2 (en)">GNU GENERAL PUBLIC LICENSE Version 2 (en)</a></li><li><a href="http://www.linuxbyte.org/sexy-ubunut-girls-wallpapers.html" title="性感ubuntu 壁纸">性感ubuntu 壁纸</a></li><li><a href="http://www.linuxbyte.org/magiclinux-2_1-beta2.html" title="MagicLinux 2.1 Beta2 发布">MagicLinux 2.1 Beta2 发布</a></li><li><a href="http://www.linuxbyte.org/free-vpn.html" title="free vpn">free vpn</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 />
<a href="http://www.linuxbyte.org/chkrootkit-minihowto.html#comments">One comment</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/chkrootkit" rel="tag">chkrootkit</a><br/>
</small></p>
	标签：<a href="http://www.linuxbyte.org/tag/chkrootkit" title="chkrootkit" rel="tag">chkrootkit</a><br />

	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li>无相关日志</li>
	</ul>


<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>
