<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Doctor's WebLog]]></title> 
<link>http://www.gaobo.info/index.php</link> 
<description><![CDATA[博乐的自留地]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Doctor's WebLog]]></copyright>
<item>
<link>http://www.gaobo.info/read.php/720.htm</link>
<title><![CDATA[绑定Bluehost主域名到任意目录]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Wed, 04 Aug 2010 09:23:00 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/720.htm</guid> 
<description>
<![CDATA[ 
	BlueHost的主机还是不错的，速度也还能接受，只是注册的时候填写的主域名默认是绑定到/public_html下的，不太方便，官方已经有了解决办法：<a href="http://helpdesk.bluehost.com/index.php/kb/article/000347" target="_blank">http://helpdesk.bluehost.com/index.php/kb/article/000347</a><br/>做法如下：<br/>打开/public_html下的.htaccess，在后边新增<br/><div class="code"># Bluehost.com<br/># .htaccess main domain to subdirectory redirect<br/># Copy and paste the following code into the .htaccess file<br/># in the public_html folder of your hosting account<br/># make the changes to the file according to the instructions.<br/># Do not change this line.<br/>RewriteEngine on<br/># Change yourdomain.com to be your main domain.<br/>RewriteCond %&#123;HTTP_HOST&#125; ^(www.)?yourmaindomain.com$<br/># Change &#039;subdirectory&#039; to be the directory you will use for your main domain.<br/>RewriteCond %&#123;REQUEST_URI&#125; !^/subdirectory/<br/># Don&#039;t change this line.<br/>RewriteCond %&#123;REQUEST_FILENAME&#125; !-f<br/>RewriteCond %&#123;REQUEST_FILENAME&#125; !-d<br/># Change &#039;subdirectory&#039; to be the directory you will use for your main domain.<br/>RewriteRule ^(.*)$ /subdirectory/$1<br/># Change yourdomain.com to be your main domain again.<br/># Change &#039;subdirectory&#039; to be the directory you will use for your main domain<br/># followed by / then the main file for your site, index.php, index.html, etc.<br/>RewriteCond %&#123;HTTP_HOST&#125; ^(www.)?yourmaindomain.com$<br/>RewriteRule ^(/)?$ subdirectory/index.php &#91;L&#93;</div><br/>把其中的yourmaindomain.com换成主域名，subdirectory改成子目录名字即可。<br/>注意，这么做后/public_html目录下不能有index.php，否则访问的时候会打开这个文件。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/bluehost/" rel="tag">bluehost</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%2599%259A%25E6%258B%259F%25E4%25B8%25BB%25E6%259C%25BA/" rel="tag">虚拟主机</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%259F%259F%25E5%2590%258D/" rel="tag">域名</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25BB%2591%25E5%25AE%259A/" rel="tag">绑定</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%259B%25AE%25E5%25BD%2595/" rel="tag">目录</a> , <a href="http://www.gaobo.info/go.php/tags/htaccess/" rel="tag">htaccess</a> , <a href="http://www.gaobo.info/go.php/tags/rewrite/" rel="tag">rewrite</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/707.htm</link>
<title><![CDATA[如何消除网站安全的七大风险]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Thu, 20 May 2010 01:14:32 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/707.htm</guid> 
<description>
<![CDATA[ 
	<p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">(本文来自《程序员》杂志10年02期)<br /><br /></span><br /></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">以工作中某项目的安全改善过程为例，分享了常用网站安全性的典型问题和解决对策，希望对网站开发者有借鉴意义。</span><span style="font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">有过网站开发经验的朋友都知道网站安全是构建网站时必须要考虑的一个因素，网站安全的重点在于服务器的安全配置管理以及程序脚本的完善性。值得注意的是，如果服务器的账号和权限由于管理不善而泄露了，即使技术上网站系统再安全，也不可避免会受到攻击。</span><span style="font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">在笔者曾经参与过的一个项目中，客户方邀请了专业的第三方安全测试公司进行了安全性的全面检测，同时也针对性地进行了安全性的改善，特别是在应用程序方面。此文将分享改善过程中的几个典型问题的分析和解决对策，包括SQL注入攻击、跨站点脚本攻击、验证码绕过等，希望能够为大家在改善网站安全方面的工作提供参考，并采取相应的防范措施。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt"><br /></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">项目背景</span><span style="font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">该项目使用的技术和平台：</span><span style="font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">OS：Windows&nbsp;2008&nbsp;Server,&nbsp;Enterprise&nbsp;Edition&nbsp;64-bit</span><span style="font-size: 7.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">Database：Microsoft&nbsp;SQL&nbsp;2005&nbsp;Server,&nbsp;Standard&nbsp;Edition</span><span style="font-size: 7.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">WebServer：IIS7.0</span><span style="font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">开发平台：.NET&nbsp;Framework&nbsp;2.0</span><span style="font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">考虑到网站安全的跨平台和通用性，文中讨论时仅提供对应策略不使用实际代码，这里所有的项目网站用到的域名统一用example.com代替。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt"><br /></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">改善之前</span><span style="font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">第三方专业安全测试公司进行测试，其中的重点问题列表如下：</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt"><img src="http://www.programmer.com.cn/wp-content/uploads/2010/05/%E6%9C%AA%E6%A0%87%E9%A2%98-2-300x274.gif" border="0" alt="未标题-2" title="未标题-2" width="300" height="274" /><br /></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">问题1：易受到SQL注入攻击</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">风险</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">攻击者可以通过应用程序发送数据库命令，这些命令将被服务器执行。这可以用来对数据库进行完全控制。这些SQL注入漏洞可以通过在其中一个区域插入&ldquo;and&nbsp;7&nbsp;=&nbsp;7&nbsp;-&rdquo;或&ldquo;and&nbsp;8&nbsp;=&nbsp;9&nbsp;-&rdquo;，并比较结果进行判断。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">分析</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">SQL注入攻击是由于服务器对参数检查不够，而导致攻击者借此获得敏感信息。因此，需要使用参数化查询以确保攻击者无法操作数据库的SQL查询语句。例如，如果应用程序要求输入名称，那它应该只接受字母字符、空格和撇号，而不接受任何其他字符。也就是说，在应用程序中的所有输入域实施服务器端白名单技术。特别是所有用于SQL语句的输入域，需要空格的都应该用引号括起来。 </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">改善</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">在程序中所有可接受外部参数的地方进行逐一识别，以过滤危险字符。如在全局函数中定义&ldquo;禁止字符串列表&rdquo;，该表中列出所要过滤出的SQL攻击代码可能包含的字符串。</span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">and&nbsp;&#124;exec&nbsp;&#124;insert&nbsp;&#124;select&nbsp;&#124;delete&nbsp;&#124;update&nbsp;&#124;count&nbsp;&#124;&nbsp;*&nbsp;&#124;chr&nbsp;&#124;mid&nbsp;&#124;master&nbsp;&#124;truncate&nbsp;&#124;char&nbsp;&#124;declare&nbsp;&#124;&lt;&#124;&gt;&#124;&rsquo;&#124;(&#124;)&#124;&#123;&#124;&#125; </span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">//当然可以根据网站的特点完善和修改本列表</span><span style="font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">接下来做如下处理：</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt"><img src="http://www.programmer.com.cn/wp-content/uploads/2010/05/%E6%9C%AA%E6%A0%87%E9%A2%98-1-300x74.gif" border="0" alt="未标题-1" title="未标题-1" width="300" height="74" /><br /></span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">问题2：易受到跨站点脚本攻击</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">风险</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">此漏洞可以被用来获取身份验证Cookie，攻击管理员账户，或使应用程序的用户攻击其他服务器和系统。该漏洞可以通过在某区域中插入&ldquo;&lt;script&gt;alert(&lsquo;23389950&rsquo;);&lt;/script&gt;&rdquo;来判断。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">分析</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">这也需要在本网站的所有输入域实施服务器端白名单技术。如果需要特殊字符，应该转换为更安全的形式。如适用于各种语言的HTML转码：</span></p><ul><li><span style="font-size: 10.5pt">&amp;应转换为&nbsp;&amp;；</span></li><li><span style="font-size: 10.5pt">&ldquo;应转换为&rdquo;；</span></li><li><span style="font-size: 10.5pt">&lsquo;应转换为&amp;39；</span></li><li><span style="font-size: 10.5pt">&gt;应转换为&gt;；</span></li><li><span style="font-size: 10.5pt">&lt;应转换为&lt;。</span></li></ul><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">改善</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">除了这些标准的HTML转码之外，对于可疑字符串也要进行强化检查和转化，并进一步执行以下操作：（1）对各页面的输入参数进行强化检查；（2）对原来只在客户端判断的参数，在服务器端进一步强化检查;（3）最终提供了全局的转码和过滤的函数。当然这需要在性能和扩展性以及安全性方面的平衡综合考虑。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">问题3：非安全的CrossDomain.XML文件</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">风险</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">为解决Flash/Flex系统中的跨域问题，提出了crossdomain.xml跨域策略文件。虽然可以解决跨域问题，但是也带来了恶意攻击的风险，如果该策略文件里允许访问任何域，就可能允许发起对网络服务器的跨站点请求伪造和跨站点脚本攻击。比如，不安全Flash应用程序可能会访问本地数据和用户保存的网页记录，甚至传播病毒和恶意代码。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">分析</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">考虑如何确保只对提供安全资源的可信域开放允许。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">改善</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">经过调查，发现在程序目录下的crossdomain.xml文件里的配置如下：</span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">&lt;?xml&nbsp;version=&rdquo;1.0&Prime;?&gt;</span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">&lt;!DOCTYPE&nbsp;cross-domain-policy&nbsp;SYSTEM&nbsp;&rdquo;<a href="http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd&rdquo;&gt;" target="_blank">http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd&rdquo;&gt;</a></span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">&lt;cross-domain-policy&gt;</span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">&lt;allow-access-from&nbsp;domain=&rdquo;*&rdquo;&nbsp;/&gt;</span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">&lt;/cross-domain-policy&gt; </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">文件中的allow-access-from&nbsp;实体设置为星号设置为允许任何域访问，将其修改为&nbsp;&lt;allow-access-from&nbsp;domain=&rdquo;*.example.com&rdquo;&nbsp;/&gt;，表示只允许本域访问，该问题就解决了。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">问题4：Flash参数AllowScript-Access&nbsp;已设置为always</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">风险</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">当AllowScriptAccess为always时，表明嵌入的第三方Flash文件可以执行代码。攻击者此时就可以利用该缺陷嵌入任意第三方Flash文件而执行恶意</span><span style="font-size: 10.5pt"><br /></span><span style="font-size: 10.5pt">代码。</span> </p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">分析</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">AllowScriptAccess参数可以是&ldquo;always&rdquo;、&rdquo;sameDomain&rdquo;或&ldquo;never&rdquo;。三个可选值中，&ldquo;always&rdquo;&nbsp;表示Flash文件可以与其嵌入到的&nbsp;HTML&nbsp;页进行通信，即使该Flash文件来自不同于HTML页的域也可以。当参数为&ldquo;sameDomain&rdquo;时，仅当Flash文件与其嵌入到的HTML页来自相同的域时，该Flash文件才能与该HTML页进行通信，此值是AllowScriptAccess&nbsp;的默认值。而当AllowScriptAccess为&nbsp;&ldquo;never&rdquo;时，Flash文件将无法与任何HTML页进行通信。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">因此需要将AllowScriptAccess参数设置为&ldquo;sameDomain&rdquo;，可以防止一个域中的Flash文件访问另一个域的&nbsp;HTML&nbsp;页内的脚本。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">改善</span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">&lt;param</span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">name=&rdquo;allowScriptAccess&rdquo;&nbsp;value=&rdquo;always&rdquo;&nbsp;/&gt;</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">改为</span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">&lt;param </span></p><p style="margin-top: 0pt; text-indent: 15pt; margin-bottom: 0pt"><span style="font-size: 7.5pt">name=&rdquo;allowScriptAccess&rdquo;&nbsp;value=&ldquo;sameDomain&rdquo;&nbsp;/&gt;</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">问题5：网站后台管理通过不安全链接实施</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">风险</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">管理访问没有强制实施SSL，这可能允许攻击者监视并修改用户和服务器之间的发送的包括账户凭据在内的所有数据。如果攻击者通过代理或者路由软件拦截服务器和管理员间的通信，敏感数据可能被截获，进而管理员账户可能会受到危害。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">分析</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">管理访问没有强制实施SSL，为防止数据拦截，管理访问应该强制执行HTTPS&nbsp;(SSL3.0)。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">改善</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">运维对服务器进行了配置调整，单独配置支持了SSL3.0访问管理后台。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">问题6：验证环节可以被绕过</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">风险</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">用户发布信息时，虽然有页面的验证码防止自动恶意发布，但仍可能被绕过进行自动提交。绕过的方式之一是使用过滤和识别软件，之二是可以利用Cookie或Session信息绕过验证码。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">分析</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">图像失真机制本身不是特别强，可以很容易地使用公开的过滤和识别软件来识别。生成的图片也是可以预测的，因为使用的字符集很简单（只是数字），建议实现一个更强大的验证码系统。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">Cookie或session信息处理有漏洞导致验证码被绕过,&nbsp;确保每一个链接只能取得唯一的验证码，并确保每个请求产生并需要一个新的验证码。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">改善</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">根据需要增加验证码的复杂度，而不只是单数字。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">经过分析发现是因为验证码被存入了Session里，而开发人员忘记在提交之后清空Session中的验证码的值，导致验证码在过期时间内一直可用，从而可能被利用多次提交。因此在提交后追加了及时清空验证码的操作。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">问题7：泄露敏感信息</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">风险</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">此信息只能用于协助利用其他漏洞，并不能直接用来破坏应用程序。网站的robots.txt文件里可以获得敏感目录的信息，这可能允许攻击者获得有关应用程序内部的其他信息，这些信息可能被用来攻击其他漏洞。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">分析</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">robots.txt不应在提供管理界面的信息。如果robots.txt文件暴露了Web站点结构，则需要将敏感内容移至隔离位置，以避免搜索引擎机器人搜索到此内容。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">改善</span><span style="font-size: 10.5pt">：</span><span style="font-size: 10.5pt">当然robots.txt要根据SEO的要求来处理，但也要同样注意安全性。如：disallow:/testadmin/，其中testadmin为管理后台，就被暴露了。可以根据实际情况是否必要决定删除robots.txt文件或者把敏感目录单独配置禁止搜索引擎搜索。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">其他问题汇总</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">除此以外，还有很多其他危害性相对较低的问题，分析如下。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: normal">问题：可能通过登录页面枚举出用户名，因为根据账户是否存在的错误信息是不同的。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: normal">对策：修改错误信息使之不带有提示性，如&ldquo;您输入的邮箱或密码不对!&rdquo;&nbsp;并且超过一定次数则对该IP进行锁定。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: normal">问题：检测到可能泄露敏感信息或被恶意利用的冗余文件，如测试文件、bak文件、临时文件。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">对策：除去服务器中的相应文件。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">问题：发现潜在机密信息，如名为order的文件很容易被联想到用户订单。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">对策：避免在文件名中含有完整的敏感词汇或不要在容易猜测到的文件中保存敏感信息，或者限制对它们的访问。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">问题：发现内部信息泄露。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">对策：除去代码中漏删的内部IP地址，内部组织，人员相关信息等。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt"><br /></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">共性原因分析</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">在发现的问题中，71%是与应用程序相关的安全性问题。可以修改应用程序相关的安全性问题，因为它们是由应用程序代码中的缺陷造成的。29%是基础结构和平台安全性问题，可以由系统或网络管理员来修订&ldquo;基础结构和平台安全性问题&rdquo;，因为这些安全性问题是由第三方产品中的错误配置或缺陷造成的。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">综合主要的原因包括但不限于以下三个方面。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">程序方面</span></p><ul><li><span style="font-size: 10.5pt">未对用户输入正确执行危险字符清理；</span></li><li><span style="font-size: 10.5pt">Cookie和Session使用时安全性考虑不足；</span></li><li><span style="font-size: 10.5pt">HTML注释中或Hidden&nbsp;form包含敏感信息；</span></li><li><span style="font-size: 10.5pt">提供给用户的错误信息包含敏感信息；</span></li><li><span style="font-size: 10.5pt">程序员在&nbsp;Web&nbsp;页面上的调试信息等没有及时删除。</span></li><li><span style="font-size: 10.5pt">Web&nbsp;应用程序编程或配置不安全；</span></li></ul><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">配置方面</span><span style="font-size: 10.5pt"> </span><span style="font-size: 10.5pt"><br /></span></p><ul><li><span style="font-size: 10.5pt">在Web目录中留下的冗余文件没有及时清理；</span></li><li><span style="font-size: 10.5pt">Web服务器或应用程序服务器是以不安全的方式配置的。</span></li><li><span style="font-size: 10.5pt">安全规范文档不够完善，开发人员的培训不足；</span></li><li><span style="font-size: 10.5pt">开发人员的安全相关经验和安全意识不足。</span></li></ul><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt; font-weight: bold">对于这些问题的解决方法-&mdash;&mdash;技术之外</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">对于安全问题本身的解决可能只能case&nbsp;by&nbsp;case&nbsp;，但为了预防更多潜在问题的引入，技术之外方面的改善也不容忽视：</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">1.&nbsp;对于开发人员在项目初期即进行安全开发的培训，强化安全意识。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">2.&nbsp;建立用于共享安全经验的平台，将经验形成Checklist作为安全指南文档。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">3.&nbsp;将成熟的代码成果提炼出公共安全模块以备后用。</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">本次改善之后总结出一些常用基本安全原则供大家参考，见&ldquo;非官方不完整网站开发安全原则&rdquo;。<br /><br />作者简介：晁晓娟，目前在互联网公司负责项目管理。InfoQ中文站SOA社区编辑，有多年的Web开发管理经验，关注项目管理、架构和产品。</span></p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/site/" rel="tag">site</a> , <a href="http://www.gaobo.info/go.php/tags/safety/" rel="tag">safety</a> , <a href="http://www.gaobo.info/go.php/tags/sql/" rel="tag">sql</a> , <a href="http://www.gaobo.info/go.php/tags/injection/" rel="tag">injection</a> , <a href="http://www.gaobo.info/go.php/tags/cookie/" rel="tag">cookie</a> , <a href="http://www.gaobo.info/go.php/tags/crosssite/" rel="tag">crosssite</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25AB%2599%25E7%2582%25B9/" rel="tag">站点</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25BD%2591%25E7%25AB%2599/" rel="tag">网站</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25AE%2589%25E5%2585%25A8%25E6%2580%25A7/" rel="tag">安全性</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B3%25A8%25E5%2585%25A5/" rel="tag">注入</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25B7%25A8%25E7%25AB%2599/" rel="tag">跨站</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/474.htm</link>
<title><![CDATA[一根电源转接线救活了一台服务器]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Sun, 27 Jan 2008 09:42:46 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/474.htm</guid> 
<description>
<![CDATA[ 
	等待这台机器的时间有点久了。从10月就开始说要上，结果硬是到了今天（08.1.27）才算弄好。<br />一开始是打算把原来那台黑机器搬过来用，但是拿过来后发现CPU又成了一个，折腾了许久后来发现板子也挂了&hellip;&hellip;祸不单行啊&hellip;&hellip;&hellip;&hellip;<img src="images/emot/shuai.gif" border="0" width="24" height="24" /><br />没辙，taobao和eachnet搜索，发现有人在卖个Dell 1600SC的拆机板子，价钱不错，buy！<br />拿到后检查，Dell的做工真的不错<img src="images/emot/grin.gif" border="0" width="24" height="24" />可是等装机的时候却发现板子太大，无法放进原来的机箱&hellip;&hellip;<img src="images/emot/unhappy.gif" border="0" width="24" height="24" /><br />于是继续taobao、eachnet找2U机箱（1U的放不下），真又让我找到，哇卡卡。等机箱到手，已经是元月了。<br />结果发现原配的电源和Dell的板子似乎有问题，Dell的板子上多出一个8针的电源接口。不插这个，开机CPU风扇转，硬盘、光驱都有电，就是显示器不亮&hellip;&hellip;用原来黑机器的电源也不行，貌似必须转。。。<img src="images/emot/cry.gif" border="0" width="24" height="24" /><br />前天到石桥铺转了圈，搜刮了许久，又找到一根4针转8针的电源转接线<img src="images/emot/envy.gif" border="0" width="24" height="24" />今天插上试了试，真的可以！！只是有一点美中不足的是2U的机箱里边放了偌大一个标准的电源，而原配的电源虽然没坏但是用不上。。。<br />获得的经验：电源插头中白色塑料的最大的一个插头不插的话，其他的插头都没电（因为没有基本负载），为此才只有用标准电源，我昏&hellip;&hellip;<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/%25E7%2594%25B5%25E6%25BA%2590/" rel="tag">电源</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%259C%25BA%25E7%25AE%25B1/" rel="tag">机箱</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%259C%258D%25E5%258A%25A1%25E5%2599%25A8/" rel="tag">服务器</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25BD%25AC%25E6%258E%25A5/" rel="tag">转接</a> , <a href="http://www.gaobo.info/go.php/tags/dell/" rel="tag">dell</a> , <a href="http://www.gaobo.info/go.php/tags/taobao/" rel="tag">taobao</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B7%2598%25E5%25AE%259D/" rel="tag">淘宝</a> , <a href="http://www.gaobo.info/go.php/tags/eachnet/" rel="tag">eachnet</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2598%2593%25E8%25B6%25A3/" rel="tag">易趣</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/126.htm</link>
<title><![CDATA[郁闷，服务器被D的厉害]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Mon, 29 May 2006 13:34:53 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/126.htm</guid> 
<description>
<![CDATA[ 
	超级汗水，传说中的DDOS居然找到我们的Server来了，<br/>真想874这个恶作剧的人一百遍啊一百遍…………<br/><br/>两个小时后，DDOS的暴风骤雨数据包结束了，站点终于恢复正常中～～
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/0.htm</link>
<title><![CDATA[WebLog Reload!]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Tue, 14 Mar 2006 05:33:15 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/0.htm</guid> 
<description>
<![CDATA[ 
	OK了？<br/>OK了，<br/>Doctor&#039;s WebLog reload！
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/48.htm</link>
<title><![CDATA[给站点换了新的首页]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Sun, 21 Aug 2005 02:57:59 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/48.htm</guid> 
<description>
<![CDATA[ 
	呵呵，先前的那个打开太慢了，忍无可忍还是换掉了<br/>新的这个我花了一天时间来做，偷的模板，嘿嘿<br/>程序没花多久，图片整整用了4个多小时，到最后眼睛也花了，头也晕了，唉，累死～～
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/47.htm</link>
<title><![CDATA[北京之行的感受]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Sun, 07 Aug 2005 09:14:56 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/47.htm</guid> 
<description>
<![CDATA[ 
	终于去了北京。<br/>时间仓促，仅仅游览了国家博物馆、王府井等地，主要是看到了Crossday等人，呵呵，他们都比我想象中的要“司创”（strong）的多，^_^～～<br/>此次北京之行最大的感受就是自己的一些想法和思路发生了转变，过去一直主导我的技术的思想发生的变化，我不再固执的坚持技术优先，加深了对一些事情和看法的理解……<br/><br/>PS：回来休息了下后，完成了论坛的WAP Edition，现在支持WAP的手机也可以浏览精英三人行了，呵呵～～
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/46.htm</link>
<title><![CDATA[中国顶级门户网站架构分析]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Wed, 02 Mar 2005 00:24:58 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/46.htm</guid> 
<description>
<![CDATA[ 
	　　新浪和搜狐在国内的知名度可谓无人不知无人不晓。他们每天的点击率都在千万以上。这样大的访问量对于新浪和搜狐来说怎样利用有限的资源让网民获得最快的速度成为首要的前提，毕竟现在网络公司已经离开了烧钱的阶段，开始了良性发展，每一笔钱砸下去都需要一定回响才行的。另一方面，技术人员要绞尽脑汁，不能让用户老是无法访问、或者访问速度极慢。这样就算有再好的编辑、再好的销售，他们也很难将广告位卖出去，等待他们的将是关门。当然这些情况都没有发生，因为他们的技术人员都充分的利用了现有资源并将他们发挥到了极至。说到底就是用squid做web &nbsp;cache &nbsp;server，而apache在squid的后面提供真正的web服务。当然使用这样的架构必须要保证主页上大部分都是静态页面。这就需要程序员的配合将页面在反馈给客户端之前将页面全部转换成静态页面。好了基本架构就这样，下面说说我怎么猜到的以及具体的架构：<br/>　　法宝之一：nslookup<br/><br/>　　实战：<br/><br/>nslookup &nbsp;<a href="http://www.sina.com.cn" target="_blank">www.sina.com.cn</a><br/>Server: &nbsp;ns-px.online.sh.cn<br/>Address: &nbsp;202.96.209.5<br/><br/>Non-authoritative &nbsp;answer:<br/>Name: &nbsp;taurus.sina.com.cn<br/>Addresses: &nbsp;61.172.201.230, &nbsp;61.172.201.231, &nbsp;61.172.201.232, &nbsp;61.172.201.233<br/>61.172.201.221, &nbsp;61.172.201.222, &nbsp;61.172.201.223, &nbsp;61.172.201.224, &nbsp;61.172.201.225<br/>61.172.201.226, &nbsp;61.172.201.227, &nbsp;61.172.201.228, &nbsp;61.172.201.229<br/>Aliases: &nbsp;<a href="http://www.sina.com.cn" target="_blank">www.sina.com.cn</a>, &nbsp;jupiter.sina.com.cn<br/><br/>　　这里可以看到新浪在首页上用到了那么多IP，开始有人会想果然新浪财大气粗啊。其实不然，继续往下看：<br/><br/>nslookup &nbsp;news.sina.com.cn<br/>Server: &nbsp;ns-px.online.sh.cn<br/>Address: &nbsp;202.96.209.5<br/><br/>Non-authoritative &nbsp;answer:<br/>Name: &nbsp;taurus.sina.com.cn<br/>Addresses: &nbsp;61.172.201.228, &nbsp;61.172.201.229, &nbsp;61.172.201.230, &nbsp;61.172.201.231<br/>61.172.201.232, &nbsp;61.172.201.233, &nbsp;61.172.201.221, &nbsp;61.172.201.222, &nbsp;61.172.201.223<br/>61.172.201.224, &nbsp;61.172.201.225, &nbsp;61.172.201.226, &nbsp;61.172.201.227<br/>Aliases: &nbsp;news.sina.com.cn, &nbsp;jupiter.sina.com.cn<br/><br/>　　细心的人可以发现了news这个频道的ip数和首页上一样，而且IP也完全一样。也就是这些IP在sina的DNS上的名字都叫 &nbsp;taurus.sina.com.cn，那些IP都是这个域的A记录。而news,sports,jczs.news。。。都是CNAME记录。用DNS &nbsp;来做自动轮询。还不信，再来一个，就体育频道好了：<br/><br/>nslookup &nbsp;sports.sina.com.cn<br/>Server: &nbsp;ns-px.online.sh.cn<br/>Address: &nbsp;202.96.209.5<br/><br/>Non-authoritative &nbsp;answer:<br/>Name: &nbsp;taurus.sina.com.cn<br/>Addresses: &nbsp;61.172.201.222, &nbsp;61.172.201.223, &nbsp;61.172.201.224, &nbsp;61.172.201.225<br/>61.172.201.226, &nbsp;61.172.201.227, &nbsp;61.172.201.228, &nbsp;61.172.201.229, &nbsp;61.172.201.230<br/>61.172.201.231, &nbsp;61.172.201.232, &nbsp;61.172.201.233, &nbsp;61.172.201.221<br/>Aliases: &nbsp;sports.sina.com.cn, &nbsp;jupiter.sina.com.cn<br/><br/>　　其他的可以自己试。好了再来看看sohu的情况：<br/><br/>nslookup &nbsp;<a href="http://www.sohu.com" target="_blank">www.sohu.com</a><br/>Server: &nbsp;ns-px.online.sh.cn<br/>Address: &nbsp;202.96.209.5<br/><br/>Non-authoritative &nbsp;answer:<br/>Name: &nbsp;pagegrp1.sohu.com<br/>Addresses: &nbsp;61.135.132.172, &nbsp;61.135.132.173, &nbsp;61.135.132.176, &nbsp;61.135.133.109<br/>61.135.145.47, &nbsp;61.135.150.65, &nbsp;61.135.150.67, &nbsp;61.135.150.69, &nbsp;61.135.150.74<br/>61.135.150.75, &nbsp;61.135.150.145, &nbsp;61.135.131.73, &nbsp;61.135.131.91, &nbsp;61.135.131.180<br/>61.135.131.182, &nbsp;61.135.131.183, &nbsp;61.135.132.65, &nbsp;61.135.132.80<br/>Aliases: &nbsp;<a href="http://www.sohu.com" target="_blank">www.sohu.com</a><br/><br/>－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－<br/><br/>nslookup &nbsp;news.sohu.com<br/>Server: &nbsp;ns-px.online.sh.cn<br/>Address: &nbsp;202.96.209.5<br/><br/>Non-authoritative &nbsp;answer:<br/>Name: &nbsp;pagegrp1.sohu.com<br/>Addresses: &nbsp;61.135.150.145, &nbsp;61.135.131.73, &nbsp;61.135.131.91, &nbsp;61.135.131.180<br/>61.135.131.182, &nbsp;61.135.131.183, &nbsp;61.135.132.65, &nbsp;61.135.132.80, &nbsp;61.135.132.172<br/>61.135.132.173, &nbsp;61.135.132.176, &nbsp;61.135.133.109, &nbsp;61.135.145.47, &nbsp;61.135.150.65<br/>61.135.150.67, &nbsp;61.135.150.69, &nbsp;61.135.150.74, &nbsp;61.135.150.75<br/>Aliases: &nbsp;news.sohu.com<br/><br/>　　情况和sina一样，只是从表面来看sohu的IP数要多于sina的IP数，那么sohu上各个频道用的服务器就要多于sina了？当然不能这么说，因为一台服务器可以绑定多个IP，因此不能从IP数的多少来判断用了多少服务器。<br/><br/>　　从上面这些实验可以基本看出sina和sohu对于频道等栏目都用了相同的技术，即squid来监听这些IP的80端口，而真正的web &nbsp;server来监听另外一个端口。从用户的感觉上来说不会有任何的区别，而相对于将web &nbsp;server直接和客户端连在一起的方式，这样的方式明显的节省的带宽和服务器。用户访问的速度感觉也会更快。<br/>　　1. &nbsp;难道就根据几个域名的ip相同就可以证明他们是使用squid的嘛？<br/><br/>　　当然不是，前面都只是推测。下面才是真正的证实我上面的猜测。先nslookup一把sina的体育频道。<br/><br/>nslookup &nbsp;sports.sina.com.cn<br/>Server: &nbsp;ns1.china.com<br/>Address: &nbsp;61.151.243.136<br/>Non-authoritative &nbsp;answer:<br/>Name: &nbsp;taurus.sina.com.cn<br/>Addresses:61.172.201.231, &nbsp;61.172.201.232, &nbsp;61.172.201.233, &nbsp;61.172.201.9<br/>61.172.201.10, &nbsp;61.172.201.11, &nbsp;61.172.201.12, &nbsp;61.172.201.13, &nbsp;61.172.201.14<br/>61.172.201.15, &nbsp;61.172.201.16, &nbsp;61.172.201.17, &nbsp;61.172.201.227, &nbsp;61.172.201.228<br/>61.172.201.229, &nbsp;61.172.201.230<br/>Aliases: &nbsp;sports.sina.com.cn, &nbsp;jupiter.sina.com.cn<br/><br/>　　然后直接访问这些ip中的任意一个ip试试看，访问下来的结果应该是如下图所示：<br/><br/><br/><br/>　　由此可以证明sina是在dns中设置了很多ip来指向域名sqsh-19.sina.com.cn，而其他各种相同性质的频道都只是sqsh- &nbsp;19.sina.com.cn一个别名，用CNAME指定。dns的设置应该是这样的，然后server方面，通过squid &nbsp;2.5.STABLE5（最新的稳定版为STABLE6）来侦听80端口。上面这些是根据一些信息分析而出的，应该基本正确的。下面一些就是我的个人的猜想：<br/><br/>　　它的真正的web &nbsp;server也同样是侦听80端口，因为在squid配置文件中有一项是：<br/><br/>httpd_accel_port &nbsp;80<br/><br/>　　如果你设成其他端口号（比如88）的话，那上图的错误信息就会变成<br/><br/>While &nbsp;trying &nbsp;to &nbsp;retrieve &nbsp;the &nbsp;URL: &nbsp;<a href="http://61.172.201.19:88" target="_blank">http://61.172.201.19:88</a><br/><br/>　　工具2：nmap扫描程序：可以用来检查服务器开了什么端口。<br/><br/>　　我现在用nmap来扫描sina的一个ip：61.172.201.19来进行分析<br/><br/>bash-2.05$ &nbsp;nmap &nbsp;61.172.201.19<br/><br/>Starting &nbsp;nmap &nbsp;3.50 &nbsp;( &nbsp;<a href="http://www.insecure.org/nmap/" target="_blank">http://www.insecure.org/nmap/</a> &nbsp;) &nbsp;at &nbsp;2004-07-30 &nbsp;13:31 &nbsp;GMT<br/>Interesting &nbsp;ports &nbsp;on &nbsp;61.172.201.19:<br/>(The &nbsp;1657 &nbsp;ports &nbsp;scanned &nbsp;but &nbsp;not &nbsp;shown &nbsp;below &nbsp;are &nbsp;in &nbsp;state: &nbsp;filtered)<br/>PORT &nbsp;STATE &nbsp;SERVICE<br/>22/tcp &nbsp;open &nbsp;ssh<br/>80/tcp &nbsp;open &nbsp;http<br/><br/>Nmap &nbsp;run &nbsp;completed &nbsp;-- &nbsp;1 &nbsp;IP &nbsp;address &nbsp;(1 &nbsp;host &nbsp;up) &nbsp;scanned &nbsp;in &nbsp;73.191 &nbsp;seconds<br/><br/>　　可以看到他对外只开了2个端口，80端口就是刚才我们说的squid打开的，这点刚才已经验证过了。而22端口是用来ssh远程连接的，主要是sa用来远程操作服务器用的安全性非常高的方法。<br/><br/>　　工具3：lynx或者其他可以读取http头文件的工具及小程序：<br/><br/>　　直接看例子比较好理解：<br/><br/>HTTP/1.0 &nbsp;200 &nbsp;OK<br/>Date: &nbsp;Fri, &nbsp;30 &nbsp;Jul &nbsp;2004 &nbsp;05:49:47 &nbsp;GMT<br/>Server: &nbsp;Apache/2.0.49 &nbsp;(Unix)<br/>Last-Modified: &nbsp;Fri, &nbsp;30 &nbsp;Jul &nbsp;2004 &nbsp;05:48:16 &nbsp;GMT<br/>Accept-Ranges: &nbsp;bytes<br/>Vary: &nbsp;Accept-Encoding<br/>Cache-Control: &nbsp;max-age=60<br/>Expires: &nbsp;Fri, &nbsp;30 &nbsp;Jul &nbsp;2004 &nbsp;05:50:47 &nbsp;GMT<br/>Content-Length: &nbsp;180747<br/>Content-Type: &nbsp;text/html<br/>Age: &nbsp;37<br/>X-Cache: &nbsp;HIT &nbsp;from &nbsp;sqsh-230.sina.com.cn<br/>Connection: &nbsp;close<br/><br/>　　上面是sina的http头的反馈信息。里面有很多有价值的东东哦：）譬如，它后面的apache是用2.0.49，还设了过期时间为2分钟。最后修改时间。这些都是要在编译apache的时候载入的，特别是Last-Modified还需要小小的改一把源码--至少我是这样做的。<br/><br/>　　综上所述<br/><br/>　　sina的架构应该是前面squid，按照现在的服务器2u，2g内存一般每台服务器至少可以跑4个squid2.5stable5. &nbsp;这样它16个ip就用了4台服务器。后面一层是apache2.0.49应该会用2台。这2台可能用的全是私有ip，通过前面的squid服务器在 &nbsp;hosts文件中指定。具体的实现方法我会下次整理出我做实验的文档：）而apache的htdocs可能是有一个或2个磁盘阵列作nfs。apache &nbsp;mount &nbsp;nfs &nbsp;server的时候应该是只读的，然后另外还有服务器转门用来做编辑器服务器，用来编辑人员更新文章。这台服务器应该对nfs &nbsp;server是具有可写的权限。<br/><br/>　　----这就一套完整的sina所运用的方案，当然很多是靠猜测的，我没有和sina的技术人员有过任何沟通（因为一个也不认识），否则我也就不会写出来了。其他sohu，163应该也有这样的架构。<br/><br/>　　最后声明：这只是一些静态页面组成频道的一个架构，sina还有很多其他服务器，什么下载，在线更新等不在这个架构中。
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/45.htm</link>
<title><![CDATA[假期结束了，精英三人行将走向全面商业化]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Thu, 17 Feb 2005 07:02:44 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/45.htm</guid> 
<description>
<![CDATA[ 
	放假回去之前，服务器终于找到了好的归宿，现在的情况是10MB独享，希望速度应该可以满足需要。<br/>现在的三人行已经包括：论坛、博客站、软件站（123xia）、音乐站四大主力子站，近期打算统一风格，然后推向市场，进行商业化运作。
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/42.htm</link>
<title><![CDATA[Header模板错误纠正完毕]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Mon, 25 Oct 2004 08:48:09 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/42.htm</guid> 
<description>
<![CDATA[ 
	今天才发现Header模板的广告在某些页面无法显示出来，于是马上更改代码……<br/>原来是一段初始化代码的小问题，已经搞定，～～
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/44.htm</link>
<title><![CDATA[最近运气好背，!_!]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Sat, 16 Oct 2004 09:51:39 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/44.htm</guid> 
<description>
<![CDATA[ 
	不知道是怎么回事，最近做什么事情都不顺：Modem速度不快、自己的电脑出现怪怪的问题、网线也时通时断、工作忙的不可开交还要被加上更多的份外事……<br/><br/>郁闷ing……<br/><br/>看来真的得去拜佛了，就周六吧，“同去、同去”～～<br/><br/>@_@、*_*、!_!<br/><br/>……
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/41.htm</link>
<title><![CDATA[胃也闹起了革命]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Fri, 15 Oct 2004 16:03:42 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/41.htm</guid> 
<description>
<![CDATA[ 
	搞了一个星期的服劣器，从来没有过的黑眼圈悄悄爬上了眼睛，头发也是三天没洗了<br/><br/>现在似乎胃也闹起了革命，相当不舒服的说，看来又得去找“四大叔”了，呵呵～～<br/><br/>不过，服务器比较稳定了总是意见令人开心的事，^_^～～
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/40.htm</link>
<title><![CDATA[音乐站程序基本OK]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Thu, 14 Oct 2004 10:30:55 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/40.htm</guid> 
<description>
<![CDATA[ 
	经过一整天的艰苦奋斗，终于解决了音乐程序的问题，呵～～<br/><br/>在此我要感谢我亲爱的老婆，还有毛毛虫，还有fkeelieen……，谢谢你们的关心、照顾和支持，你们是我最大的财富！<br/><br/>也请所有精英三人行的会员相信：<br/><a href="http://www.gaobo.info/attachment/1142344422.gif" target="_blank"><img src="http://www.gaobo.info/attachment/1142344422.gif" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/39.htm</link>
<title><![CDATA[郁闷]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Wed, 13 Oct 2004 23:30:52 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/39.htm</guid> 
<description>
<![CDATA[ 
	怎么服务器过一段时间自己重启呢？<br/><br/>不是电源的原因，电源已经换过了；其他的设备也不会自己重启啊。<br/><br/>今天早上它自己还死机了一次，不知道什么原因的说～～
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/38.htm</link>
<title><![CDATA[谢天谢地，它工作啦！～～]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Wed, 13 Oct 2004 16:46:32 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/38.htm</guid> 
<description>
<![CDATA[ 
	哈哈，它终于OK啦，精英三人行的朋友们终于有了自己的Blog啦，^_^～～
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/43.htm</link>
<title><![CDATA[出口的庆祝]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[站点进化史]]></category>
<pubDate>Mon, 11 Oct 2004 16:38:30 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/43.htm</guid> 
<description>
<![CDATA[ 
	终于OK了，^_^～～<br/><br/>晚上和大家举行第六次肠胃扩大会议，只是没少了些熟悉的面孔，多了些新人，呵呵～～<br/><br/><br/>硬盘加上了，在转移数据；新的Modem也换上了，原来真的如偶所料，是Modem的原因～～<br/><br/><br/>晚上不小心再次晕倒，害的大家都担心了，^_^，没事的，擦破点皮而已，偶好好的，^_^～～
]]>
</description>
</item>
</channel>
</rss>