Browse Source

add registrar perm error condition & macros & defaults

update-rsyslog-config
lazedo 7 years ago
parent
commit
0704f22542
1 changed files with 21 additions and 12 deletions
  1. +21
    -12
      kamailio/registrar-role.cfg

+ 21
- 12
kamailio/registrar-role.cfg View File

@ -30,11 +30,13 @@
#!trydef REGISTRAR_AMQP_FLAGS 0 #!trydef REGISTRAR_AMQP_FLAGS 0
#!trydef REGISTRAR_AMQP_RK_PREFIX authn.req. #!trydef REGISTRAR_AMQP_RK_PREFIX authn.req.
#!trydef REGISTRAR_SEND_100 1 #!trydef REGISTRAR_SEND_100 1
#!trydef REGISTRAR_DB_MODE 3
#!trydef REGISTRAR_DB_MODE 2
#!trydef REGISTRAR_DB_TIMER_CLEANUP 0 #!trydef REGISTRAR_DB_TIMER_CLEANUP 0
#!trydef REGISTRAR_HANDLE_LOST_TCP 0 #!trydef REGISTRAR_HANDLE_LOST_TCP 0
#!trydef REGISTRAR_DB_TIMER_CLEANUP 0
#!trydef REGISTRAR_DB_REMOVE_EXPIRED_DELAY 30
#!trydef REGISTRAR_DB_REMOVE_EXPIRED_DELAY 0
#!trydef REGISTRAR_SYNC_TIMER_INTERVAL 5
#!trydef REGISTRAR_SYNC_TIMER_PROCS 1
#!ifdef REGISTRAR_WARM_CACHE #!ifdef REGISTRAR_WARM_CACHE
#!substdef "!REGISTRAR_S_WARM_CACHE!dbtable=auth_cache;dbmode=1;!g" #!substdef "!REGISTRAR_S_WARM_CACHE!dbtable=auth_cache;dbmode=1;!g"
@ -70,8 +72,9 @@ modparam("usrloc", "db_ops_ruid", 1)
modparam("usrloc", "xavp_contact", "ulattrs") modparam("usrloc", "xavp_contact", "ulattrs")
modparam("usrloc", "timer_interval", 5)
modparam("usrloc", "timer_procs", 1)
modparam("usrloc", "timer_interval", REGISTRAR_SYNC_TIMER_INTERVAL)
modparam("usrloc", "timer_procs", REGISTRAR_SYNC_TIMER_PROCS)
modparam("usrloc", "fetch_rows", 400) modparam("usrloc", "fetch_rows", 400)
modparam("usrloc", "handle_lost_tcp", REGISTRAR_HANDLE_LOST_TCP) modparam("usrloc", "handle_lost_tcp", REGISTRAR_HANDLE_LOST_TCP)
modparam("usrloc", "close_expired_tcp", REGISTRAR_CLOSE_EXPIRED_TCP) modparam("usrloc", "close_expired_tcp", REGISTRAR_CLOSE_EXPIRED_TCP)
@ -121,6 +124,7 @@ modparam("statistics","variable", "registrar:amqp_async_error")
modparam("statistics","variable", "registrar:amqp_returned") modparam("statistics","variable", "registrar:amqp_returned")
modparam("statistics","variable", "registrar:amqp_timeout") modparam("statistics","variable", "registrar:amqp_timeout")
modparam("statistics","variable", "registrar:drops") modparam("statistics","variable", "registrar:drops")
modparam("statistics","variable", "registrar:authn_perm_err")
modparam("statistics","variable", "registrar:authn_err") modparam("statistics","variable", "registrar:authn_err")
modparam("statistics","variable", "registrar:authn_resp") modparam("statistics","variable", "registrar:authn_resp")
modparam("statistics","variable", "registrar:authn_unknown") modparam("statistics","variable", "registrar:authn_unknown")
@ -187,10 +191,15 @@ route[HANDLE_REGISTER]
} }
if($sel(cfg_get.kazoo.registrar_force_query) == 0) { if($sel(cfg_get.kazoo.registrar_force_query) == 0) {
if($sht(auth_cache=>$Au) == "authn_err") {
xlog("L_WARNING", "$ci|end|issuing auth challenge to cached failed registration attempt for $Au from IP $si:$sp\n");
if($sht(auth_cache=>$Au) == "authn_perm_err") {
xlog("L_INFO", "$ci|end|issuing auth challenge to cached permanent failed registration attempt for $Au from IP $si:$sp\n");
update_stat("registrar:authn_perm_err", "+1");
#!ifdef ANTIFLOOD_ROLE
route(ANITFLOOD_FAILED_AUTH);
#!endif
update_stat("registrar:challenge", "+1"); update_stat("registrar:challenge", "+1");
auth_challenge("$fd", "5"); auth_challenge("$fd", "5");
exit;
} else if($sht(auth_cache=>$Au) != $null) { } else if($sht(auth_cache=>$Au) != $null) {
$xavp(regcfg=>match_received) = $su; $xavp(regcfg=>match_received) = $su;
if(registered("location", "$rz:$Au", 2, 1) == 1) { if(registered("location", "$rz:$Au", 2, 1) == 1) {
@ -278,7 +287,9 @@ onreply_route[KZ_AUTHORIZATION_REPLY]
$var(password) = $(kzR{kz.json,Auth-Password}); $var(password) = $(kzR{kz.json,Auth-Password});
$var(nonce) = $adn; $var(nonce) = $adn;
if( $(kzR{kz.json,Event-Name}) == "authn_err" ) { if( $(kzR{kz.json,Event-Name}) == "authn_err" ) {
$sht(auth_cache=>$Au) = "authn_err";
if($(kzR{kz.json,Permanent-Error}) == "true") {
$sht(auth_cache=>$Au) = "authn_perm_err";
}
update_stat("registrar:authn_err", "+1"); update_stat("registrar:authn_err", "+1");
#!ifdef ANTIFLOOD_ROLE #!ifdef ANTIFLOOD_ROLE
route(ANITFLOOD_FAILED_AUTH); route(ANITFLOOD_FAILED_AUTH);
@ -288,19 +299,17 @@ onreply_route[KZ_AUTHORIZATION_REPLY]
xlog("L_INFO", "$ci|end|challenging $Au $si:$sp via $(kzR{kz.json,App-Name})-$(kzR{kz.json,App-Version}) response\n"); xlog("L_INFO", "$ci|end|challenging $Au $si:$sp via $(kzR{kz.json,App-Name})-$(kzR{kz.json,App-Version}) response\n");
exit; exit;
} else if( $(kzR{kz.json,Event-Name}) == "authn_resp" ) { } else if( $(kzR{kz.json,Event-Name}) == "authn_resp" ) {
update_stat("registrar:authn_resp", "+1");
update_stat("registrar:authn_resp", "+1");
xlog("L_INFO", "$ci|log|authenticating $Au via $(kzR{kz.json,App-Name})-$(kzR{kz.json,App-Version}) response\n"); xlog("L_INFO", "$ci|log|authenticating $Au via $(kzR{kz.json,App-Name})-$(kzR{kz.json,App-Version}) response\n");
route(CHECK_AUTHORIZATION); route(CHECK_AUTHORIZATION);
} else { } else {
update_stat("registrar:authn_unknown", "+1"); update_stat("registrar:authn_unknown", "+1");
update_stat("registrar:drops", "+1");
update_stat("registrar:drops", "+1");
xlog("L_INFO", "$ci|log|unhandle response from directory $Au via $(kzR{kz.json,App-Name})-$(kzR{kz.json,App-Version})\n"); xlog("L_INFO", "$ci|log|unhandle response from directory $Au via $(kzR{kz.json,App-Name})-$(kzR{kz.json,App-Version})\n");
t_drop(); t_drop();
} }
} }
route[CHECK_AUTHORIZATION] route[CHECK_AUTHORIZATION]
{ {


Loading…
Cancel
Save