作者:Yiming Gong2 R. y3 `8 W# j http://security.zz.ha.cn
, {( A+ e1 D# X2 L& g. l4 B默认情况下apache是会给client端回显版本号码的,可以测试如下,在client端使用nc联接起着apache的目的主机80端口,发送错误的get请求
! g9 B+ ]; `: z$ r' _4 {4 Y0 qyiming# nc security.zz.ha.cn 80 get index.lakdsjf9 V+ [0 _8 g0 x% p# o9 V* z, d6 L <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>400 Bad Request</title>" _ s- R& V1 Z </head><body> <h1>Bad Request</h1>' D9 a; Z3 E. |% l' z1 S; e; a6 c <p>Your browser sent a request that this server could not understand.<br />0 }9 u4 z' N5 m </p>/ O! b- b* p9 C <hr />9 {/ [ n) V3 q: ^: ? <address>Apache/x.y.z Server at security.zz.ha.cn Port 80</address>' e4 W( B3 G& @7 p! v9 U- E% u- I6 ` </body></html>
0 A# X7 s% z& R% U/ t8 hB" G. z: L2 ^) ~ [ 我们看到上面显示了apache的版本号(:) 俺隐去了真实版本),这可不太好,能修改一下么? 答案是肯定的! 改动apache的配置文件,找到ServerTokens和ServerSignature两个directive,修改默认属性: 如下
/ O0 ~3 p) J5 u! v# and compiled in modules.; o. n. C2 ?3 ^$ g* s8 ?2 P ## x0 y P1 E% F # 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+ i. |6 h" }3 o, ^2 p1 U8 q# E # where Full conveys the most information, and Prod the least.+ @0 g0 U8 ]% R6 M# ? #( `; r8 X" ^# @6 q; B4 ]9 F #ServerTokens Full$ v9 H: G; k. N9 o+ S9 ^. R8 r; C ServerTokens Prod
# # Optionally add a line containing the server version and virtual host # name to server-generated pages (internal error documents, FTP directory # listings, mod_status and mod_info output etc., but not CGI generated # documents or custom error documents). # Set to "EMail" to also include a mailt link to the ServerAdmin.! \# e# w4 i) f6 f$ c: v # Set to one of: On | Off | EMail [* W+ H) N5 a0 I) c3 j #9 N1 `% y/ n+ J2 `5 g; Z' A P ServerSignature On ServerSignature Off
修改后重起apache,再看看, yiming# nc security.zz.ha.cn 80 c" l0 g1 H& I2 o, \ get index.lakdsjf <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>400 Bad Request</title>. \% o" C! g3 C9 |' F: N- @7 @ </head><body>! O) i- T, J! Z! c' g* R7 ~% j) D( s <h1>Bad Request</h1> <p>Your browser sent a request that this server could not understand.<br />- s; d) x! b& Q$ S+ ^ m( R </p>) h( d0 K' p6 B: u$ G6 n </body></html>
! z. B4 g! z2 Z7 K' q
1 B4 ?. a' l) c# A
| 欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) | Powered by Discuz! X2.5 |