diff --git a/kamailio/antiflood-role.cfg b/kamailio/antiflood-role.cfg index 35a370d..63ac37e 100644 --- a/kamailio/antiflood-role.cfg +++ b/kamailio/antiflood-role.cfg @@ -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; } diff --git a/kamailio/registrar-role.cfg b/kamailio/registrar-role.cfg index 5b677ad..72e06cd 100644 --- a/kamailio/registrar-role.cfg +++ b/kamailio/registrar-role.cfg @@ -102,9 +102,9 @@ route[ATTEMPT_AUTHORIZATION] exit; } - if ($kzR != $null) { - xlog("L_DBG", "$ci|log|caching SIP credentials for $Au"); - $sht(auth_cache=>$Au) = $avp(password); + if ($sht(auth_cache=>$Au) == $null) { + xlog("L_INFO", "$ci|log|caching SIP credentials for $Au"); + $sht(auth_cache=>$Au) = $var(password); } # user authenticated - remove auth header