Dos攻撃 対策 mod_evasive
apxsが必要なので、httpd-develをインストール
確認方法
# httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c <-------------★
http://www.zdziarski.com/projects/mod_evasive/
# tar zxfv mod_evasive_1.10.1.tar.gz
# cd ./mod_evasive
# apxs -i -a -c mod_evasive20.c
# vi /etc/httpd/conf/httpd.conf
httpd.confの適当な所に、次のように記述します。
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 3
DOSSiteCount 50
DOSPageInterval 2
DOSSiteInterval 1
DOSBlockingPeriod 60
DOSWhitelist 127.0.0.1 192.168.1.*
DOSEmailNotify yourmail@yourdomain.com
</IfModule>
httpdを再起動します。
# /etc/rc.d/init.d/httpd restart
動作説明
あるIPアドレスが50以上の異なるページを一秒以内ごとにリクエスト(DOSSiteCount 50)
あるいは同じページを2秒間に3回以上リロード(DOSPageInterval 2) (DOSPageCount 3)
上記の場合、60秒間、そのIPアドレスを遮断する。(DOSBlockingPeriod 60)
なお、DOSWhitelistのアドレスは対象外とする。
参照
http://www.aubetec.com/hiruneko/blog/archives/2007/05/apachedosmod_evasive.html