end
end
+exports.is_rspamc_or_controller = function(task)
+ local ua = task:get_request_header('User-Agent') or ''
+ local pwd = task:get_request_header('Password')
+ local is_rspamc = false
+ if tostring(ua) == 'rspamc' or pwd then is_rspamc = true end
+
+ return is_rspamc
+end
+
return exports
local rspamd_logger = require 'rspamd_logger'
local rspamd_http = require "rspamd_http"
+local rspamd_lua_utils = require "lua_util"
if confighelp then
return
end
local function clickhouse_collect(task)
+ if rspamd_lua_utils.is_rspamc_or_controller(task) then return end
local from_domain = ''
local from_user = ''
if task:has_from('smtp') then
local dmarc_grammar = gen_dmarc_grammar()
-local function dmarc_report(task, spf_ok, dkim_ok, disposition, sampled_out, hfromdom, spfdom, dres, spf_result)
+local function dmarc_report(task, spf_ok, dkim_ok, disposition,
+ sampled_out, hfromdom, spfdom, dres, spf_result)
local ip = task:get_from_ip()
if not ip:is_valid() then
return nil
end
+ local rspamd_lua_utils = require "lua_util"
+ if rspamd_lua_utils.is_rspamc_or_controller(task) then return end
local dkim_pass = table.concat(dres.pass or E, '|')
local dkim_fail = table.concat(dres.fail or E, '|')
local dkim_temperror = table.concat(dres.temperror or E, '|')
local rspamd_util = require "rspamd_util"
local fun = require "fun"
local hash = require "rspamd_cryptobox_hash"
+local rspamd_lua_utils = require "lua_util"
local function data_key(task)
local cached = task:get_mempool():get_variable("grey_bodyhash")
end_time, type)
task:insert_result(settings['symbol'], 0.0, 'greylisted', end_time)
- local ua = task:get_request_header('User-Agent') or ''
- if tostring(ua) == 'rspamc' then return end -- Likely rspamc scan
-
+ if rspamd_lua_utils.is_rspamc_or_controller(task) then return end
if settings.message_func then
task:set_pre_result('soft reject',
settings.message_func(task, end_time))
end
end
- local ua = task:get_request_header('User-Agent') or ''
- local is_rspamc = false
- if tostring(ua) == 'rspamc' then is_rspamc = true end
+ local is_rspamc = rspamd_lua_utils.is_rspamc_or_controller(task)
if is_whitelisted then
if action == 'greylist' then
local rspamd_logger = require "rspamd_logger"
local rspamd_regexp = require "rspamd_regexp"
local rspamd_util = require "rspamd_util"
+local rspamd_lua_utils = require "lua_util"
-- Default settings
local redis_params = nil
-- Set score based on metric's action
local ip_score_set = function(task)
+ if rspamd_lua_utils.is_rspamc_or_controller(task) then return end
local function new_score_set(score, old_score, old_total)
local new_total
if old_total == -1 or old_total ~= old_total then
local rspamd_logger = require "rspamd_logger"
local rspamd_util = require "rspamd_util"
+local rspamd_lua_utils = require "lua_util"
local fun = require "fun"
local user_keywords = {'user'}
--- Check limit
local function rate_test(task)
+ if rspamd_lua_utils.is_rspamc_or_controller(task) then return end
rate_test_set(task, check_limits)
end
--- Update limit
local action = task:get_metric_action('default')
if action ~= 'soft reject' then
+ if rspamd_lua_utils.is_rspamc_or_controller(task) then return end
rate_test_set(task, set_limits)
end
end