Comparison

plugins/mod_register_limits.lua @ 8585:046041a37c1e

mod_register_limits: Log message for white- and blacklist hits separate
author Kim Alvefur <zash@zash.se>
date Sat, 10 Mar 2018 02:27:09 +0100
parent 8584:e3d953481f7d
child 8586:c3b87a37c100
comparison
equal deleted inserted replaced
8584:e3d953481f7d 8585:046041a37c1e
58 local session = event.session; 58 local session = event.session;
59 local ip = event.ip or session and session.ip; 59 local ip = event.ip or session and session.ip;
60 local log = session and session.log or module._log; 60 local log = session and session.log or module._log;
61 if not ip then 61 if not ip then
62 log("debug", "User's IP not known; can't apply blacklist/whitelist"); 62 log("debug", "User's IP not known; can't apply blacklist/whitelist");
63 elseif ip_in_set(blacklisted_ips, event.ip) or (whitelist_only and not ip_in_set(whitelisted_ips, ip)) then 63 elseif ip_in_set(blacklisted_ips, event.ip) then
64 log("debug", "Registration disallowed by white- or blacklist"); 64 log("debug", "Registration disallowed by blacklist");
65 event.allowed = false;
66 elseif (whitelist_only and not ip_in_set(whitelisted_ips, ip)) then
67 log("debug", "Registration disallowed by whitelist");
65 event.allowed = false; 68 event.allowed = false;
66 elseif throttle_max and not ip_in_set(whitelisted_ips, ip) then 69 elseif throttle_max and not ip_in_set(whitelisted_ips, ip) then
67 if not check_throttle(event.ip) then 70 if not check_throttle(event.ip) then
68 log("debug", "Registrations over limit for ip %s", ip or "?"); 71 log("debug", "Registrations over limit for ip %s", ip or "?");
69 event.allowed = false; 72 event.allowed = false;