comparison mod_limit_auth/mod_limit_auth.lua @ 1941:2a5a44d5b935

mod_limit_auth: Only apply limit to normal c2s sessions (thanks cuc)
author Kim Alvefur <zash@zash.se>
date Fri, 30 Oct 2015 17:47:48 +0100
parents 450ada5bb1b5
children
comparison
equal deleted inserted replaced
1940:453eee191e18 1941:2a5a44d5b935
32 return throttle; 32 return throttle;
33 end 33 end
34 34
35 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-sasl:auth", function (event) 35 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-sasl:auth", function (event)
36 local origin = event.origin; 36 local origin = event.origin;
37 if origin.type ~= "c2s_unauthed" then return end
37 if not get_throttle(origin.ip):peek(1) then 38 if not get_throttle(origin.ip):peek(1) then
38 origin.log("warn", "Too many authentication attepmts for ip %s", origin.ip); 39 origin.log("warn", "Too many authentication attepmts for ip %s", origin.ip);
39 tarpit_delay(); 40 tarpit_delay();
40 origin.send(reply); 41 origin.send(reply);
41 return true; 42 return true;