aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/ratelimit.lua
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-10-30 14:18:17 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-10-30 14:18:17 +0200
commit06eba57df9e10bdfd2192cdb91c74be3a10f7a9e (patch)
tree1e87be5d61302fde4fd5df18cb0f9a642b7095b1 /src/plugins/lua/ratelimit.lua
parent3e155850244b8c7a93fca5ba1052547e3f7d3ccf (diff)
downloadrspamd-06eba57df9e10bdfd2192cdb91c74be3a10f7a9e.tar.gz
rspamd-06eba57df9e10bdfd2192cdb91c74be3a10f7a9e.zip
[Minor] Ratelimit: support adding informational symbol
Diffstat (limited to 'src/plugins/lua/ratelimit.lua')
-rw-r--r--src/plugins/lua/ratelimit.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua
index 1d35f7f5e..217c36171 100644
--- a/src/plugins/lua/ratelimit.lua
+++ b/src/plugins/lua/ratelimit.lua
@@ -32,6 +32,7 @@ local whitelisted_user
local max_rcpt = 5
local redis_params
local ratelimit_symbol
+local info_symbol
-- Do not delay mail after 1 day
local use_ip_score = false
local rl_prefix = 'RL'
@@ -388,6 +389,9 @@ local function process_buckets(task, buckets)
end
if not data then return end
if data[1] == 1 then
+ if info_symbol then
+ task:insert_result(info_symbol, 1.0, data[2])
+ end
rspamd_logger.infox(task,
'ratelimit "%s" exceeded',
data[2])
@@ -677,6 +681,11 @@ if opts then
ratelimit_symbol = opts['symbol']
end
+ if opts['info_symbol'] then
+ -- We want symbol in addition to pre-result
+ info_symbol = opts['info_symbol']
+ end
+
if opts['max_rcpt'] then
max_rcpt = tonumber(opts['max_rcpt'])
end
@@ -720,6 +729,8 @@ if opts then
end
if ratelimit_symbol then
s.name = ratelimit_symbol
+ elseif info_symbol then
+ s.name = info_symbol
end
local id = rspamd_config:register_symbol(s)
if use_ip_score then