|
|
|
@ -5,8 +5,7 @@ |
|
|
|
#!trydef ANTIFLOOD_FAILED_AUTH_DENSITY 3 |
|
|
|
|
|
|
|
######## Flood Prevention Hash Tables ######## |
|
|
|
modparam("htable", "htable", "ipban=>size=8;autoexpire=300;") |
|
|
|
modparam("htable", "htable", "failed_auth_hash=>size=8;autoexpire=125;") |
|
|
|
modparam("htable", "htable", "failed_auth_hash=>size=8;autoexpire=3600;") |
|
|
|
|
|
|
|
######## Flood Prevention Module ######## |
|
|
|
loadmodule "pike.so" |
|
|
|
@ -21,17 +20,9 @@ route[ANTIFLOOD_RATE_LIMIT] |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if($sht(ipban=>$si)!=$null) { |
|
|
|
# ip is already blocked |
|
|
|
xlog("$ci|log|dropping $rm request from $fu with banned IP $si:$sp"); |
|
|
|
drop(); |
|
|
|
exit; |
|
|
|
} |
|
|
|
|
|
|
|
# use pike to control the rates |
|
|
|
if (!pike_check_req()) { |
|
|
|
xlog("L_WARN", "$ci|log|pike dropping $rm from $fu due to rate of requests with source $si:$sp"); |
|
|
|
$sht(ipban=>$si) = 1; |
|
|
|
drop(); |
|
|
|
exit; |
|
|
|
} |
|
|
|
|