Apacheでバナーを制限する(ServerTokens)




バージョン 2.0.58

Apacheはリクエストに対してHTTP headerの中にサーバの情報を含めてリプライを返す
サーバの情報を漏らすことは攻撃への足がかりとなってしまうため、
漏れる情報はなるべく制限したい

まずは、どのような情報を返しているかを確認する
# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
OPTIONS * HTTP/1.1
Host: localhost
 
HTTP/1.1 200 OK
Date: Mon, 31 Jul 2006 04:40:29 GMT
Server: Apache/2.0.58 (Unix)  ←バージョン,OSを返している
Allow: GET,HEAD,POST,OPTIONS,TRACE
Content-Length: 0
Content-Type: text/plain


リプライに含める情報を製品名だけに制限する
httpd.confにて以下を記述
ServerTokens Prod

httpdを再起動して反映
再度確認してみる

# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
OPTIONS * HTTP/1.1
Host: localhost
 
HTTP/1.1 200 OK
Date: Mon, 31 Jul 2006 04:40:29 GMT
Server: Apache  ←製品名だけ!
Allow: GET,HEAD,POST,OPTIONS,TRACE
Content-Length: 0
Content-Type: text/plain