-- Do not check ratelimits for these recipients
local whitelisted_rcpts = {'postmaster', 'mailer-daemon'}
local whitelisted_ip
+local whitelisted_user
local max_rcpt = 5
local redis_params
local ratelimit_symbol
-- Get user (authuser)
local auser = task:get_user()
if auser and settings['user'][1] > 0 then
- table.insert(args, {settings['user'], make_rate_key ('user', {['user'] = auser}) })
+ if whitelisted_user and whitelisted_user:get_key(auser) then
+ rspamd_logger.infox(task, 'skip ratelimit for whitelisted user')
+ else
+ table.insert(args, {settings['user'], make_rate_key ('user', {['user'] = auser}) })
+ end
end
local asn
if settings['asn'][1] > 0 then
whitelisted_ip = rspamd_config:add_radix_map(opts['whitelisted_ip'], 'Ratelimit whitelist ip map')
end
+ if opts['whitelisted_user'] then
+ whitelisted_user = rspamd_config:add_kv_map(opts['whitelisted_user'], 'Ratelimit whitelist user map')
+ end
+
if opts['symbol'] then
-- We want symbol instead of pre-result
ratelimit_symbol = opts['symbol']