<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/css" href="./clientscript/vbulletin_css/rsstyle.css"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>LinuxSir.Org - Linux 网络与服务器架设</title>
		<link>http://www.linuxsir.org/bbs</link>
		<description>企鹅家族之强项，Web服务器、Ftp服务器 、域名服务器、邮件服务器、代理服务器等</description>
		<language>zh</language>
		<lastBuildDate>Wed, 08 Sep 2010 22:46:09 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.linuxsir.org/bbs/images/misc/rss.jpg</url>
			<title>LinuxSir.Org - Linux 网络与服务器架设</title>
			<link>http://www.linuxsir.org/bbs</link>
		</image>
		<item>
			<title>求ssh mysql 验证用户登录解决方案</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=372061&amp;goto=newpost</link>
			<pubDate>Tue, 07 Sep 2010 12:55:35 GMT</pubDate>
			<description>最近看到过一篇文章是讲openvpn pam mysql 验证用户登录，以及限制用户使用流量。
那么有没有类似的方式比如 用pam_mysql插件同步mysql数据库里的用户信息，来验证登录到openssh所搭建的服务器上去。
那为达人有这方面的经验或者解决方案啊，可以详聊 :)

谢谢先～</description>
			<content:encoded><![CDATA[<div>最近看到过一篇文章是讲openvpn pam mysql 验证用户登录，以及限制用户使用流量。<br />
那么有没有类似的方式比如 用pam_mysql插件同步mysql数据库里的用户信息，来验证登录到openssh所搭建的服务器上去。<br />
那为达人有这方面的经验或者解决方案啊，可以详聊 :)<br />
<br />
谢谢先～</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>laoladen</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=372061</guid>
		</item>
		<item>
			<title>vsftpd + mysql 问题？</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=372052&amp;goto=newpost</link>
			<pubDate>Tue, 07 Sep 2010 07:12:42 GMT</pubDate>
			<description>我搭了个vsftpd,想通过mysql虚拟用户认证，在网上找了很多 帖子的认证方法，总是 过不去 ，不知道 为什么。我的系统是LFS 6.6</description>
			<content:encoded><![CDATA[<div>我搭了个vsftpd,想通过mysql虚拟用户认证，在网上找了很多 帖子的认证方法，总是 过不去 ，不知道 为什么。我的系统是LFS 6.6</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>xcrdjn</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=372052</guid>
		</item>
		<item>
			<title>知道 IP 能知道物理实机是那台吗？</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=372051&amp;goto=newpost</link>
			<pubDate>Tue, 07 Sep 2010 05:52:17 GMT</pubDate>
			<description>局域网 太大 ，知道 IP地址，但 不知道 是那台机器，有方法可以找到 机器吗？</description>
			<content:encoded><![CDATA[<div>局域网 太大 ，知道 IP地址，但 不知道 是那台机器，有方法可以找到 机器吗？</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>xcrdjn</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=372051</guid>
		</item>
		<item>
			<title>刀片机上双网卡绑定的问题</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371981&amp;goto=newpost</link>
			<pubDate>Fri, 03 Sep 2010 10:39:14 GMT</pubDate>
			<description>hp bl460c g6配备两个内置的交换机，分别用光纤连接到同一防火墙；
刀片上的系统有windows2008、EHRL5和RHEL4，都做了双网卡绑定；
现在拔出一台交换机上的光纤以后，windows2008可以切换到另一台交换机上，但是rhel不能切换。

配置没有问题，因为旁边的PC服务器DL380G6使用同样的配置，可以实现切换。

如果说是刀片服务器的问题，windows2008可以切换。

我查了一下，据说linux bond的监控方式有两种:mii和arp，前者基本上没有使用了，而且据说新的设备也不再支持。

请问有没有谁遇到过类似的问题，怎么解决的。</description>
			<content:encoded><![CDATA[<div>hp bl460c g6配备两个内置的交换机，分别用光纤连接到同一防火墙；<br />
刀片上的系统有windows2008、EHRL5和RHEL4，都做了双网卡绑定；<br />
现在拔出一台交换机上的光纤以后，windows2008可以切换到另一台交换机上，但是rhel不能切换。<br />
<br />
配置没有问题，因为旁边的PC服务器DL380G6使用同样的配置，可以实现切换。<br />
<br />
如果说是刀片服务器的问题，windows2008可以切换。<br />
<br />
我查了一下，据说linux bond的监控方式有两种:mii和arp，前者基本上没有使用了，而且据说新的设备也不再支持。<br />
<br />
请问有没有谁遇到过类似的问题，怎么解决的。</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>alonersir</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371981</guid>
		</item>
		<item>
			<title>lamp中将mysql分离作为独立的服务器。。。</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371953&amp;goto=newpost</link>
			<pubDate>Thu, 02 Sep 2010 07:47:50 GMT</pubDate>
			<description>恩。。。新手报到，还希望各位多多帮助啦。。。
恩。。。lamp中的mysql可以用一个独立的mysql服务器来担当吗？？？lamp中的mysql和apche，php都是集成在一台机子上的，我想把mysql独立出来可以吗？
那该怎样做呢？我在网上都没有找到相关的资料介绍这种做法，怀疑或许是我不会搜索，不知道这是一种什么模式环境。。。
哪位知道的话，希望得到帮助！！！在这里先谢谢了。。。</description>
			<content:encoded><![CDATA[<div>恩。。。新手报到，还希望各位多多帮助啦。。。<br />
恩。。。lamp中的mysql可以用一个独立的mysql服务器来担当吗？？？lamp中的mysql和apche，php都是集成在一台机子上的，我想把mysql独立出来可以吗？<br />
那该怎样做呢？我在网上都没有找到相关的资料介绍这种做法，怀疑或许是我不会搜索，不知道这是一种什么模式环境。。。<br />
哪位知道的话，希望得到帮助！！！在这里先谢谢了。。。</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>handyjue</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371953</guid>
		</item>
		<item>
			<title>把tomcat设置成系统服务，无法设置JVM值请高手指点</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371950&amp;goto=newpost</link>
			<pubDate>Thu, 02 Sep 2010 06:48:05 GMT</pubDate>
			<description>我参考下面网址做的
http://hi.baidu.com/netwrom/blog/item/9b2fe8f90a157601d9f9fdb7.html

一切都正常。tomcat可以正常启动和关闭。可是以前我在catalina.sh里面设置的JVM值没有了变成初始值了。

如果不按照系统服务的方式启动就一切正常
系统服务/etc/init.d/tomcat

原始启动/usr/tomcat/startup.sh</description>
			<content:encoded><![CDATA[<div>我参考下面网址做的<br />
<a href="http://hi.baidu.com/netwrom/blog/item/9b2fe8f90a157601d9f9fdb7.html" target="_blank">http://hi.baidu.com/netwrom/blog/ite...1d9f9fdb7.html</a><br />
<br />
一切都正常。tomcat可以正常启动和关闭。可是以前我在catalina.sh里面设置的JVM值没有了变成初始值了。<br />
<br />
如果不按照系统服务的方式启动就一切正常<br />
系统服务/etc/init.d/tomcat<br />
<br />
原始启动/usr/tomcat/startup.sh</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>Netwrom</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371950</guid>
		</item>
		<item>
			<title>发一个用inotify监控apache的脚本</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371880&amp;goto=newpost</link>
			<pubDate>Sun, 29 Aug 2010 09:01:31 GMT</pubDate>
			<description><![CDATA[#!/bin/bash
#Author:windydays
#Date : 2010/8/29
#用于监控apache，如果退出就自动重启apache，原理是如果apache退出，则apache的pid文件会被close，或触发attrib事件，
#只要用inotify监控这个事件，然后重启apache，再重新监控pid文件即可。
#使用方法：用root权放到后台运行即可。
#停止方法：sudo pkill inotifywait.
pid_file=/var/run/apache2.pid 
mon_log=/var/log/apache2/monitor-apache.sh.log
if ! [ -f $pid_file ] ; then
		echo 'pid file does NOT exist! maybe it is somewhere else or
		service is
		down now.' >>$mon_log;
		exit 1 ;
fi
#如果apache没有出问题，会阻塞在下面这里.
inotifywait -q -e close $pid_file >>$mon_log;
exit_code=$?;
echo "At $(date)" >>$mon_log;
#如果#?不等于0说明inotifywait不正常退出。
if  [ $exit_code = 0 ];then 
		/etc/init.d/apache2 restart
		sleep 8;
		exec $0;
fi]]></description>
			<content:encoded><![CDATA[<div>#!/bin/bash<br />
#Author:windydays<br />
#Date : 2010/8/29<br />
#用于监控apache，如果退出就自动重启apache，原理是如果apache退出，则apache的pid文件会被close，或触发attrib事件，<br />
#只要用inotify监控这个事件，然后重启apache，再重新监控pid文件即可。<br />
#使用方法：用root权放到后台运行即可。<br />
#停止方法：sudo pkill inotifywait.<br />
pid_file=/var/run/apache2.pid <br />
mon_log=/var/log/apache2/monitor-apache.sh.log<br />
if ! [ -f $pid_file ] ; then<br />
		echo 'pid file does NOT exist! maybe it is somewhere else or<br />
		service is<br />
		down now.' &gt;&gt;$mon_log;<br />
		exit 1 ;<br />
fi<br />
#如果apache没有出问题，会阻塞在下面这里.<br />
inotifywait -q -e close $pid_file &gt;&gt;$mon_log;<br />
exit_code=$?;<br />
echo &quot;At $(date)&quot; &gt;&gt;$mon_log;<br />
#如果#?不等于0说明inotifywait不正常退出。<br />
if  [ $exit_code = 0 ];then <br />
		/etc/init.d/apache2 restart<br />
		sleep 8;<br />
		exec $0;<br />
fi</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>windydays</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371880</guid>
		</item>
		<item>
			<title>php中查询是否支持php-mbstring和php-gd？</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371772&amp;goto=newpost</link>
			<pubDate>Tue, 24 Aug 2010 09:24:53 GMT</pubDate>
			<description>除了用phpinfo（）函数外，在php.ini中如何确认是否支持php-mbstring 和php-gd？谢谢</description>
			<content:encoded><![CDATA[<div>除了用phpinfo（）函数外，在php.ini中如何确认是否支持php-mbstring 和php-gd？谢谢</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>qingheliu</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371772</guid>
		</item>
		<item>
			<title>samba共享的问题</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371726&amp;goto=newpost</link>
			<pubDate>Mon, 23 Aug 2010 08:06:06 GMT</pubDate>
			<description>我想实现这个功能：匿名用户可以查看//IP,浏览共享资源，但是只能看共享文件，要浏览财务部或人事部，就必须要输入对应部门的人员和密码才能进入。

因为有个公共文件夹，所以security=share，但这样的话，进入加密文件夹就不能输入用户名了。不知道这种如何解决？
谢谢</description>
			<content:encoded><![CDATA[<div>我想实现这个功能：匿名用户可以查看//IP,浏览共享资源，但是只能看共享文件，要浏览财务部或人事部，就必须要输入对应部门的人员和密码才能进入。<br />
<br />
因为有个公共文件夹，所以security=share，但这样的话，进入加密文件夹就不能输入用户名了。不知道这种如何解决？<br />
谢谢</div>


	<br />
	<div style="padding:4px">
	
	

	
	
	
		<fieldset class="fieldset">
			<legend>上传的图像</legend>
			<table cellpadding="0" cellspacing="1" border="0">
			<tr>
	<td><img class="inlineimg" src="http://www.linuxsir.org/bbs/images/attach/png.gif" alt="文件类型: png" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
 <!-- PHPForce - Joey修改附件隐藏 -->
 	
 	<td><a href="http://www.linuxsir.org/bbs/attachment.php?attachmentid=55968&amp;d=1282550721" target="_blank">Windows XP Professional-2010-08-23-15-32-19.png</a> (34.0 KB, 无 次查看)

</td>
 	
 <!-- /PHPForce - Joey修改附件隐藏 -->


 </tr><tr>
	<td><img class="inlineimg" src="http://www.linuxsir.org/bbs/images/attach/png.gif" alt="文件类型: png" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
 <!-- PHPForce - Joey修改附件隐藏 -->
 	
 	<td><a href="http://www.linuxsir.org/bbs/attachment.php?attachmentid=55969&amp;d=1282550721" target="_blank">192.168.116.130-2010-08-23-16-04-48.png</a> (60.1 KB, 无 次查看)

</td>
 	
 <!-- /PHPForce - Joey修改附件隐藏 -->


 </tr><tr>
	<td><img class="inlineimg" src="http://www.linuxsir.org/bbs/images/attach/png.gif" alt="文件类型: png" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
 <!-- PHPForce - Joey修改附件隐藏 -->
 	
 	<td><a href="http://www.linuxsir.org/bbs/attachment.php?attachmentid=55970&amp;d=1282550963" target="_blank">Windows XP Professional-2010-08-23-16-08-49.png</a> (34.7 KB, 无 次查看)

</td>
 	
 <!-- /PHPForce - Joey修改附件隐藏 -->


 </tr>
			</table>
			</fieldset>
	
	
	
	
	</div>
]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>波波洛克</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371726</guid>
		</item>
		<item>
			<title>NFS服务器如何配置使用tcp协议？</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371680&amp;goto=newpost</link>
			<pubDate>Sat, 21 Aug 2010 01:27:59 GMT</pubDate>
			<description>我想在公网搭建一个nfs服务器
但是不了解如何配置nfs的tcp协议
哪里有专门介绍这个的资料？
感谢帮助！</description>
			<content:encoded><![CDATA[<div>我想在公网搭建一个nfs服务器<br />
但是不了解如何配置nfs的tcp协议<br />
哪里有专门介绍这个的资料？<br />
感谢帮助！</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>tsuibin</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371680</guid>
		</item>
		<item>
			<title>dns 问题（已经解）</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371581&amp;goto=newpost</link>
			<pubDate>Tue, 17 Aug 2010 09:15:44 GMT</pubDate>
			<description><![CDATA[主要是语法问题，多亏了webmin软件帮我检查语法。


neo@gentoo /etc/bind $ host www.testdns.com
Host www.testdns.com not found: 2(SERVFAIL)

named.conf

options {
      directory "/var/bind";
};

zone "." IN {
      type hint;
      file "pri/named.ca";

};

zone "localhost" IN {
       type master;
       file "pri/localhost.zone";
       allow-update { none; };
};

zone "0.0.127.in-addr.arap" IN {
       type master;
       file "pri/127.zone";
       allow-update { none; };
};

zone "testdns.com" IN {
       type master;
       file "pri/testdns.com.dns";
       allow-update { none; };

};

zone "0.168.192.in-addr.arpa" IN {
       type master;
       file "pri/testdns.com.rev";
       allow-update { none; };
};

logging {
        channel default_syslog {
        file "/var/log/named/named.log" versions 3 size 5m;
        severity debug;
        print-time yes;
        print-severity yes;
        print-category yes;
};
category default { default_syslog; };
};
include "/etc/bind/rndc.key";



testdns.com.dns

$TTL 86400
$ORIGIN testdns.com.
@ IN SOA testdns.com. root.testdns.com. (
         20081103;  serial
         120;       refresh
         14400;     retry
         3600000;   expiry
         86400);    minimum

         IN NS testdns.com.
dns      IN A 192.168.0.2
www      IN A 192.168.0.2



testdns.com.rev

$TTL 86400
$ORIGIN testdns.com.
@ IN SOA testdns.com. root.testdns.com. (
         20081103;  serial
         120;       refresh
         14400;     retry
         3600000;   expiry
         86400 );    minimum

         IN NS testdns.com.
2        IN PTR dns.testdns.com.
2        IN PTR www.testdns.com.]]></description>
			<content:encoded><![CDATA[<div>主要是语法问题，多亏了webmin软件帮我检查语法。<br />
<br />
<br />
neo@gentoo /etc/bind $ host <a href="http://www.testdns.com" target="_blank">www.testdns.com</a><br />
Host <a href="http://www.testdns.com" target="_blank">www.testdns.com</a> not found: 2(SERVFAIL)<br />
<br />
named.conf<br />
<br />
options {<br />
      directory &quot;/var/bind&quot;;<br />
};<br />
<br />
zone &quot;.&quot; IN {<br />
      type hint;<br />
      file &quot;pri/named.ca&quot;;<br />
<br />
};<br />
<br />
zone &quot;localhost&quot; IN {<br />
       type master;<br />
       file &quot;pri/localhost.zone&quot;;<br />
       allow-update { none; };<br />
};<br />
<br />
zone &quot;0.0.127.in-addr.arap&quot; IN {<br />
       type master;<br />
       file &quot;pri/127.zone&quot;;<br />
       allow-update { none; };<br />
};<br />
<br />
zone &quot;testdns.com&quot; IN {<br />
       type master;<br />
       file &quot;pri/testdns.com.dns&quot;;<br />
       allow-update { none; };<br />
<br />
};<br />
<br />
zone &quot;0.168.192.in-addr.arpa&quot; IN {<br />
       type master;<br />
       file &quot;pri/testdns.com.rev&quot;;<br />
       allow-update { none; };<br />
};<br />
<br />
logging {<br />
        channel default_syslog {<br />
        file &quot;/var/log/named/named.log&quot; versions 3 size 5m;<br />
        severity debug;<br />
        print-time yes;<br />
        print-severity yes;<br />
        print-category yes;<br />
};<br />
category default { default_syslog; };<br />
};<br />
include &quot;/etc/bind/rndc.key&quot;;<br />
<br />
<br />
<br />
testdns.com.dns<br />
<br />
$TTL 86400<br />
$ORIGIN testdns.com.<br />
@ IN SOA testdns.com. root.testdns.com. (<br />
         20081103;  serial<br />
         120;       refresh<br />
         14400;     retry<br />
         3600000;   expiry<br />
         86400);    minimum<br />
<br />
         IN NS testdns.com.<br />
dns      IN A 192.168.0.2<br />
www      IN A 192.168.0.2<br />
<br />
<br />
<br />
testdns.com.rev<br />
<br />
$TTL 86400<br />
$ORIGIN testdns.com.<br />
@ IN SOA testdns.com. root.testdns.com. (<br />
         20081103;  serial<br />
         120;       refresh<br />
         14400;     retry<br />
         3600000;   expiry<br />
         86400 );    minimum<br />
<br />
         IN NS testdns.com.<br />
2        IN PTR dns.testdns.com.<br />
2        IN PTR <a href="http://www.testdns.com" target="_blank">www.testdns.com</a>.</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>tianfeng0418</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371581</guid>
		</item>
		<item>
			<title>apache的安全增强配置(使用mod_chroot,mod_security)</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371580&amp;goto=newpost</link>
			<pubDate>Tue, 17 Aug 2010 08:36:02 GMT</pubDate>
			<description><![CDATA[原文还发在 http://blog.csdn.net/helonghe/archive/2010/08/17/5817850.aspx
linuxsir上高手真多，希望大家指教

                  apache的安全增强配置(使用mod_chroot,mod_security)
                                        作者：windydays 2010/8/17   
        LAMP环境的一般入侵，大致经过sql注入，上传webshell，本地提权至root，安装rootkit等步骤。采用如下的配置，mod_chroot和

单独分区挂载可以 让本地提权变得极为困难，而mod-security可以封堵一般的sql注入等应用层攻击。

        以下内容是在ubuntu10.04上实践以后总结出来的,直接上命令，就不做过多解释了，水平有限，错误在所难免，欢迎指正。首先确保

apache,php,mysql已经正常工作,出现问题的话，查看/var/log/apache2, /var/log/syslog,/var/log/mysql/error.log 尤其是apparmor导致的

权限错误，不易发现。


1.mod_chroot的安装，配置
目标是chroot到/var/www。
(1) 安装:
                sudo service apache2 stop
                sudo apt-get libapache2-mod-chroot
                sudo vi /etc/apache2/mod-available/mod_chroot.conf
                内容为
                        <IfModule mod_chroot.c>
                           LoadFile /lib/libgcc_s.so.1
                           ChrootDir /var/www
                         </IfModule>

                sudo a2enmod mod_chroot
                /etc/apache2/site-enabled/000-default 中DocumentRoot 改为 /
                sudo ln -s /var/www/var/run/apache2.pid /var/run/apache2.pid
                并把
                        ln -s /var/www/var/run/apache2.pid /var/run/apache2.pid
                加到/etc/rc.local中
                sudo mkdir /var/www/tmp # 放session
                sudo chmod 1777 tmp 
                sudo mkdir -p /var/www/var/run/mysqld
                sudo ln -s / /var/www/var/www
安装好apache,静态页面和php正常后，弄mysql
1),sudo service mysql stop.
2).改/etc/apparmor.d/usr.sbin.mysqld，
        把"/var/run/mysqld.sock w," 那一行复制并改为
        "/var/www/var/run/mysqld.sock w,"
3),改/etc/mysql/my.cnf 
        在[client],[mysqld_safe],[mysqld]每一节里socket路径改为
        "socket  = /var/www/var/run/mysqld/mysqld.sock"
4),sudo service mysql start.

一些其他问题
        date()不正常，解决办法：
                sudo mkdir -p /var/www/usr/share /var/www/etc
                sudo cp -rp /usr/share/zoneinfo /var/www/usr/share/
                sudo cp /etc/localtime /var/www/etc/
        DNS可能出问题(没试过)
                sudo cp /etc/resolv.conf /var/www/etc/resolv.conf
        找不到错误页面
                sudo cp -rp  /usr/share/apache2/ /var/www/usr/share/


2.mod_security的安装，配置
        安装
        sudo aptitude install libapache2-mod-security2
        sudo cp /usr/share/doc/mod-security-common/examples/rules/modsecurity_crs_10_config.conf   /etc/apache2/mods-enabled/mod-security.conf
        sudo a2enmod mod-security
        sudo apache2ctl stop
        修改/etc/apache2/mods-available/mod-security.conf中的debug_log和audit_log路径到合适的位置，并添加如下两行

                Include /usr/share/doc/mod-security-common/examples/rules/modsecurity_crs_10_global_config.conf
                Include /usr/share/doc/mod-security-common/examples/rules/base_rules/*.conf

        sudo apache2ctl start
        #/usr/share/doc/mod-security-common/examples/rules/目录下还有一些规则可用
        另外，参照gentoo的ebuild中的如下内容（http://gentoo-portage.com/www-apache/mod_security/ChangeLog）
               if ! use vanilla; then
		       mv "${D}"${APACHE_MODULES_CONFDIR}/mod_security/modsecurity_*{41_phpids,50_outbound}* \
			     "${D}"${APACHE_MODULES_CONFDIR}/mod_security/optional_rules || die
	        fi
        modsecurity_*{41_phpids,50_outbound}* 的这几个规则还是不要用比较好。



3.另外，可以把/var/www/放在一个单独的分区上，用noexec,nosuid,nodev参数挂载,打开mysql的apparmor,可以极大增强安全性。

参考资料：
        /usr/share/doc/mod-chroot-common/
        http://core.segfault.pl/~hobbit/mod_chroot/index.html
        http://server.it168.com/a2010/0714/1077/000001077357.shtml
        http://www.howtoforge.com/chrooting-apache2-mod-chroot-debian-etch
        /usr/share/doc/mod-security-common
我的邮箱是 lh2008999 at gmail.com 欢迎交流]]></description>
			<content:encoded><![CDATA[<div>原文还发在 <a href="http://blog.csdn.net/helonghe/archive/2010/08/17/5817850.aspx" target="_blank">http://blog.csdn.net/helonghe/archiv...7/5817850.aspx</a><br />
linuxsir上高手真多，希望大家指教<br />
<br />
                  apache的安全增强配置(使用mod_chroot,mod_security)<br />
                                        作者：windydays 2010/8/17   <br />
        LAMP环境的一般入侵，大致经过sql注入，上传webshell，本地提权至root，安装rootkit等步骤。采用如下的配置，mod_chroot和<br />
<br />
单独分区挂载可以 让本地提权变得极为困难，而mod-security可以封堵一般的sql注入等应用层攻击。<br />
<br />
        以下内容是在ubuntu10.04上实践以后总结出来的,直接上命令，就不做过多解释了，水平有限，错误在所难免，欢迎指正。首先确保<br />
<br />
apache,php,mysql已经正常工作,出现问题的话，查看/var/log/apache2, /var/log/syslog,/var/log/mysql/error.log 尤其是apparmor导致的<br />
<br />
权限错误，不易发现。<br />
<br />
<br />
1.mod_chroot的安装，配置<br />
目标是chroot到/var/www。<br />
(1) 安装:<br />
                sudo service apache2 stop<br />
                sudo apt-get libapache2-mod-chroot<br />
                sudo vi /etc/apache2/mod-available/mod_chroot.conf<br />
                内容为<br />
                        &lt;IfModule mod_chroot.c&gt;<br />
                           LoadFile /lib/libgcc_s.so.1<br />
                           ChrootDir /var/www<br />
                         &lt;/IfModule&gt;<br />
<br />
                sudo a2enmod mod_chroot<br />
                /etc/apache2/site-enabled/000-default 中DocumentRoot 改为 /<br />
                sudo ln -s /var/www/var/run/apache2.pid /var/run/apache2.pid<br />
                并把<br />
                        ln -s /var/www/var/run/apache2.pid /var/run/apache2.pid<br />
                加到/etc/rc.local中<br />
                sudo mkdir /var/www/tmp # 放session<br />
                sudo chmod 1777 tmp <br />
                sudo mkdir -p /var/www/var/run/mysqld<br />
                sudo ln -s / /var/www/var/www<br />
安装好apache,静态页面和php正常后，弄mysql<br />
1),sudo service mysql stop.<br />
2).改/etc/apparmor.d/usr.sbin.mysqld，<br />
        把&quot;/var/run/mysqld.sock w,&quot; 那一行复制并改为<br />
        &quot;/var/www/var/run/mysqld.sock w,&quot;<br />
3),改/etc/mysql/my.cnf <br />
        在[client],[mysqld_safe],[mysqld]每一节里socket路径改为<br />
        &quot;socket  = /var/www/var/run/mysqld/mysqld.sock&quot;<br />
4),sudo service mysql start.<br />
<br />
一些其他问题<br />
        date()不正常，解决办法：<br />
                sudo mkdir -p /var/www/usr/share /var/www/etc<br />
                sudo cp -rp /usr/share/zoneinfo /var/www/usr/share/<br />
                sudo cp /etc/localtime /var/www/etc/<br />
        DNS可能出问题(没试过)<br />
                sudo cp /etc/resolv.conf /var/www/etc/resolv.conf<br />
        找不到错误页面<br />
                sudo cp -rp  /usr/share/apache2/ /var/www/usr/share/<br />
<br />
<br />
2.mod_security的安装，配置<br />
        安装<br />
        sudo aptitude install libapache2-mod-security2<br />
        sudo cp /usr/share/doc/mod-security-common/examples/rules/modsecurity_crs_10_config.conf   /etc/apache2/mods-enabled/mod-security.conf<br />
        sudo a2enmod mod-security<br />
        sudo apache2ctl stop<br />
        修改/etc/apache2/mods-available/mod-security.conf中的debug_log和audit_log路径到合适的位置，并添加如下两行<br />
<br />
                Include /usr/share/doc/mod-security-common/examples/rules/modsecurity_crs_10_global_config.conf<br />
                Include /usr/share/doc/mod-security-common/examples/rules/base_rules/*.conf<br />
<br />
        sudo apache2ctl start<br />
        #/usr/share/doc/mod-security-common/examples/rules/目录下还有一些规则可用<br />
        另外，参照gentoo的ebuild中的如下内容（<a href="http://gentoo-portage.com/www-apache/mod_security/ChangeLog）" target="_blank">http://gentoo-portage.com/www-apache...y/ChangeLog）</a><br />
               if ! use vanilla; then<br />
		       mv &quot;${D}&quot;${APACHE_MODULES_CONFDIR}/mod_security/modsecurity_*{41_phpids,50_outbound}* \<br />
			     &quot;${D}&quot;${APACHE_MODULES_CONFDIR}/mod_security/optional_rules || die<br />
	        fi<br />
        modsecurity_*{41_phpids,50_outbound}* 的这几个规则还是不要用比较好。<br />
<br />
<br />
<br />
3.另外，可以把/var/www/放在一个单独的分区上，用noexec,nosuid,nodev参数挂载,打开mysql的apparmor,可以极大增强安全性。<br />
<br />
参考资料：<br />
        /usr/share/doc/mod-chroot-common/<br />
        <a href="http://core.segfault.pl/~hobbit/mod_chroot/index.html" target="_blank">http://core.segfault.pl/~hobbit/mod_chroot/index.html</a><br />
        <a href="http://server.it168.com/a2010/0714/1077/000001077357.shtml" target="_blank">http://server.it168.com/a2010/0714/1...01077357.shtml</a><br />
        <a href="http://www.howtoforge.com/chrooting-apache2-mod-chroot-debian-etch" target="_blank">http://www.howtoforge.com/chrooting-...ot-debian-etch</a><br />
        /usr/share/doc/mod-security-common<br />
我的邮箱是 lh2008999 at gmail.com 欢迎交流</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>windydays</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371580</guid>
		</item>
		<item>
			<title>mysql下“诡异”的问题</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371558&amp;goto=newpost</link>
			<pubDate>Mon, 16 Aug 2010 13:27:37 GMT</pubDate>
			<description>为什么删除order表提示语法错误，删除其他的表都正常，谢谢</description>
			<content:encoded><![CDATA[<div>为什么删除order表提示语法错误，删除其他的表都正常，谢谢</div>


	<br />
	<div style="padding:4px">
	
	

	
	
	
		<fieldset class="fieldset">
			<legend>上传的图像</legend>
			<table cellpadding="0" cellspacing="1" border="0">
			<tr>
	<td><img class="inlineimg" src="http://www.linuxsir.org/bbs/images/attach/jpg.gif" alt="文件类型: jpg" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
 <!-- PHPForce - Joey修改附件隐藏 -->
 	
 	<td><a href="http://www.linuxsir.org/bbs/attachment.php?attachmentid=55931&amp;d=1281965247" target="_blank">2010-08-16_212423.jpg</a> (76.6 KB, 无 次查看)

</td>
 	
 <!-- /PHPForce - Joey修改附件隐藏 -->


 </tr>
			</table>
			</fieldset>
	
	
	
	
	</div>
]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>qingheliu</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371558</guid>
		</item>
		<item>
			<title>EPOLL 单线程压力问题（求教）</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371543&amp;goto=newpost</link>
			<pubDate>Mon, 16 Aug 2010 02:21:53 GMT</pubDate>
			<description>现在要做一个服务器程序，最多会被200个客户端连接，客户端每隔1秒会发一条最大1400的数据，求教，我用EPOLL 单线程监听所有客户端，只读数据存入链表，200个客户端会有累计延时的情况发生吗（服务器只需要读取客户端的数据，不需要写）</description>
			<content:encoded><![CDATA[<div>现在要做一个服务器程序，最多会被200个客户端连接，客户端每隔1秒会发一条最大1400的数据，求教，我用EPOLL 单线程监听所有客户端，只读数据存入链表，200个客户端会有累计延时的情况发生吗（服务器只需要读取客户端的数据，不需要写）</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>mochouxiyan</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371543</guid>
		</item>
		<item>
			<title>apache中有没有针对php网站攻击的模块？</title>
			<link>http://www.linuxsir.org/bbs/showthread.php?t=371485&amp;goto=newpost</link>
			<pubDate>Fri, 13 Aug 2010 08:40:43 GMT</pubDate>
			<description>apache中有没有针对php网站攻击的模块？
谢谢兄弟们</description>
			<content:encoded><![CDATA[<div>apache中有没有针对php网站攻击的模块？<br />
谢谢兄弟们</div>

]]></content:encoded>
			<category domain="http://www.linuxsir.org/bbs/forumdisplay.php?f=32">Linux 网络与服务器架设</category>
			<dc:creator>qingheliu</dc:creator>
			<guid isPermaLink="true">http://www.linuxsir.org/bbs/showthread.php?t=371485</guid>
		</item>
	</channel>
</rss>
