squid でホスト名を隠蔽する






squid のデフォルトではエラーページの表示の際に、ホスト名とバージョン情報を表示してしまう。

この動作はセキュリティ上好ましくない。
できれば隠蔽したい。

squid でバージョン情報を隠蔽する方法はこちらを参照。

squid でホスト名を隠蔽する方法は次の通り。

/etc/squid/squid.conf にて以下を追記する。

visible_hostname [任意のホスト名]

設定例

visible_hostname secret

最後に squid のプロセスを再起動して変更を反映。

/etc/init.d/squid restart

この設定により、アクセス制限でリクエストが拒否された時の エラーページが次のようになりました。

変更前
ERROR
The requested URL could not be retrieved

--------------------------------------------------------------------------------

While trying to retrieve the URL: http://192.168.1.100/ 

The following error was encountered: 

Access Denied. 
Access control configuration prevents your request from being allowed at this time.
 Please contact your service provider if you feel this is incorrect. 

Your cache administrator is root. 



--------------------------------------------------------------------------------

Generated Tue, 21 Apr 2009 09:51:19 GMT by squid.example.net (squid/2.5.STABLE14) 



変更後
ERROR
The requested URL could not be retrieved

--------------------------------------------------------------------------------

While trying to retrieve the URL: http://192.168.1.100/ 

The following error was encountered: 

Access Denied. 
Access control configuration prevents your request from being allowed at this time. 
Please contact your service provider if you feel this is incorrect. 

Your cache administrator is root. 



--------------------------------------------------------------------------------

Generated Tue, 21 Apr 2009 09:52:48 GMT by secret (squid/2.5.STABLE14)