Apache Server Status主机状态查看
10月30日,国外安全研究人员发现由于对apache设置不严,导致服务器状态暴露于公网。本来apache有一个叫server-status 的功能,为方便管理员检查服务器运行状态的。它是一个HTML页面,可以显示正在工作的进程数量,每个请求的状态,访问网站的客户端ip地址,正在被请求 的页面。
但是如果这个页面对公网开放,就会存在一些安全隐患,例如任何人口可以看到谁在访问网站,甚至包括一些本来隐藏的管理页面。
如果没有加载这个模块,如果您是linux服务器,那么就需要您重新编译apache了,编译的时候加上参数--enable-module=so即可, 如果你是windows系统的话,无需任何编译,只要把刚才时候说的LoadModule status_module modules/mod_status.so这句加上,如果前面有带#号,开启的话,需要将#去除。
http://192.168.99.99/Server-status?refresh=N将表示访问状态页面可以每N秒自动刷新一次;
在httpd.conf 增加
#-Apache Server Status--------------
ExtendedStatus On
<Location /Server-status>
SetHandler Server-status
Order deny,allow
Deny from all
Allow from 192.168.99.99
</Location>
##--Apache Server Status--end---------
Deny from表示禁止的访问地址,如果访问报错可将此行注释,但是安全性会降低;
Allow from表示允许的地址访问。这里应该写允许的客户端IP,似乎不应该是域名
ExtendedStatus On表示的是待会访问的时候能看到详细的请求信息,另外该设置仅能用于全局设置,不能在特定的虚拟主机中打开或关闭。启用扩展状态信息将会导致服务器运行效率降低。
http://192.168.99.99/Server-status
默认为查看第一个虚拟主机的信息。。。
Apache Server Status for aa.bb.com Server Version: Apache Server Built: Apr 4 2010 17:19:54 Current Time: Friday, 30-Jul-2010 14:58:01 CST Restart Time: Friday, 30-Jul-2010 14:57:38 CST Parent Server Generation: 0 Server uptime: 23 seconds Total accesses: 1 - Total Traffic: 1 kB CPU Usage: u0 s0 cu0 cs0 .0435 requests/sec - 44 B/second - 1024 B/request 1 requests currently being processed, 9 idle workers Scoreboard Key: " _ " Waiting for Connection, " S " Starting up, " R " Reading Request, " W " Sending Reply, " K " Keepalive (read), " D " DNS Lookup, " C " Closing connection, " L " Logging, " G " Gracefully finishing, " I " Idle cleanup of worker, " . " Open slot with no current process Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request 0-0 9297 0/1/1 _ 0.00 11 134 0.0 0.00 0.00 114.92.*.222 aa.bb.com GET /SEC HTTP/1.1 1-0 9306 0/0/0 W 0.00 0 0 0.0 0.00 0.00 114.92.*.222 aa.bb.com GET /Server-status HTTP/1.1 Srv Child Server number - generation PID OS process ID Acc Number of accesses this connection / this child / this slot M Mode of operation CPU CPU usage, number of seconds SS Seconds since beginning of most recent request Req Milliseconds required to process most recent request Conn Kilobytes transferred this connection Child Megabytes transferred this child Slot Total megabytes transferred this slot Apache Server at aa.bb.com Port 80