X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_register.lua;h=fda717f723cdb7be53abdc0a314de9b0a63dd487;hb=refs%2Fheads%2Fmaster;hp=ee19672235270ae5e045eeefc6664845ef423c60;hpb=876f6c1cc19d491c71c38a8f29048865cc12d3a8;p=prosody.git diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua index ee196722..fda717f7 100644 --- 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 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 or nil); local function check_throttle(ip) if not throttle_max then return true end