<?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>4520</title>
	<atom:link href="http://www.4520.info/feed" rel="self" type="application/rss+xml" />
	<link>http://www.4520.info</link>
	<description>我的点点滴滴</description>
	<lastBuildDate>Thu, 22 Mar 2012 14:16:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>禁用thinkpad笔记本Fn+空格键的屏幕放大功能</title>
		<link>http://www.4520.info/post/381</link>
		<comments>http://www.4520.info/post/381#comments</comments>
		<pubDate>Thu, 22 Mar 2012 14:15:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[资源交流]]></category>

		<guid isPermaLink="false">http://www.4520.info/?p=381</guid>
		<description><![CDATA[thinkpad有个屏幕分辨率调整功能，快捷键是Fn+空格键，然而，中英文输入法切换的快捷键是Ctrl+空格键，我们在打字的时候经常会按到Fn键，让人非常郁闷，而且桌面图标由于分辨率的变化排序会错乱，很是头疼。 教大家一招，解决这个问题： 打开任务管理器关闭进程 TpScrex.exe 搜索文件TpScrex.exe，一般位于C:\Program Files\Lenovo\ZOOM 或者 C:\DRIVERS\WIN\HOTKEY\ZOOM 或者 C:\Program Files\Lenovo\PkgMgr\HOTKEY_1，将其改名即可。 这个方法会屏蔽Fn+空格键的屏幕放大功能，对Fn的其他快捷键没有影响。 声明: 本文采用 BY-NC-SA 协议进行授权 &#124; 4520转载请注明转自《禁用thinkpad笔记本Fn+空格键的屏幕放大功能》]]></description>
			<content:encoded><![CDATA[<p>thinkpad有个屏幕分辨率调整功能，快捷键是Fn+空格键，然而，中英文输入法切换的快捷键是Ctrl+空格键，我们在打字的时候经常会按到Fn键，让人非常郁闷，而且桌面图标由于分辨率的变化排序会错乱，很是头疼。</p>
<p>教大家一招，解决这个问题：<br />
打开任务管理器关闭进程 TpScrex.exe<br />
搜索文件TpScrex.exe，一般位于C:\Program Files\Lenovo\ZOOM</p>
<p>或者 C:\DRIVERS\WIN\HOTKEY\ZOOM</p>
<p>或者 C:\Program Files\Lenovo\PkgMgr\HOTKEY_1，将其改名即可。<br />
这个方法会屏蔽Fn+空格键的屏幕放大功能，对Fn的其他快捷键没有影响。</p>
<p><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 本文采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">BY-NC-SA</a> 协议进行授权 | <a href="http://www.4520.info">4520</a><br />转载请注明转自《<a rel="bookmark" title="禁用thinkpad笔记本Fn+空格键的屏幕放大功能" href="http://www.4520.info/post/381">禁用thinkpad笔记本Fn+空格键的屏幕放大功能</a>》</p>]]></content:encoded>
			<wfw:commentRss>http://www.4520.info/post/381/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DirectAdmin(DA)专用的fail2ban SSH、FTP定制规则</title>
		<link>http://www.4520.info/post/298</link>
		<comments>http://www.4520.info/post/298#comments</comments>
		<pubDate>Sun, 22 Jan 2012 21:05:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[unix/linux]]></category>

		<guid isPermaLink="false">http://www.4520.info/wp?p=298</guid>
		<description><![CDATA[DirectAdmin是一套不错的虚拟主机管理工具，但它也常受到密码穷举机的关注。安装DA并放入网站不久后，总是在DA后台系统消息那看到FTP或帐号被暴力穷举（破解）。且DA本身没带相关的屏蔽或封锁的功能，只有记录错误次数的程序。除了使用DirectAdmin的商业插件外，我们还可以通过免费的fail2ban作为防火墙使用。 一、先按《反帐号密码穷举工具：Fail2Ban》安装成功Fail2Ban。 二、开始定制规则 (1)将jail.conf规则文件备份一次 cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.bak (2)编辑jail.conf vi /etc/fail2ban/jail.conf 1)SSH规则 [ssh-iptables]   enabled  = true #开启 filter   = sshd  action   = iptables[name=SSH, port=ssh, protocol=tcp]  #port为您SSH的端口号 logpath  = /var/log/secure #日志（一般情况无需修改） maxretry = 3 #尝试次数 以上操作，SSH在全局时间（参考：《反帐号密码穷举工具：Fail2Ban》）内被穷举3次密码则激活封锁。 2) ProFTPD 的配置 DirectAdmin(DA)的正则匹配规则和默认不同，以下是文件自带的默认规则（若没有请直接添加以下代码），先按黄色部分开启。 [ProFTPD-iptables]   enabled  = true filter   = proftpd action   = iptables[name=ProFTPD, port=ftp, protocol=tcp] logpath = /var/log/proftpd/auth.log maxretry = 3 操作完毕后请先保存。 3)修改正则匹配规则 vi /etc/fail2ban/filter.d/proftpd.conf [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; line-height: 20px; padding: 0px;">DirectAdmin是一套不错的虚拟主机管理工具，但它也常受到密码穷举机的关注。安装DA并放入网站不久后，总是在DA后台系统消息那看到FTP或帐号被暴力穷举（破解）。且DA本身没带相关的屏蔽或封锁的功能，只有记录错误次数的程序。除了使用DirectAdmin的商业插件外，我们还可以通过免费的fail2ban作为防火墙使用。<span id="more-298"></span></p>
<h2 style="font-weight: normal; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; padding: 0px; margin: 0px;">一、先按《<a style="color: #ff0242; text-decoration: none; padding: 0px; margin: 0px;" href="http://www.kwx.gd/CentOSApp/CentOS-Fail2Ban.html" target="_self">反帐号密码穷举工具：Fail2Ban</a>》安装成功Fail2Ban。</h2>
<h2 style="font-weight: normal; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; padding: 0px; margin: 0px;">二、开始定制规则</h2>
<h3 style="font-weight: normal; font-size: 16px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; padding: 0px; margin: 0px;">(1)将jail.conf规则文件备份一次</h3>
<pre class="prettyprint linenums bush:bash" style="padding-top: 30px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 0px; margin-bottom: 0px; font: normal normal normal 12px/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; overflow-x: hidden; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-image: initial; position: relative; text-shadow: #000000 0px 0px 2px; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; overflow-y: hidden; font-family: Monaco, Courier, monospace; font-size: 14px; color: #ffffff; border-width: 1px; border-color: #eeeeee; border-style: solid;">cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.bak</pre>
<h3 style="font-weight: normal; font-size: 16px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; padding: 0px; margin: 0px;">(2)编辑jail.conf</h3>
<pre class="prettyprint linenums bush:bash" style="padding-top: 30px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 0px; margin-bottom: 0px; font: normal normal normal 12px/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; overflow-x: hidden; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-image: initial; position: relative; text-shadow: #000000 0px 0px 2px; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; overflow-y: hidden; font-family: Monaco, Courier, monospace; font-size: 14px; color: #ffffff; border-width: 1px; border-color: #eeeeee; border-style: solid;">vi /etc/fail2ban/jail.conf</pre>
<h4 style="font-size: 15px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; padding: 0px; margin: 0px;">1)SSH规则</h4>
<pre class="prettyprint linenums bush:bash" style="padding-top: 30px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 0px; margin-bottom: 0px; font: normal normal normal 12px/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; overflow-x: hidden; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-image: initial; position: relative; text-shadow: #000000 0px 0px 2px; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; overflow-y: hidden; font-family: Monaco, Courier, monospace; font-size: 14px; color: #ffffff; border-width: 1px; border-color: #eeeeee; border-style: solid;">[ssh-iptables]   enabled  = true <span style="color: #ffff00; padding: 0px; margin: 0px;">#开启</span> filter   = sshd  action   = iptables[name=SSH, <span style="color: #ffff00; padding: 0px; margin: 0px;">port=ssh</span>, protocol=tcp]  <span style="color: #ffff00; padding: 0px; margin: 0px;">#port为您SSH的端口号</span> logpath  = /var/log/secure <span style="color: #ffff00; padding: 0px; margin: 0px;">#日志（一般情况无需修改）</span> maxretry = 3 <span style="color: #ffff00; padding: 0px; margin: 0px;">#尝试次数</span></pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; line-height: 20px; padding: 0px;">以上操作，SSH在全局时间（参考：《<a style="color: #ff0242; text-decoration: none; padding: 0px; margin: 0px;" href="http://www.kwx.gd/CentOSApp/CentOS-Fail2Ban.html" target="_self">反帐号密码穷举工具：Fail2Ban</a>》）内被穷举3次密码则激活封锁。</p>
<h4 style="font-size: 15px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; padding: 0px; margin: 0px;">2) ProFTPD 的配置</h4>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; line-height: 20px; padding: 0px;">DirectAdmin(DA)的正则匹配规则和默认不同，以下是文件自带的默认规则（若没有请直接添加以下代码），先按黄色部分开启。</p>
<pre class="prettyprint linenums bush:bash" style="padding-top: 30px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 0px; margin-bottom: 0px; font: normal normal normal 12px/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; overflow-x: hidden; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-image: initial; position: relative; text-shadow: #000000 0px 0px 2px; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; overflow-y: hidden; font-family: Monaco, Courier, monospace; font-size: 14px; color: #ffffff; border-width: 1px; border-color: #eeeeee; border-style: solid;">[ProFTPD-iptables]   enabled  = <span style="color: #ffff00; padding: 0px; margin: 0px;">true</span> filter   = proftpd action   = iptables[name=ProFTPD, port=ftp, protocol=tcp] <span style="color: #ffff00; padding: 0px; margin: 0px;">logpath = /var/log/proftpd/auth.log</span> maxretry = 3</pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; line-height: 20px; padding: 0px;"><img style="margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; display: block; padding: 0px;" src="http://www.kwx.gd/usr/uploads/2011/12/3796520497.jpg" alt="da-fail2ban.jpg" width="515" border="0" /></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; line-height: 20px; padding: 0px;">操作完毕后请先保存。</p>
<h4 style="font-size: 15px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; padding: 0px; margin: 0px;">3)修改正则匹配规则</h4>
<pre class="prettyprint linenums bush:bash" style="padding-top: 30px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 0px; margin-bottom: 0px; font: normal normal normal 12px/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; overflow-x: hidden; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-image: initial; position: relative; text-shadow: #000000 0px 0px 2px; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; overflow-y: hidden; font-family: Monaco, Courier, monospace; font-size: 14px; color: #ffffff; border-width: 1px; border-color: #eeeeee; border-style: solid;">vi /etc/fail2ban/filter.d/proftpd.conf</pre>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; line-height: 20px; padding: 0px;">SSH执行以上命令，修改正则匹配规则。</p>
<h4 style="font-size: 15px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; padding: 0px; margin: 0px;">4)替换规则</h4>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; line-height: 20px; padding: 0px;">先选定failregex后的四行代码，然后替换。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; line-height: 20px; padding: 0px;"><img style="margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; display: block; padding: 0px;" src="http://www.kwx.gd/usr/uploads/2011/12/1353750186.jpg" alt="da-fail2ban2.jpg" width="515" border="0" /></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; line-height: 20px; padding: 0px;"><span style="color: #ff0000; padding: 0px; margin: 0px;"><strong style="padding: 0px; margin: 0px;">替换为：</strong></span></p>
<pre class="prettyprint linenums bush:bash" style="padding-top: 30px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 0px; margin-bottom: 0px; font: normal normal normal 12px/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; overflow-x: hidden; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-image: initial; position: relative; text-shadow: #000000 0px 0px 2px; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; overflow-y: hidden; font-family: Monaco, Courier, monospace; font-size: 14px; color: #ffffff; border-width: 1px; border-color: #eeeeee; border-style: solid;">failregex = (.*) (.*) &lt;HOST&gt; (.*) (.*) 530</pre>
<h2 style="font-weight: normal; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; padding: 0px; margin: 0px;"><img style="margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; display: block; padding: 0px;" src="http://www.kwx.gd/usr/uploads/2011/12/526725986.jpg" alt="da-fail2ban3.jpg" width="515" border="0" /></h2>
<div></div>
<div>
<h2 style="font-weight: normal; color: #444444; font-family: 微软雅黑, 宋体, Tahoma, Georgia, Times, 'Times New Roman', serif; padding: 0px; margin: 0px;">三、保存并重启Fail2ban</h2>
<pre class="prettyprint linenums bush:bash" style="padding-top: 30px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 0px; margin-bottom: 0px; font: normal normal normal 12px/normal 'andale mono', 'lucida console', monospace; line-height: 1.5; overflow-x: hidden; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-image: initial; position: relative; text-shadow: #000000 0px 0px 2px; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; overflow-y: hidden; font-family: Monaco, Courier, monospace; font-size: 14px; color: #ffffff; border-width: 1px; border-color: #eeeeee; border-style: solid;">service fail2ban restart</pre>
</div>
<p><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 本文采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">BY-NC-SA</a> 协议进行授权 | <a href="http://www.4520.info">4520</a><br />转载请注明转自《<a rel="bookmark" title="DirectAdmin(DA)专用的fail2ban SSH、FTP定制规则" href="http://www.4520.info/post/298">DirectAdmin(DA)专用的fail2ban SSH、FTP定制规则</a>》</p>]]></content:encoded>
			<wfw:commentRss>http://www.4520.info/post/298/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DirectAdmin服务器专用Iptable脚本</title>
		<link>http://www.4520.info/post/297</link>
		<comments>http://www.4520.info/post/297#comments</comments>
		<pubDate>Sun, 22 Jan 2012 21:04:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[unix/linux]]></category>

		<guid isPermaLink="false">http://www.4520.info/wp?p=297</guid>
		<description><![CDATA[Centos Linux服务器，安装DA控制面板，感觉还不错，Iptable脚本 vim iptables.sh chmod 777 iptables.sh #!/bin/sh #海外服务器代购网（www.hwhost.net） # 设置默认防火墙策略 iptables -F iptables -F -t nat iptables -F -t mangle iptables -X iptables -X -t nat iptables -X -t mangle iptables -Z iptables -P FORWARD DROP iptables -P INPUT DROP iptables -P OUTPUT DROP # 允许端口进出 iptables -A OUTPUT -p icmp -j ACCEPT iptables [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #000000; border-width: 0px; padding: 0px; margin: 0px;">Centos Linux服务器，安装DA控制面板，感觉还不错，Iptable脚本<span id="more-297"></span></span></p>
<blockquote style="margin-top: 5px; margin-right: 30px; margin-bottom: 5px; margin-left: 10px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 4px; border-style: initial; border-color: initial; border-image: initial; quotes: none; background-color: #f9f9f9; border-left-style: solid; border-left-color: #e0e0e0; color: #222222; font-family: Arial; line-height: 24px; text-align: left; padding: 5px;">
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #ff0000; border-width: 0px; padding: 0px; margin: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px; margin: 0px;">vim iptables.sh</span></span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #ff0000; border-width: 0px; padding: 0px; margin: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px; margin: 0px;">chmod 777 iptables.sh</span></span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #ff0000; border-width: 0px; padding: 0px; margin: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;">#!/bin/sh<br />
#海外服务器代购网（</span><a style="border-style: initial; border-color: initial; border-image: initial; text-decoration: none; color: #666666; border-width: 0px; padding: 0px; margin: 0px;" href="http://www.hwhost.net/"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;">www.hwhost.net</span></a><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;">）</span></span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;"># 设置默认防火墙策略<br />
iptables -F<br />
iptables -F -t nat<br />
iptables -F -t mangle<br />
iptables -X<br />
iptables -X -t nat<br />
iptables -X -t mangle<br />
iptables -Z<br />
iptables -P FORWARD DROP<br />
iptables -P INPUT DROP<br />
iptables -P OUTPUT DROP</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;"># 允许端口进出<br />
iptables -A OUTPUT -p icmp -j ACCEPT<br />
iptables -A INPUT -p icmp -j ACCEPT</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;"># 允许端口进出<br />
iptables -A INPUT -p tcp –dport 21 -j ACCEPT<br />
iptables -A OUTPUT -p tcp –sport 21 -j ACCEPT<br />
iptables -A INPUT -p tcp –dport 22 -j ACCEPT<br />
iptables -A OUTPUT -p tcp –sport 22 -j ACCEPT<br />
iptables -A INPUT -p tcp –dport 25 -j ACCEPT<br />
iptables -A OUTPUT -p tcp –sport 25 -j ACCEPT<br />
iptables -A INPUT -p tcp –dport 53 -j ACCEPT<br />
iptables -A OUTPUT -p tcp –sport 53 -j ACCEPT<br />
iptables -A INPUT -p udp –dport 53 -j ACCEPT<br />
iptables -A OUTPUT -p udp –sport 53 -j ACCEPT<br />
iptables -A INPUT -p tcp –dport 80 -j ACCEPT<br />
iptables -A OUTPUT -p tcp –sport 80 -j ACCEPT<br />
iptables -A INPUT -p tcp –dport 110 -j ACCEPT<br />
iptables -A OUTPUT -p tcp –sport 110 -j ACCEPT<br />
iptables -A INPUT -p tcp –dport 2222 -j ACCEPT<br />
iptables -A OUTPUT -p tcp –sport 2222 -j ACCEPT<br />
iptables -A INPUT -p tcp –dport 3306 -j ACCEPT<br />
iptables -A OUTPUT -p tcp –sport 3306 -j ACCEPT<br />
iptables -A INPUT -p tcp –dport 35000:35999 -j ACCEPT      /*proftpd被动连接需要的端口*/<br />
iptables -A OUTPUT -p tcp –sport 35000:35999 -j ACCEPT<br />
iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT            /*允许本机访问本机*/<br />
iptables -A OUTPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;"># 打开 syncookie （轻量级预防 DOS 攻击）<br />
sysctl -w net.ipv4.tcp_syncookies=1 &amp;&gt;/dev/null</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;"># 设置默认 TCP 连接痴呆时长为 3800 秒（此选项可以大大降低连接数）<br />
sysctl -w net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=3800 &amp;&gt;/dev/null</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;"># 设置支持最大连接树为 30W（这个根据内存和 iptables 版本来，每个 connection 需要 300 多个字节）<br />
sysctl -w net.ipv4.ip_conntrack_max=300000 &amp;&gt;/dev/null</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;"># 防止SYN攻击 轻量<br />
iptables -N syn-flood<br />
iptables -A INPUT -p tcp –syn -j syn-flood<br />
iptables -A syn-flood -p tcp -m limit –limit 3/s –limit-burst 6 -j RETURN<br />
iptables -A syn-flood -j REJECT</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;"># 对于不管来自哪里的ip碎片都进行控制，允许每秒通过100个碎片<br />
iptables -A FORWARD -f -m limit –limit 100/s –limit-burst 100 -j ACCEPT</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;"># icmp包通过的控制，防止icmp黑客攻击<br />
iptables -A FORWARD -p icmp -m limit –limit 1/s –limit-burst 10 -j ACCEPT</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;"># 丢弃坏的TCP包<br />
iptables -A FORWARD -p TCP ! –syn -m state –state NEW -j LOG –log-prefix “New not syn:”<br />
iptables -A FORWARD -p TCP ! –syn -m state –state NEW -j DROP</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;">iptables-save &gt; /etc/sysconfig/iptables</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px; padding: 0px; margin: 0px;">service iptables restart</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #ff0000; border-width: 0px; padding: 0px; margin: 0px;">./iptables.sh</span></p>
</blockquote>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px; padding: 0px;"><span style="border-style: initial; border-color: initial; border-image: initial; color: #000000; border-width: 0px; padding: 0px; margin: 0px;">              执行脚本后，系统自动重启IPtable，设置即可生效。</span></p>
<p><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 本文采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">BY-NC-SA</a> 协议进行授权 | <a href="http://www.4520.info">4520</a><br />转载请注明转自《<a rel="bookmark" title="DirectAdmin服务器专用Iptable脚本" href="http://www.4520.info/post/297">DirectAdmin服务器专用Iptable脚本</a>》</p>]]></content:encoded>
			<wfw:commentRss>http://www.4520.info/post/297/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Centos Linux Directadmin 安全设置</title>
		<link>http://www.4520.info/post/296</link>
		<comments>http://www.4520.info/post/296#comments</comments>
		<pubDate>Sun, 22 Jan 2012 21:03:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[unix/linux]]></category>

		<guid isPermaLink="false">http://www.4520.info/wp?p=296</guid>
		<description><![CDATA[就在这几天网络浏览中看到一些Linux&#160;Directadmin 服务器安全设置以及对apache、mysql优化设置。 在此我们转发下，供大家参考设置。 服务器安全优化 vim /etc/fstab修改/tmp为值为rw,nosuid,noexec添加/home的值nosuid修改tmpfs的值为rw,noexec,nosuidmv /var/tmp /var/tmp_bak&#160;&#160; #移动/var/tmp目录ln -s /tmp /var/tmp php.ini的disable_function设置执行: cd /usr/local/directadmin/custombuild./build update./build secure_php./build update./build all d mysql安全设置 vim /etc/my.conf修改为bind-address = 127.0.0.1&#160;&#160; #指定mysql监听在127.0.0.1添加set-variable = max_connections=32000&#160;&#160;&#160;&#160; #MySQL服务器允许的最大连接数16384 apache优化设置 禁止apache调用perlchgrp apache /usr/bin/perlchmod 705 /usr/bin/perl 优化apache #!/bin/bashecho -e &#8220;KeepAlive On&#92;nMaxKeepAliveRequests 120&#92;nKeepAliveTimeout 15&#92;n&#8221; &#62;&#62; /etc/httpd/conf/httpd.confecho 1 &#62; /proc/sys/net/ipv4/tcp_tw_reuseecho 1 &#62; /proc/sys/net/ipv4/tcp_tw_recycleecho 1800 &#62; /proc/sys/net/ipv4/tcp_keepalive_timeecho 30 &#62; [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px">就在这几天网络浏览中看到一些<a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; text-decoration: none; color: #666666; border-width: 0px" href="http://www.hwhost.net/tag/linux" target="_blank" title="linux">Linux</a>&nbsp;Directadmin 服务器安全设置以及对<a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; text-decoration: none; color: #666666; border-width: 0px" href="http://www.hwhost.net/tag/apache" target="_blank" title="apache">apache</a>、<a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; text-decoration: none; color: #666666; border-width: 0px" href="http://www.hwhost.net/tag/mysql" target="_blank" title="mysql">mysql</a>优化设置。</p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px">在此我们转发下，供大家参考设置。</p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px">服务器安全优化</p>
<blockquote style="margin-top: 5px; margin-right: 30px; margin-bottom: 5px; margin-left: 10px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 4px; border-style: initial; border-color: initial; border-image: initial; quotes: none; background-color: #f9f9f9; border-left-style: solid; border-left-color: #e0e0e0; color: #222222; font-family: Arial; line-height: 24px; text-align: left"><p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px"><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #ff0000; border-width: 0px">vim /etc/fstab<br /></span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px">修改/tmp为值为rw,nosuid,noexec<br />添加/home的值nosuid<br />修改tmpfs的值为rw,noexec,nosuid<br /></span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #ff0000; border-width: 0px">mv /var/tmp /var/tmp_bak&nbsp;&nbsp; #移动/var/tmp目录<br />ln -s /tmp /var/tmp</span></p>
</blockquote>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px">php.ini的disable_function设置执行:</p>
<blockquote style="margin-top: 5px; margin-right: 30px; margin-bottom: 5px; margin-left: 10px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 4px; border-style: initial; border-color: initial; border-image: initial; quotes: none; background-color: #f9f9f9; border-left-style: solid; border-left-color: #e0e0e0; color: #222222; font-family: Arial; line-height: 24px; text-align: left"><p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; border-width: 0px"><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #ff0000; border-width: 0px">cd /usr/local/directadmin/custombuild<br />./build update<br />./build secure_php<br />./build update<br />./build all d</span></p>
</blockquote>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px"><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; text-decoration: none; color: #666666; border-width: 0px" href="http://www.hwhost.net/tag/mysql" target="_blank" title="mysql">mysql</a>安全设置</p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px"><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #ff0000; border-width: 0px">vim /etc/my.conf<br /></span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #0000ff; border-width: 0px">修改为bind-address = 127.0.0.1&nbsp;&nbsp; #指定mysql监听在127.0.0.1<br />添加set-variable = max_connections=32000&nbsp;&nbsp;&nbsp;&nbsp; #MySQL服务器允许的最大连接数16384</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px"><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; text-decoration: none; color: #666666; border-width: 0px" href="http://www.hwhost.net/tag/apache" target="_blank" title="apache">apache</a>优化设置</p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px">禁止<a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; text-decoration: none; color: #666666; border-width: 0px" href="http://www.hwhost.net/tag/apache" target="_blank" title="apache">apache</a>调用perl<br /><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #ff0000; border-width: 0px">chgrp apache /usr/bin/perl<br />chmod 705 /usr/bin/perl</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px">优化<a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; text-decoration: none; color: #666666; border-width: 0px" href="http://www.hwhost.net/tag/apache" target="_blank" title="apache">apache</a></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px"><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #ff0000; border-width: 0px">#!/bin/bash<br />echo -e &ldquo;KeepAlive On&#92;nMaxKeepAliveRequests 120&#92;nKeepAliveTimeout 15&#92;n&rdquo; &gt;&gt; /etc/httpd/conf/httpd.conf<br />echo 1 &gt; /proc/sys/net/ipv4/tcp_tw_reuse<br />echo 1 &gt; /proc/sys/net/ipv4/tcp_tw_recycle<br />echo 1800 &gt; /proc/sys/net/ipv4/tcp_keepalive_time<br />echo 30 &gt; /proc/sys/net/ipv4/tcp_fin_timeout<br />echo 8069 &gt; /proc/sys/net/core/netdev_max_backlog<br />/sbin/sysctl -p &gt; /dev/null 2&gt;&amp;1 &amp;&amp; /sbin/service httpd restart</span></p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px">就此完毕，已经测试，效果不错！~值得尝试！~~</p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-style: initial; border-color: initial; border-image: initial; color: #222222; font-family: Arial; line-height: 24px; text-align: left; background-color: #f9f9f9; border-width: 0px">注：红色执行命令，蓝色填写内容</p>
<p><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 本文采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">BY-NC-SA</a> 协议进行授权 | <a href="http://www.4520.info">4520</a><br />转载请注明转自《<a rel="bookmark" title="Centos Linux Directadmin 安全设置" href="http://www.4520.info/post/296">Centos Linux Directadmin 安全设置</a>》</p>]]></content:encoded>
			<wfw:commentRss>http://www.4520.info/post/296/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux下iptables配置详解</title>
		<link>http://www.4520.info/post/295</link>
		<comments>http://www.4520.info/post/295#comments</comments>
		<pubDate>Fri, 30 Dec 2011 22:26:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[unix/linux]]></category>

		<guid isPermaLink="false">http://www.4520.info/wp?p=295</guid>
		<description><![CDATA[详细 如果你的IPTABLES基础知识还不了解,建议先去看看. 开始配置 我们来配置一个filter表的防火墙. (1)查看本机关于IPTABLES的设置情况 [root@tp ~]# iptables -L -n Chain INPUT (policy ACCEPT) target&#160;&#160;&#160;&#160;&#160;&#160; prot opt source&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; destination&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Chain FORWARD (policy ACCEPT) target&#160;&#160;&#160;&#160;&#160;&#160; prot opt source&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; destination&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Chain OUTPUT (policy ACCEPT) target&#160;&#160;&#160;&#160;&#160;&#160; prot opt source&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; destination&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Chain RH-Firewall-1-INPUT (0 references) target&#160;&#160;&#160;&#160;&#160;&#160; prot opt source&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; destination&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ACCEPT&#160;&#160;&#160;&#160;&#160;&#160; all&#160;&#160;&#160;&#160;--&#160;&#160;&#160;&#160;0.0.0.0/0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;0.0.0.0/0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ACCEPT&#160;&#160;&#160;&#160;&#160;&#160; icmp --&#160;&#160;&#160;&#160;0.0.0.0/0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;0.0.0.0/0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; icmp type 255 ACCEPT&#160;&#160;&#160;&#160;&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>详细<br /><span id="more-295"></span>
<div id="cnblogs_post_body">
<div><strong>如果你的IPTABLES基础知识还不了解,建议先去看看.</strong></div>
<div><strong>开始配置</strong></div>
<div><strong>我们来配置一个filter表的防火墙.<br /></strong></div>
<div><strong>(1)查看本机关于IPTABLES的设置情况</strong></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -L -n</span><br /> Chain INPUT (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
<div>Chain FORWARD (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
<div>Chain OUTPUT (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
<div>Chain RH-Firewall-1-INPUT (0 references)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> ACCEPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> ACCEPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; icmp --&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; icmp type 255 <br /> ACCEPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; esp&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> ACCEPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ah&nbsp;&nbsp;&nbsp;&nbsp; --&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> ACCEPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; udp&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;224.0.0.251&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; udp dpt:5353 <br /> ACCEPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; udp&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; udp dpt:631 <br /> ACCEPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state RELATED,ESTABLISHED <br /> ACCEPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tcp&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state NEW tcp dpt:22 <br /> ACCEPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tcp&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state NEW tcp dpt:80 <br /> ACCEPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tcp&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state NEW tcp dpt:25 <br /> REJECT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0/0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reject-with icmp-host-prohibited <br /> 可以看出我在安装linux时,选择了有防火墙,并且开放了22,80,25端口.</div>
<div>如果你在安装linux时没有选择启动防火墙,是这样的</div>
<div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -L -n</span><br /> Chain INPUT (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
<div>Chain FORWARD (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
<div>Chain OUTPUT (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;</div>
<div>什么规则都没有.</div>
<div><strong>(2)清除原有规则.</strong></div>
<div>不管你在安装linux时是否启动了防火墙,如果你想配置属于自己的防火墙,那就清除现在filter的所有规则.</div>
<div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -F</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;清除预设表filter中的所有规则链的规则<br /> <span style="color: #0000ff">[root@tp ~]# iptables -X</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;清除预设表filter中使用者自定链中的规则</div>
<div>我们在来看一下</div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -L -n</span><br /> Chain INPUT (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
<div>Chain FORWARD (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
<div>Chain OUTPUT (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>什么都没有了吧,和我们在安装linux时没有启动防火墙是一样的.(提前说一句,这些配置就像用命令配置IP一样,重起就会失去作用),怎么保存.</div>
<div><span style="font-size: 9pt"><span style="color: #0000ff"><span style="font-family: Courier New">[root@tp ~]# </span>/etc/rc.d/init.d/iptables save</span></span></div>
<p>&nbsp;&nbsp;
<div><span style="font-size: 9pt">这样就可以写到/etc/sysconfig/iptables文件里了.写入后记得把防火墙重起一下,才能起作用.</span></div>
<div><span style="font-size: 9pt"><span style="color: #0000ff">[root@tp ~]# service iptables restart</span></span></div>
<p>&nbsp;&nbsp;
<div>现在IPTABLES配置表里什么配置都没有了,那我们开始我们的配置吧</div>
<div><strong>(3)设定预设规则</strong></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -p INPUT DROP</span></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -p OUTPUT ACCEPT</span></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -p FORWARD DROP</span><br /> <strong><span style="background-color: #ffffff; color: #ff0000">上面的意思是,当超出了IPTABLES里filter表里的两个链规则(INPUT,FORWARD)时,不在这两个规则里的数据包怎么处理呢,那就是DROP(放弃).应该说这样配置是很安全的.我们要控制流入数据包</span></strong></div>
<div><strong><span style="background-color: #ffffff; color: #ff0000">而对于OUTPUT链,也就是流出的包我们不用做太多限制,而是采取ACCEPT,也就是说,不在着个规则里的包怎么办呢,那就是通过.</span></strong></div>
<div><strong><span style="background-color: #ffffff; color: #ff0000">可以看出INPUT,FORWARD两个链采用的是允许什么包通过,而OUTPUT链采用的是不允许什么包通过.</span></strong></div>
<div><strong><span style="background-color: #ffffff; color: #ff0000">这样设置还是挺合理的,当然你也可以三个链都DROP,但这样做我认为是没有必要的,而且要写的规则就会增加.但如果你只想要有限的几个规则是,如只做WEB服务器.还是推荐三个链都是DROP.</span></strong></div>
<div>注:如果你是远程SSH登陆的话,当你输入第一个命令回车的时候就应该掉了.因为你没有设置任何规则.</div>
<div>怎么办,去本机操作呗!</div>
<div><strong>(4)添加规则.</strong></div>
<div><strong><span style="color: #000000">首先添加INPUT链,INPUT链的默认规则是DROP,所以我们就写需要ACCETP(通过)的链</span></strong></div>
<div><strong><span style="color: #000000">为了能采用远程SSH登陆,我们要开启22端口.</span></strong></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A INPUT -p tcp --dport 22 -j ACCEPT</span></div>
<div><span style="background-color: #ffffff; color: #ff0000">[root@tp ~]# iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT</span> <strong>(注:这个规则,如果你把OUTPUT 设置成DROP的就要写上这一部,好多人都是望了写这一部规则导致,始终无法SSH.在远程一下,是不是好了.</strong></div>
<div><strong>其他的端口也一样,如果开启了web服务器,OUTPUT设置成DROP的话,同样也要添加一条链:</strong></div>
<div><span style="color: #ff0000">[root@tp ~]# iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT ,其他同理.)</span></div>
<div><strong>如果做了WEB服务器,开启80端口.</strong></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A INPUT -p tcp --dport 80 -j ACCEPT</span><br /> <strong>如果做了邮件服务器,开启25,110端口.</strong></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A INPUT -p tcp --dport 110 -j ACCEPT<br /> [root@tp ~]# iptables -A INPUT -p tcp --dport 25 -j ACCEPT</span><br /> <strong>如果做了FTP服务器,开启21端口</strong></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A INPUT -p tcp --dport 21 -j ACCEPT</span></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A INPUT -p tcp --dport 20 -j ACCEPT</span></div>
<div><strong>如果做了DNS服务器,开启53端口</strong></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A INPUT -p tcp --dport 53 -j ACCEPT</span></div>
<div>如果你还做了其他的服务器,需要开启哪个端口,照写就行了.</div>
<div>上面主要写的都是INPUT链,凡是不在上面的规则里的,都DROP</div>
<div><strong>允许icmp包通过,也就是允许ping,</strong></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A OUTPUT -p icmp -j ACCEPT (OUTPUT设置成DROP的话)</span></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A INPUT -p icmp -j ACCEPT&nbsp;&nbsp;&nbsp;&nbsp;(INPUT设置成DROP的话)</span> </div>
<div>
<div><strong>允许loopback!(不然会导致DNS无法正常关闭等问题)</strong></div>
<div><span style="color: #0000ff">IPTABLES -A INPUT -i lo -p all -j ACCEPT (如果是INPUT DROP)<br /> IPTABLES -A OUTPUT -o lo -p all -j ACCEPT(如果是OUTPUT DROP)<br /> </span></div>
</p></div>
<div>下面写OUTPUT链,OUTPUT链默认规则是ACCEPT,所以我们就写需要DROP(放弃)的链.</div>
<div><strong>减少不安全的端口连接</strong></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A OUTPUT -p tcp --sport 31337 -j DROP</span></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A OUTPUT -p tcp --dport 31337 -j DROP</span></div>
<div><span style="font-size: x-small; color: #000000">有些些特洛伊木马会扫描端口31337到31340(即黑客语言中的 elite 端口)上的服务。既然合法服务都不使用这些非标准端口来通信,阻塞这些端口能够有效地减少你的网络上可能被感染的机器和它们的远程主服务器进行独立通信的机会</span></div>
<div><span style="color: #000000">还有其他端口也一样,像:31335、27444、27665、20034 NetBus、9704、137-139（smb）,2049(NFS)端口也应被禁止,我在这写的也不全,有兴趣的朋友应该去查一下相关资料.</span></div>
<p>&nbsp;&nbsp;
<div><strong><span style="color: #ff0000">当然出入更安全的考虑你也可以包OUTPUT链设置成DROP,那你添加的规则就多一些,就像上边添加</span></strong></div>
<div><strong><span style="color: #ff0000">允许SSH登陆一样.照着写就行了.</span></strong></div>
<p>&nbsp;&nbsp;
<div><strong>下面写一下更加细致的规则,就是限制到某台机器</strong></div>
<div><strong>如:我们只允许192.168.0.3的机器进行SSH连接</strong></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A INPUT -s 192.168.0.3 -p tcp --dport 22 -j ACCEPT</span></div>
<div>如果要允许,或限制一段IP地址可用 192.168.0.0/24 表示192.168.0.1-255端的所有IP.</div>
<div>24表示子网掩码数.但要记得把 /etc/sysconfig/iptables 里的这一行删了.</div>
<div>-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT 因为它表示所有地址都可以登陆.</div>
<div>或采用命令方式:</div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -D INPUT -p tcp --dport 22 -j ACCEPT</span></div>
<div>然后保存,我再说一边,反是采用命令的方式,只在当时生效,如果想要重起后也起作用,那就要保存.写入到/etc/sysconfig/iptables文件里.</div>
<div><span style="font-size: 9pt"><span style="color: #0000ff"><span style="font-family: Courier New">[root@tp ~]# </span>/etc/rc.d/init.d/iptables save</span></span></div>
<div>这样写 !192.168.0.3 表示除了192.168.0.3的ip地址</div>
<div>其他的规则连接也一样这么设置.</div>
<p>&nbsp;&nbsp;
<div><strong>在下面就是FORWARD链,FORWARD链的默认规则是DROP,所以我们就写需要ACCETP(通过)的链,对正在转发链的监控.</strong></div>
<div><strong>开启转发功能,(在做NAT时,FORWARD默认规则是DROP时,必须做)</strong></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT</span></div>
<div><span style="color: #0000ff">[root@tp ~]# iptables -A FORWARD -i eth1 -o eh0 -j ACCEPT</span></div>
<div><strong>丢弃坏的TCP包</strong></div>
<div>[root@tp ~]#iptables -A FORWARD -p TCP ! --syn -m state --state NEW -j DROP</div>
<div><strong>处理IP碎片数量,防止攻击,允许每秒100个</strong></div>
<div><span style="color: #0000ff">[root@tp ~]#iptables -A FORWARD -f -m limit --limit 100/s --limit-burst 100 -j ACCEPT</span></div>
<div><strong>设置ICMP包过滤,允许每秒1个包,限制触发条件是10个包.</strong> </div>
<div><span style="color: #0000ff">[root@tp ~]#iptables -A FORWARD -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT</span></div>
<div>我在前面只所以允许ICMP包通过,就是因为我在这里有限制. </div>
<div><span style="color: #000000"><strong>二,配置一个NAT表放火墙</strong></span></div>
<div><strong>1,查看本机关于NAT的设置情况</strong></div>
<div><strong>[root@tp rc.d]# iptables -t nat -L</strong><br /> Chain PREROUTING (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
<div>Chain POSTROUTING (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /> SNAT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;192.168.0.0/24&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; anywhere&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to:211.101.46.235 </div>
<div>Chain OUTPUT (policy ACCEPT)<br /> target&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prot opt source&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; destination&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>我的NAT已经配置好了的(只是提供最简单的代理上网功能,还没有添加防火墙规则).关于怎么配置NAT,参考我的另一篇文章</div>
<div>当然你如果还没有配置NAT的话,你也不用清除规则,因为NAT在默认情况下是什么都没有的</div>
<div><strong>如果你想清除,命令是</strong></div>
<div><span style="font-size: 10pt"><span style="font-family: Courier New; color: #0000ff">[root@tp ~]# iptables -F -t nat</span></span></div>
<div><span style="font-size: 10pt"><span style="font-family: Courier New"><span style="font-size: 10pt"><span style="font-family: Courier New; color: #0000ff">[root@tp ~]# iptables -X -t nat</span></span></span></span></div>
<div><span style="font-size: 10pt"><span style="font-family: Courier New"><span style="font-size: 10pt"><span style="font-family: Courier New; color: #0000ff">[root@tp ~]# iptables -<span style="font-size: 10pt"><span style="font-size: 10pt"><span style="font-family: Courier New">Z</span></span></span> -t nat</span></span></span></span></div>
<p>&nbsp;&nbsp;
<div><strong>2,添加规则</strong></div>
<div><strong>添加基本的NAT地址转换,(关于如何配置NAT可以看我的另一篇文章),</strong></div>
<div><strong>添加规则,我们只添加DROP链.因为默认链全是ACCEPT.</strong></div>
<div><strong>防止外网用内网IP欺骗</strong></div>
<div><span style="color: #0000ff">[root@tp sysconfig]# iptables -t nat -A PREROUTING -i eth0 -s 10.0.0.0/8 -j DROP<br /> [root@tp sysconfig]# iptables -t nat -A PREROUTING -i eth0 -s 172.16.0.0/12 -j DROP<br /> [root@tp sysconfig]# iptables -t nat -A PREROUTING -i eth0 -s 192.168.0.0/16 -j DROP</span><br /> <strong>如果我们想,比如阻止MSN,QQ,BT等的话,需要找到它们所用的端口或者IP,(个人认为没有太大必要)</strong></div>
<div><strong>例：</strong></div>
<div>
<div><span style="font-size: 10pt"><strong>禁止与211.101.46.253的所有连接</strong></span></div>
<p> <span style="font-size: 10pt"><span style="color: #0000ff"><span style="font-family: Courier New">[root@tp ~]# iptables </span>-t nat -A PREROUTING&nbsp;&nbsp;&nbsp;&nbsp;-d 211.101.46.253 -j DROP</span></span></div>
</p></div>
</p></div>
<div>
<div><span style="font-size: 10pt"><span style="font-size: 10pt"><strong>禁用FTP(21)端口</strong></span> </span></div>
<div><span style="font-size: 10pt"><span style="color: #0000ff"><span style="font-family: Courier New">[root@tp ~]# iptables </span>-t nat -A PREROUTING -p tcp --dport 21 -j DROP</span></span></div>
<div><strong>这样写范围太大了,我们可以更精确的定义.</strong></div>
<div><span style="font-size: 10pt"><span style="color: #0000ff"><span style="font-family: Courier New">[root@tp ~]# iptables </span>-t nat -A PREROUTING&nbsp;&nbsp;&nbsp;&nbsp;-p tcp --dport 21 -d 211.101.46.253 -j DROP</span> </span></div>
<div><span style="font-size: 10pt"><strong>这样只禁用211.101.46.253地址的FTP连接,其他连接还可以.如web(80端口)连接.</strong></span></div>
</p></div>
<div><strong>按照我写的,你只要找到QQ,MSN等其他软件的IP地址,和端口,以及基于什么协议,只要照着写就行了.</strong></div>
<p>&nbsp;&nbsp;
<div><strong>最后：</strong></div>
<div><strong>drop非法连接</strong><br /> <span style="color: #0000ff">[root@tp ~]# iptables -A INPUT&nbsp;&nbsp;&nbsp;&nbsp; -m state --state INVALID -j DROP<br /> [root@tp ~]# iptables -A OUTPUT&nbsp;&nbsp;&nbsp;&nbsp;-m state --state INVALID -j DROP<br /> [root@tp ~]# iptables-A FORWARD -m state --state INVALID -j DROP</span><br /> <strong>允许所有已经建立的和相关的连接</strong><br /> <span style="color: #0000ff">[root@tp ~]# iptables-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT<br /> [root@tp ~]# iptables-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT<br /> </span></div>
<p><span style="font-size: 9pt"><span style="color: #0000ff"><span style="font-family: Courier New">[root@tp ~]# </span>/etc/rc.d/init.d/iptables save</span></span></p>
<p><span style="font-size: 9pt"><strong>这样就可以写到/etc/sysconfig/iptables文件里了.写入后记得把防火墙重起一下,才能起作用．</strong></span></p>
<p><span style="font-size: 9pt"><span style="color: #0000ff">[root@tp ~]# service iptables restart</span></span></p>
<p> <strong>别忘了保存，不行就写一部保存一次．你可以一边保存，一边做实验，看看是否达到你的要求， </strong>
<div><strong>上面的所有规则我都试过，没有问题．</strong></div>
<div><strong>写这篇文章，用了我将近１个月的时间．查找资料，自己做实验，希望对大家有所帮助．如有不全及不完善的地方还请提出.</strong></div>
<div><strong>因为本篇文章以配置为主.关于IPTABLES的基础知识及指令命令说明等我会尽快传上,当然你可以去网上搜索一下,还是很多的.</strong></div>
</p></div>
<p></p>
<p><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 本文采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">BY-NC-SA</a> 协议进行授权 | <a href="http://www.4520.info">4520</a><br />转载请注明转自《<a rel="bookmark" title="linux下iptables配置详解" href="http://www.4520.info/post/295">linux下iptables配置详解</a>》</p>]]></content:encoded>
			<wfw:commentRss>http://www.4520.info/post/295/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ubuntu批量添加文件扩展名</title>
		<link>http://www.4520.info/post/294</link>
		<comments>http://www.4520.info/post/294#comments</comments>
		<pubDate>Wed, 30 Nov 2011 22:46:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[unix/linux]]></category>

		<guid isPermaLink="false">http://www.4520.info/wp?p=294</guid>
		<description><![CDATA[shell下进入那个文件夹，然后输入： find &#160;. &#160;-exec &#160;mv &#160;{} &#160;{}.txt &#160;&#92;; 注意后面的斜杠和分号都不能少 声明: 本文采用 BY-NC-SA 协议进行授权 &#124; 4520转载请注明转自《ubuntu批量添加文件扩展名》]]></description>
			<content:encoded><![CDATA[<p>shell下进入那个文件夹，然后输入： <br /> find &nbsp;. &nbsp;-exec &nbsp;mv &nbsp;{} &nbsp;{}.txt &nbsp;&#92;; <br /> 注意后面的斜杠和分号都不能少</p>
<p><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 本文采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">BY-NC-SA</a> 协议进行授权 | <a href="http://www.4520.info">4520</a><br />转载请注明转自《<a rel="bookmark" title="ubuntu批量添加文件扩展名" href="http://www.4520.info/post/294">ubuntu批量添加文件扩展名</a>》</p>]]></content:encoded>
			<wfw:commentRss>http://www.4520.info/post/294/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Namejet Verified Bidder（竞投人认证）教程</title>
		<link>http://www.4520.info/post/292</link>
		<comments>http://www.4520.info/post/292#comments</comments>
		<pubDate>Wed, 24 Aug 2011 16:54:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[域名]]></category>

		<guid isPermaLink="false">http://www.4520.info/wp?p=292</guid>
		<description><![CDATA[注册了Namejet账户很久了，虽然Namejet老是提示需要认证，但是因为不认证只是有一定的限制，并不影响一般的使用，所以一下没有认证。 这段时间混域名城，发现有一些人原来还在为这个Namejet Verified&#160;&#160;Bidder烦恼，于是上Namejet了解了一下，顺便做了一下认证，过程其实很简单，想必是域名城里有一些米家根本没有仔细看Namejet的说明， 于是认证后整理一下，希望对大家有一些帮助。 先说一下没有通过Namejet Verified Bidder认证的限制： 先看一下官方的说明： NameJet&#8217;s&#160;&#160;Verified Bidder program is a free, opt-in program that allows serious&#160;&#160;customers to bid on more names, and at higher dollar values. If you want&#160;&#160;to place auction bids over $2500 total, or backorder more than 10&#160;&#160;domain names, you must be a Verified Bidder. To register, simply&#160;&#160;complete and fax [...]]]></description>
			<content:encoded><![CDATA[<p>注册了Namejet账户很久了，虽然Namejet老是提示需要认证，但是因为不认证只是有一定的限制，并不影响一般的使用，所以一下没有认证。 这段时间混域名城，发现有一些人原来还在为这个Namejet Verified&nbsp;&nbsp;Bidder烦恼，于是上Namejet了解了一下，顺便做了一下认证，过程其实很简单，想必是域名城里有一些米家根本没有仔细看Namejet的说明， 于是认证后整理一下，希望对大家有一些帮助。</p>
<p><span id="more-292"></span></p>
<p>先说一下没有通过Namejet Verified Bidder认证的限制：</p>
<p> 先看一下官方的说明：</p>
<blockquote><p><a rel="tag" href="http://www.mimidi.com/tag/namejet/" title="标签 NameJet 下的日志" class="st_tag internal_tag">NameJet</a>&rsquo;s&nbsp;&nbsp;Verified Bidder program is a free, opt-in program that allows serious&nbsp;&nbsp;customers to bid on more names, and at higher dollar values. If you want&nbsp;&nbsp;to place auction bids over $2500 total, or backorder more than 10&nbsp;&nbsp;domain names, you must be a Verified Bidder. To register, simply&nbsp;&nbsp;complete and fax the Verified Bidder Request form from the Verified&nbsp;&nbsp;Bidder page, with a photo ID that matches the credit card we have on&nbsp;&nbsp;file.</p>
</blockquote>
<p>这里有一些信息不对称，从这个官方说明来看，未认证的账户不能预订超过10个域名，但是实际上远远不只这个数量，好像是每天不能超过30个预订吧。另外一个限制可能对喜欢拿大米的大佬有影响了，就是竞价不能超过2500美元，但是我想没有大佬不认证的吧？</p>
<p>不管怎样，虽然Namejet Verified Bidder对普通用户没有影响，但是既然认证很简单，为什么不未雨绸缪呢？说不定哪一天，你忽然看上一个大米又势在必得，到那时再认证可真的是来不及了。</p>
<p>废话少说，一步一步来认证吧：</p>
<p>首先，看一下官方说明：http://www.namejet.com/Pages/VerifiedBidding.aspx<br /> How to become a Verified Bidder?<br /> 怎样认证：</p>
<blockquote><p>To become a Verified Bidder, you must download our&nbsp;&nbsp;Verified Bidder Request form. Please sign and attach the completed form&nbsp;&nbsp;along with color photo identification to a Support Center ticket created&nbsp;&nbsp;from within your account. We will notify you by email when your account&nbsp;&nbsp;has been upgraded.</p>
</blockquote>
<p>这里再重复一下，Namejet的认证就是这么简单，千万不要跟国内那些流氓机构的认证混为一谈，也就是下载表格，填表（就那么几个空），然后扫描，上传，然后就OK了。是的，就这么简单。</p>
<p>先下载表格：<a href="http://www.namejet.com/Download/NameJetAuthForm.pdf">http://www.namejet.com/Download/NameJetAuthForm.pdf</a><br /> PDF格式的，不要跟我说你没装reader，打开后按实际情况填写，</p>
<blockquote><p>Date:<br /> Name:<br /> Billing Address:<br /> Phone:<br /> Email Address:<br /> Login ID: </p>
</blockquote>
<p>这几个就不用我讲了吧，尽量跟你的Namejet的账户信息一致吧，值得注意的是，我建议在Name一行那里，中文名和英文（拼音）名一起写上，至少我是这样填的，因为鬼佬不懂拼音，起码你得让他觉得跟你的身份证是一样的字吧。</p>
<p>接下来的一段可能就要说明一下：</p>
<blockquote><p>This letter is to authorize and guarantee NameJet&trade; for charges to my credit card, first 4 digits being<br /> __ __ __ __ and last 4 digits being __ __ __ __ , for all domain names or services that I have<br /> purchased through NameJet. </p>
</blockquote>
<p>这个意思是要你写上你的信用卡的前4位和后4位。<br /> 最后的Signature of Cardholder和Print Name as It Appears on Card我都是签的中文名，因为看说明好像Namejet是要对照你的身份证的。</p>
<p>填好之后，把表格和你的身份证（按说明，护照或驾驶证都可以，只有上面有你彩色头像就行了）扫描，然后登陆到Namejet，点击网站底部的<a href="http://supportcenter.custhelp.com/app/answers/list">Support Center</a>进入支持中心，类似于国内网站的有问必答，这里汗一下，把这个放在底部，跟国人习惯有些不同，我就在My Account找了好久。</p>
<p>进入到Support Center以后，点Submit a Ticket新开一个主题，在Category那里选择&ldquo;NameJet&nbsp;&nbsp;Authorized Bidder&nbsp;&nbsp;Request&rdquo;，其它的Subject（主题）和Question（问题）大概写一下就行了，最主要的是要上传你扫描的表格和身份证明。</p>
<p>送佛送到西，好吧，主题你可以写&ldquo;Hi,I want to become a Verified Bidder.&rdquo;，然后问题可以写&ldquo;I&nbsp;&nbsp;want to become a Verified Bidder, and I have finished the&nbsp;&nbsp;form.&rdquo;，哈，够直接了吧。</p>
<p>提交后，很多就会有回复，你也同时会收到邮件，邮件里直接会附上他们的回复内容，比如：</p>
<blockquote><p>Hello,</p>
<p>Thank you for contacting nameJet Support</p>
<p>We have forwarded this ticket to our senior technical support staff for validation.</p>
<p>I will during my normal office hours once I have some answers.</p>
<p>Thank you for your patience. </p>
<p>Best Regards,</p>
<p>Derek<br /> Technical Support Team </p>
</blockquote>
<p>这个意思是他已收到你的认证请求，他也已经转交给上级部门处理。</p>
<p>这里有一个小插曲，我想试一下他们的效率，就在第二天（星期六哦！！！）回复了一下他，我说我想知道什么时候可以通过认证，因为我急着去竞拍一个我很喜欢的域名（哈，没有的事），希望他们能马上给处理一下。</p>
<p>没想到马上收到他们的回复：</p>
<blockquote><p>Hello,</p>
<p>Thank you for your interest in becoming a Verified Bidder for NameJet.com</p>
<p>We have received the signed Verified Bidder Authorization form and&nbsp;&nbsp;have upgraded your NameJet account with the status of Authorized Bidder.&nbsp;&nbsp;The previous restrictions have been removed. </p>
<p>***IMPORTANT*** Please be sure to LOG OUT of your NameJet account and&nbsp;&nbsp;log back in to ensure that the new settings are updated for your&nbsp;&nbsp;account. Otherwise you may not be recognized as a verified bidder and&nbsp;&nbsp;could potentially continue to be restricted in your bidding.</p>
<p>We suggest you review the FAQs to familiarize yourself with the&nbsp;&nbsp;NameJet auction site procedures, as we may differ from other auction&nbsp;&nbsp;websites you currently use. Here are a few highlights:</p>
<p>* Backorder bids are NOT proxy bid amounts. Entering a backorder bid&nbsp;&nbsp;with the minimum bid is your indication that you are interested in the&nbsp;&nbsp;domain. Your backorder bid is your starting bid amount once a domain&nbsp;&nbsp;goes to auction (or the amount you are charged if you are the only&nbsp;&nbsp;bidder).</p>
<p>* The more people with the name on backorder, combined with higher&nbsp;&nbsp;bid amounts for Pending Delete domains, will increase the number of&nbsp;&nbsp;resources NameJet utilizes to attempt to catch names that drop = higher&nbsp;&nbsp;success rate!</p>
<p>* A bidder should always use caution and double check any domain to&nbsp;&nbsp;be sure there is not a typo or characters they were not expecting. Do&nbsp;&nbsp;your research and investigate to see whether the domain name you select&nbsp;&nbsp;infringes legal rights of others before you place your backorder or&nbsp;&nbsp;actively bid in an auction. There are no refunds once you win an&nbsp;&nbsp;auction.</p>
<p>* Only backorder bids at the minimum bid (typically $69-$99) can be&nbsp;&nbsp;deleted. This applies to backorders with either a Pre-Release or Pending&nbsp;&nbsp;Delete status. A backorder with a Wish List status can be deleted at&nbsp;&nbsp;any time, at any amount. </p>
<p>* Once you are added to an active auction, you can increase your&nbsp;&nbsp;bid/proxy amounts. Please double-check the amount before you submit as&nbsp;&nbsp;your bids CANNOT be deleted or reduced. There are no refunds once you&nbsp;&nbsp;win an auction.</p>
<p>* Bid amounts significantly over the minimum required will produce a&nbsp;&nbsp;popup warning, giving you a chance to cancel and re-enter your bid if&nbsp;&nbsp;the amount was a typo or in error.</p>
<p>* All auctions awarded OVER $5,000 require a Bank Wire Transfer. They will not automatically charge to your credit card.</p>
<p>We suggest you browse the Frequently Asked Questions pages to&nbsp;&nbsp;familiarize yourself with all auctions and backorder procedures. This&nbsp;&nbsp;can be found by clicking on the &ldquo;Help&rdquo; link in the upper right corner of&nbsp;&nbsp;the website: http://www.namejet.com/Pages/FAQ.aspx</p>
<p>Should you require additional support or have auction questions, please submit a new ticket with complete details.</p>
<p>We look forward to a long partnership and appreciate your interest in our NameJet Program. Good Luck with your auctions!</p>
<p>Sincerely,</p>
<p>Derek<br /> Technical Support Team</p>
</blockquote>
<p>原来已经通过认证，只是需要重新登陆一下（我自己的电脑是记录Cookie的），这里赞一下Namejet的效率，同时BS一下国内某些注册商的变态！</p>
<p>到此，认证已经完成，虽然我打了不少字，也引用了不少文字，但是主要是为了让新手们更清楚一些，实际上步骤简单快捷，并没有一些人想像的复杂。</p>
<p>PS:我在论坛上看到有朋友说他没有国际传真怎么Namejet认证，其实现在大家都应该很清楚，你只要有扫描仪或者数码相机就可以了，而且，看官方说明，他们是不接受传真来认证的，呵呵！</p>
<p><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 本文采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">BY-NC-SA</a> 协议进行授权 | <a href="http://www.4520.info">4520</a><br />转载请注明转自《<a rel="bookmark" title="Namejet Verified Bidder（竞投人认证）教程" href="http://www.4520.info/post/292">Namejet Verified Bidder（竞投人认证）教程</a>》</p>]]></content:encoded>
			<wfw:commentRss>http://www.4520.info/post/292/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>实现SSH命令行显示中文</title>
		<link>http://www.4520.info/post/291</link>
		<comments>http://www.4520.info/post/291#comments</comments>
		<pubDate>Sun, 03 Jul 2011 05:46:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[unix/linux]]></category>

		<guid isPermaLink="false">http://www.4520.info/wp?p=291</guid>
		<description><![CDATA[经常要用PUTTY（一个免费的、Windows 32平台下的telnet、rlogin和ssh客户端）登录到VPS的Centos系统上管理。但使用vi打开带有中文的文件时却无法正常显示中文，而是显示为乱码，这样对我造成比较麻烦的无法看到中文注释。　　现在解决这个问题了，方法如下：　　步骤一、按下图修改PUTTY设置（附中英版）步骤二、修改/etc/sysconfig/i18n下配置文件如下（如果没找到i18n，就自己用vi命令建一个，一般都有的，但我的VPS上的Centos上竟然没有）：LANG=&#34;zh_CN.GB18030&#34;SUPPORTED=&#34;zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en&#34;SYSFONT=&#34;latarcyrheb-sun16&#34;保存之后，SSH重新登录既可以显示中文了。 声明: 本文采用 BY-NC-SA 协议进行授权 &#124; 4520转载请注明转自《实现SSH命令行显示中文》]]></description>
			<content:encoded><![CDATA[<p>经常要用PUTTY（一个免费的、Windows 32平台下的telnet、rlogin和ssh客户端）登录到VPS的Centos系统上管理。<br />但使用vi打开带有中文的文件时却无法正常显示中文，而是显示为乱码，这样对我造成比较麻烦的无法看到中文注释。<br />　　现在解决这个问题了，方法如下：<a name="entrymore"></a><br />　　步骤一、按下图修改PUTTY设置（附中英版）<br />步骤二、修改/etc/sysconfig/i18n下配置文件如下（如果没找到i18n，就自己用vi命令建一个，<br />一般都有的，但我的VPS上的Centos上竟然没有）：<br />LANG=&quot;zh_CN.GB18030&quot;<br />SUPPORTED=&quot;zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en&quot;<br />SYSFONT=&quot;latarcyrheb-sun16&quot;<br />保存之后，SSH重新登录既可以显示中文了。<br /><span id="more-291"></span><br /><img class="insertimage" src="attachment.php?fid=35" border="0" /><br /><img class="insertimage" src="attachment.php?fid=36" border="0" /><br /><img class="insertimage" src="attachment.php?fid=37" border="0" /></p>
<p><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 本文采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">BY-NC-SA</a> 协议进行授权 | <a href="http://www.4520.info">4520</a><br />转载请注明转自《<a rel="bookmark" title="实现SSH命令行显示中文" href="http://www.4520.info/post/291">实现SSH命令行显示中文</a>》</p>]]></content:encoded>
			<wfw:commentRss>http://www.4520.info/post/291/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gg</title>
		<link>http://www.4520.info/post/290</link>
		<comments>http://www.4520.info/post/290#comments</comments>
		<pubDate>Sun, 19 Jun 2011 08:06:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[域名]]></category>

		<guid isPermaLink="false">http://www.4520.info/wp?p=290</guid>
		<description><![CDATA[7/12 声明: 本文采用 BY-NC-SA 协议进行授权 &#124; 4520转载请注明转自《gg》]]></description>
			<content:encoded><![CDATA[<p>7/12<span id="more-290"></span><script src="http://www.clocklink.com/embed.js"></script><script type="text/javascript" language="JavaScript">obj=new Object;obj.clockfile="9001e-blue.swf";obj.TimeZone="PST";obj.width=320;obj.height=20;obj.Target="2011,7,12,20,00,0";obj.Title="gg";obj.Message="";obj.wmode="transparent";showClock(obj);</script></p>
<p><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 本文采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">BY-NC-SA</a> 协议进行授权 | <a href="http://www.4520.info">4520</a><br />转载请注明转自《<a rel="bookmark" title="gg" href="http://www.4520.info/post/290">gg</a>》</p>]]></content:encoded>
			<wfw:commentRss>http://www.4520.info/post/290/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DirectAdmin面板下安装Zend Opitimizer教程</title>
		<link>http://www.4520.info/post/288</link>
		<comments>http://www.4520.info/post/288#comments</comments>
		<pubDate>Thu, 16 Jun 2011 05:38:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[程序]]></category>

		<guid isPermaLink="false">http://www.4520.info/wp?p=288</guid>
		<description><![CDATA[cd /usr/local/src mkdir zend cd zend wget http://downloads.zend.com/optimizer/3.3.0a/ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz #具体版本可以去官方看或者自己需要哪个版本 tar -xzvf ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz cd ZendOptimizer-3.3.0a-linux-* ./install.sh 　　安装过程中会出现很多yes no的选项，以及是否覆盖php.ini，都按y确定即可，界面和装系统有点相像。 安装完成后，大家可以用探针看下就可以了。 　　另外一个办法： vi /usr/local/directadmin/custombuild/options.conf &#160; 　　把里面的 zend=no 改成 zend=yes. cd /usr/local/directadmin/scripts ./customapache.sh &#160; 　　耐心的等待吧！最后界面都差不多，很多yes no的选项，以及是否覆盖php.ini，都按y确定即可！ 声明: 本文采用 BY-NC-SA 协议进行授权 &#124; 4520转载请注明转自《DirectAdmin面板下安装Zend Opitimizer教程》]]></description>
			<content:encoded><![CDATA[<blockquote><p>cd /usr/local/src</p>
<p>mkdir zend</p>
<p><span id="more-288"></span></p>
<p>cd zend</p>
<p>wget http://downloads.zend.com/optimizer/3.3.0a/ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz<br /> #具体版本可以去官方看或者自己需要哪个版本</p>
<p>tar -xzvf ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz</p>
<p>cd ZendOptimizer-3.3.0a-linux-*</p>
<p>./install.sh</p>
</blockquote>
<p>　　安装过程中会出现很多yes no的选项，以及是否覆盖php.ini，都按y确定即可，界面和装系统有点相像。</p>
<p>安装完成后，大家可以用探针看下就可以了。</p>
<p>　　另外一个办法：</p>
<blockquote><p>vi /usr/local/directadmin/custombuild/options.conf</p>
</blockquote>
<p>&nbsp;</p>
<p>　　把里面的 zend=no 改成 zend=yes.</p>
<blockquote><p>cd /usr/local/directadmin/scripts</p>
<p>./customapache.sh</p>
</blockquote>
<p>&nbsp;</p>
<p>　　耐心的等待吧！最后界面都差不多，很多yes no的选项，以及是否覆盖php.ini，都按y确定即可！</p>
<p><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 本文采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">BY-NC-SA</a> 协议进行授权 | <a href="http://www.4520.info">4520</a><br />转载请注明转自《<a rel="bookmark" title="DirectAdmin面板下安装Zend Opitimizer教程" href="http://www.4520.info/post/288">DirectAdmin面板下安装Zend Opitimizer教程</a>》</p>]]></content:encoded>
			<wfw:commentRss>http://www.4520.info/post/288/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

