我刚刚在一家新公司开始工作,一直在检查他们的 Apache Web 服务器配置文件的设置……结果发现,在过去两个月里,他们已经将他们的 Apache 服务器设置为开放代理,供全世界使用。我已经在 httpd.conf 文件中将 ProxyRequests 设置为 Off,并重新启动了 Web 服务器,但访问日志文件仍然以惊人的速度增长(大约每天 1 GB)。我注意到这里发布了另一个关于此问题的问题(Apache 受到代理请求的影响),但他们的访问日志据称返回 404 错误,而我的似乎返回 403 和 404 代码...这是正确的吗?
以下是我的访问日志中的几行:
87.118.118.124 - - [16/Mar/2010:10:56:36 -0400] "GET http://www.c5interlude.ru/torrent/viewtopic.php?p=2501 HTTP/1.0" 404 219 "http://www.c5interlude.ru/torrent/viewtopic.php?p=2501" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"
117.41.184.27 - - [16/Mar/2010:10:56:36 -0400] "GET http://ad.xtendmedia.com/st?ad_type=iframe&ad_size=300x250§ion=790074 HTTP/1.0" 404 200 "http://www.newbiegamer.com" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Alexa Toolbar)"
122.224.55.222 - - [16/Mar/2010:10:56:36 -0400] "GET http://www.188woool.net/\xb4\xf3\xd4\xcb\xb4\xab\xca\xc0.rar HTTP/1.1" 403 214 "http://www.188woool.net/\xb4\xf3\xd4\xcb\xb4\xab\xca\xc0.rar" "Mozilla/4.0"
58.55.21.40 - - [16/Mar/2010:10:56:36 -0400] "GET http://www.cpx24.com/ad1.js HTTP/1.0" 404 204 "http://thebighits.com/?id=aibux" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"
122.226.223.188 - - [16/Mar/2010:10:56:36 -0400] "GET http://ad.reduxmedia.com/st?ad_type=iframe&ad_size=160x600§ion=798636 HTTP/1.0" 404 200 "http://www.gvvu.com" "Mozilla/4.0 (compatible; MSIE 5.5; AOL 6.0; Windows 98; Win 9x 4.90)"
84.51.109.31 - - [16/Mar/2010:10:56:36 -0400] "GET http://www.kslp.ru/forum/index.php HTTP/1.0" 404 213 "http://www.kslp.ru/forum/index.php" "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0 ; .NET CLR 2.0.50215; SL Commerce Client v1.0; Tablet PC 2.0"
122.224.48.49 - - [16/Mar/2010:10:56:36 -0400] "GET http://www1.vip218.com/\xb2\xca\xba\xe7\xb4\xab\xca\xc0.exe HTTP/1.1" 403 214 "http://www1.vip218.com/\xb2\xca\xba\xe7\xb4\xab\xca\xc0.exe" "Mozilla/4.0"
117.41.184.27 - - [16/Mar/2010:10:56:36 -0400] "GET http://ad.xtendmedia.com/st?ad_type=iframe&ad_size=728x90§ion=657624 HTTP/1.0" 404 200 "http://www.raiseanimals.com" "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Alexa Toolbar)"
以及我相应的错误日志条目:
[Tue Mar 16 10:56:36 2010] [error] [client 87.118.118.124] File does not exist: C:/public_html/torrent, referer: http://www.c5interlude.ru/torrent/viewtopic.php?p=2501
[Tue Mar 16 10:56:36 2010] [error] [client 117.41.184.27] File does not exist: C:/public_html/st, referer: http://www.newbiegamer.com
[Tue Mar 16 10:56:36 2010] [error] [client 122.224.55.222] (22)Invalid argument: Cannot map GET http://www.188woool.net/\xb4\xf3\xd4\xcb\xb4\xab\xca\xc0.rar HTTP/1.1 to file, referer: http://www.188woool.net/\xb4\xf3\xd4\xcb\xb4\xab\xca\xc0.rar
[Tue Mar 16 10:56:36 2010] [error] [client 58.55.21.40] File does not exist: C:/public_html/ad1.js, referer: http://thebighits.com/?id=aibux
[Tue Mar 16 10:56:36 2010] [error] [client 122.226.223.188] File does not exist: C:/public_html/st, referer: http://www.gvvu.com
[Tue Mar 16 10:56:36 2010] [error] [client 84.51.109.31] File does not exist: C:/public_html/forum, referer: http://www.kslp.ru/forum/index.php
[Tue Mar 16 10:56:36 2010] [error] [client 122.224.48.49] (22)Invalid argument: Cannot map GET http://www1.vip218.com/\xb2\xca\xba\xe7\xb4\xab\xca\xc0.exe HTTP/1.1 to file, referer: http://www1.vip218.com/\xb2\xca\xba\xe7\xb4\xab\xca\xc0.exe
[Tue Mar 16 10:56:36 2010] [error] [client 117.41.184.27] File does not exist: C:/public_html/st, referer: http://www.raiseanimals.com
这实际上看起来像是服务器正确地阻止了它们吗?还有什么我可以做得更好的来减少我的访问日志大小吗?(也许完全阻止来自服务器的这些请求?)
谢谢!Matt
更新:
这些是成功的代理...但是我没有启用 ProxyRequests!!(它甚至没有出现在我的 httpd.conf 文件中(默认为否)但后来ProxyRequests Off
在我的 httpd.conf 文件中添加到了第 4 行)。
95.211.14.24 - - [03/Jun/2010:12:01:24 -0400] "CONNECT mail.yahoo.com:443" 200 6103 "-" "-"
98.126.74.66 - - [03/Jun/2010:12:01:39 -0400] "CONNECT intlreg.aol.com:443 HTTP/1.1" 200 6103 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) )"
98.126.74.66 - - [03/Jun/2010:12:01:40 -0400] "\x16\x03\x01" 200 6103 "-" "-"
91.5.169.251 - - [03/Jun/2010:12:01:43 -0400] "GET http://shop.breho-tools.de/index.php?cat=c95_Doppelhobel.html HTTP/1.0" 200 6103 "-" "-"
114.25.230.147 - - [03/Jun/2010:12:01:50 -0400] "CONNECT mail2000.com.tw:25 HTTP/1.0" 200 6103 "-" "-"
67.208.112.37 - - [03/Jun/2010:12:02:02 -0400] "GET http://yahoo.com:80/ HTTP/1.1" 200 6103 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0 (.NET CLR 3.5.30729)"
67.208.112.37 - - [03/Jun/2010:12:02:18 -0400] "GET http://yahoo.com:80/ HTTP/1.1" 200 6103 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0 (.NET CLR 3.5.30729)"
69.132.95.188 - - [03/Jun/2010:12:02:33 -0400] "GET http://login.vip.kr3.yahoo.com/config/isp_verify_user?l=_sunflowerwoman&p=%20%20%20%20%20 HTTP/1.0" 404 220 "-" "-"
120.37.91.109 - - [03/Jun/2010:12:02:37 -0400] "GET http://543b5be9.linkbucks.com/ HTTP/1.1" 200 6103 "http://dns.ladymx.com:1108/shangcheng/" "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; InfoPath.2; .NET CLR 3.0.30729)"
120.37.91.109 - - [03/Jun/2010:12:02:37 -0400] "GET http://543b5be9.linkbucks.com/RecordClick.aspx?id=&key=&ref=&cacheBust=80493192 HTTP/1.1" 404 214 "http://dns.ladymx.com:1108/shangcheng/" "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; InfoPath.2; .NET CLR 3.0.30729)"
120.37.91.109 - - [03/Jun/2010:12:02:40 -0400] "GET http://543b5be9.linkbucks.com/RecordClick.aspx?id=&key=&ref=&cacheBust=80493192 HTTP/1.1" 404 214 "http://dns.ladymx.com:1108/shangcheng/" "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; InfoPath.2; .NET CLR 3.0.30729)"
66.77.255.230 - - [03/Jun/2010:12:02:40 -0400] "GET http://proxyjudge1.proxyfire.net/fastenv HTTP/1.1" 404 205 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
120.37.91.109 - - [03/Jun/2010:12:02:42 -0400] "GET http://543b5be9.linkbucks.com/RecordClick.aspx?id=&key=&ref=&cacheBust=80493192 HTTP/1.1" 404 214 "http://dns.ladymx.com:1108/shangcheng/" "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; InfoPath.2; .NET CLR 3.0.30729)"
89.149.223.112 - - [03/Jun/2010:12:02:43 -0400] "CONNECT mail.yahoo.com:443" 200 6103 "-" "-"
95.211.0.132 - - [03/Jun/2010:12:02:49 -0400] "CONNECT mail.yahoo.com:443" 200 6103 "-" "-"
217.133.52.34 - - [03/Jun/2010:12:02:52 -0400] "GET http://www.naturalintegrator.com/buoni-regalo-c-21.html HTTP/1.1" 404 220 "http://www.mylevis.us/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
答案1
您返回了 404 和 403(均拒绝各种类型),所以我不担心。我猜您有一个过于乐观的虚拟主机,它捕获了所有流量并试图利用它做些什么。
如果你对其中任何一个返回 2xx 而无法解释它,那就开始担心吧:)
答案2
您还可以阻止除内部子网之外的所有代理请求,这是由http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxy和http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#access。
You can control who can access your proxy via the <Proxy> control block as in the following example:
<Proxy *>
Order Deny,Allow
Deny from all
Allow from 192.168.0
</Proxy>
For more information on access control directives, see mod_authz_host.
Strictly limiting access is essential if you are using a forward proxy (using the ProxyRequests directive). Otherwise, your server can be used by any client to access arbitrary hosts while hiding his or her true identity. This is dangerous both for your network and for the Internet at large. When using a reverse proxy (using the ProxyPass directive with ProxyRequests Off), access control is less critical because clients can only contact the hosts that you have specifically configured.
我相信这将导致客户端出现“403 Forbidden”响应,这比“404 Not Found”稍微不太安全,因为“403 Forbidden”暗示某些东西仍然存在,但是被禁止了。
答案3
您应该只从少数 IP 地址收到代理请求。对这些地址设置防火墙。至少要阻止对 HTTP 的访问,但我会将它们全部设置防火墙。
如果代理是一个模块,则禁用该模块。在 Linux 上,您可以使用 a2dismod 禁用该模块。