projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
876f6c1
)
mod_register: Support for blacklisting ips that are still over limit when they get...
author
Kim Alvefur
<zash@zash.se>
Wed, 23 Dec 2015 08:00:03 +0000
(09:00 +0100)
committer
Kim Alvefur
<zash@zash.se>
Wed, 23 Dec 2015 08:00:03 +0000
(09:00 +0100)
plugins/mod_register.lua
patch
|
blob
|
history
diff --git
a/plugins/mod_register.lua
b/plugins/mod_register.lua
index ee19672235270ae5e045eeefc6664845ef423c60..1961b27654743b65d4eedb48a10b7cc43663e9cf 100644
(file)
--- a/
plugins/mod_register.lua
+++ b/
plugins/mod_register.lua
@@
-180,8
+180,14
@@
local blacklisted_ips = module:get_option_set("registration_blacklist", {})._ite
local throttle_max = module:get_option_number("registration_throttle_max", min_seconds_between_registrations and 1);
local throttle_period = module:get_option_number("registration_throttle_period", min_seconds_between_registrations);
local throttle_cache_size = module:get_option_number("registration_throttle_cache_size", 100);
local throttle_max = module:get_option_number("registration_throttle_max", min_seconds_between_registrations and 1);
local throttle_period = module:get_option_number("registration_throttle_period", min_seconds_between_registrations);
local throttle_cache_size = module:get_option_number("registration_throttle_cache_size", 100);
+local blacklist_overflow = module_get_option_boolean("blacklist_on_registration_throttle_overload", false);
-local throttle_cache = new_cache(throttle_cache_size);
+local throttle_cache = new_cache(throttle_cache_size, blacklist_overflow and function (ip, throttle)
+ if not throttle:peek() then
+ module:log("info", "Adding ip %s to registration blacklist", ip);
+ blacklisted_ips[ip] = true;
+ end
+end);
local function check_throttle(ip)
if not throttle_max then return true end
local function check_throttle(ip)
if not throttle_max then return true end