apache的httpd不断发送http请求到陌生的IP地址

最近我注意到我的服务器一直在通过netstat -na发送数据到奇怪的位置“121.11.76.48”。

为了找出它发送的是什么,我试了一下:

 tcpdump -i eth0 host 121.11.76.48 -nnvvXSs 1514 

并发现它不断发送HTTP请求到这个位置:

 22:55:21.179353 IP (tos 0x0, ttl 64, id 26103, offset 0, flags [DF], proto: TCP (6), length: 296) 192.168.1.13.58155 > 121.11.76.48.80: P, cksum 0x880b (incorrect (-> 0xd884), 1904784743:1904784999(256) ack 915059568 win 46 0x0000: 4500 0128 65f7 4000 4006 4ce8 c0a8 010d E..(e.@[email protected]..... 0x0010: 790b 4c30 e32b 0050 7188 b567 368a b370 y.L0.+.Pq..g6..p 0x0020: 5018 002e 880b 0000 4745 5420 2f20 4854 P.......GET./.HT 0x0030: 5450 2f31 2e31 0d0a 486f 7374 3a20 0d0a TP/1.1..Host:... 0x0040: 4163 6365 7074 3a20 2a2f 2a0d 0a52 6566 Accept:.*/*..Ref 0x0050: 6572 6572 3a20 6874 7470 3a2f 2f77 7777 erer:.http://www 0x0060: 2e78 6264 796d 2e63 6f6d 2f69 6e64 6578 .xbdym.com/index 0x0070: 2e61 7370 0d0a 4163 6365 7074 2d4c 616e .asp..Accept-Lan 0x0080: 6775 6167 653a 207a 682d 636e 0d0a 4163 guage:.zh-cn..Ac 0x0090: 6365 7074 2d45 6e63 6f64 696e 673a 2067 cept-Encoding:.g 0x00a0: 7a69 702c 2064 6566 6c61 7465 0d0a 5573 zip,.deflate..Us 0x00b0: 6572 2d41 6765 6e74 3a20 4d6f 7a69 6c6c er-Agent:.Mozill 0x00c0: 612f 342e 3020 2863 6f6d 7061 7469 626c a/4.0.(compatibl 0x00d0: 653b 204d 5349 4520 362e 303b 2057 696e e;.MSIE.6.0;.Win 0x00e0: 646f 7773 2035 2e31 290d 0a50 7261 676d dows.5.1)..Pragm 0x00f0: 613a 206e 6f2d 6361 6368 650d 0a56 6961 a:.no-cache..Via 

显然,在我的服务器上的东西不断发送数据包(约1包/秒),以IE6浏览器www.xbdym.com(这是121.11.76.48)!

但是,我的盒子是一个Linux的盒子(CentOS 5.6),没有办法运行它的IE6。 我没有安装任何Windows VM。

然后,我使用lsof -i来查找进程发送数据包的过程!

 httpd 13232 apache 20u IPv4 326404481 TCP 192.168.1.13:48988->121.11.76.48:http (ESTABLISHED) 

这是apache! 这很奇怪,为什么Apache会频繁地向这个位置发送数据包?

然后我挖掘到Apache的日志,并在access_log中find很多logging:

 121.11.80.126 - - [23/Dec/2011:22:58:58 +0800] "GET http://www.xbdym.com HTTP/1.1" 502 495 "http://www.xbdym.com/index.asp" "Mozilla/4.0 (compatible; MSIE 6.0; Windows 5.1)" 

并在rewrite.log中:

 121.11.80.126 - - [23/Dec/2011:23:05:57 +0800] [www.xbdym.com/sid#2b1de9435be0][rid#2b1df49d6ad0/initial] (1) pass through proxy:http://www.xbdym.com 

我的服务器是否像代理一样行事? 事实上,直接连接到我的服务器被redirect到我的内部Java服务器(由ProxyPass和ProxyPassReserve设置),我设置了这个:

 RewriteEngine On RewriteCond %{HTTP_HOST} ^myserver.com RewriteLog "/home/myserver/log/rewrite.log" RewriteLogLevel 1 

那里有一个“ RewriteCond ”,不以“myserver.com”开头的主机不应该通过! 但是,它是如何通过我的代理! 而且,如何阻止它!

环境:

 httpd-2.2.3-53.el5.centos.3 CentOS 5.6 2.6.18-238.12.1.el5xen 

– 更新 –

我的ProxyPass设置:

 ProxyPreserveHost on ProxyPass /app http://localhost:8080/app ProxyPassReverse /app http://localhost:8080/app 

一个RewriteCond行只会影响下一个被处理的RewriteRule 。 它本身不做任何事情。

由于在configuration的代码片段中没有RewriteRule ,所以我最好的猜测是RewriteCond什么都不做。

应该阻止任何不发送正确的Host:标题的快速更改:

 RewriteCond %{HTTP_HOST} !^myserver.com RewriteRule - - [F] 

你对你所看到的分析似乎对我来说是正确的。 您的Apache被configuration为开放中继。

你的ProxyPass和ProxyPassReverse行是什么样的? (我认为你实际上在你的Apacheconfiguration中写了ProxyPassReverse而不是ProxyPassReserve。)

我注意到这个请求发送了一个空的Host:头,这很奇怪。 我怀疑你的VirtualHostconfiguration为默认值,这意味着它将处理所有请求,即使Host:头不匹配ServerNameServerAliasvariables。

关于如何在Apache wiki中添加一个额外的非代理默认VirtualHost,有一些build议。 而且,为了完整起见 ,这里是一个mod_proxy文档的链接。