作者:Yiming Gong http://security.zz.ha.cn
- Q% ]/ O1 u+ H6 O* b4 H默认情况下apache是会给client端回显版本号码的,可以测试如下,在client端使用nc联接起着apache的目的主机80端口,发送错误的get请求
yiming# nc security.zz.ha.cn 80 get index.lakdsjf/ \# y4 X' A t3 M7 i; E1 ? <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">7 l( F$ y2 B9 {# g <html><head> <title>400 Bad Request</title> </head><body> <h1>Bad Request</h1> <p>Your browser sent a request that this server could not understand.<br /> </p> <hr />: o& h' ?; F. N) V <address>Apache/x.y.z Server at security.zz.ha.cn Port 80</address> </body></html>
我们看到上面显示了apache的版本号(:) 俺隐去了真实版本),这可不太好,能修改一下么?/ k8 _; K c% j: g& |1 }( c5 d 答案是肯定的! 改动apache的配置文件,找到ServerTokens和ServerSignature两个directive,修改默认属性: 如下
# and compiled in modules., L/ M/ K6 d3 b+ `# K # # ServerTokens # This directive configures what you return as the Server HTTP response # Header. The default is 'Full' which sends information about the OS-Type # and compiled in modules. # Set to one of: Full | OS | Minor | Minimal | Major | Prod B3 C1 U x* d! o # where Full conveys the most information, and Prod the least. # #ServerTokens Full. {% e' N1 m( X" z0 O ServerTokens Prod
" @) n# i5 ~; V% E#% w* |1 _3 a, z' r% B A # Optionally add a line containing the server version and virtual host' X4 J& V* s3 t% K # name to server-generated pages (internal error documents, FTP directory3 F# M9 j4 d& a0 v9 \3 X # listings, mod_status and mod_info output etc., but not CGI generated1 ^, K N( H! R" M # documents or custom error documents).5 E5 o- I) E J% b( M4 _6 w # Set to "EMail" to also include a mailt link to the ServerAdmin.! W( \( L8 x f7 j7 M) U9 i # Set to one of: On | Off | EMail6 ~4 z# T+ P0 W& s$ F6 F T # ServerSignature On ServerSignature Off
修改后重起apache,再看看, yiming# nc security.zz.ha.cn 80# q6 w$ H, V, {( K! `$ b4 Z+ a: R" [ get index.lakdsjf <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>400 Bad Request</title> </head><body>- M5 ]) i4 U, S/ s" z' z1 D* M7 a <h1>Bad Request</h1> <p>Your browser sent a request that this server could not understand.<br />5 m( g/ N) f' l3 V& ^ </p> </body></html>
| 欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) | Powered by Discuz! X2.5 |