@@ -1521,4 +1521,15 @@ end | |||
--]]] | |||
exports.http_upstreams_by_url = http_upstreams_by_url | |||
---[[[ | |||
-- @function lua_util.dns_timeout_augmentation(cfg) | |||
-- Returns an augmentation suitable to define DNS timeout for a module | |||
-- @return {string} a string in format 'timeout=x' where `x` is a number of seconds for DNS timeout | |||
--]]] | |||
local function dns_timeout_augmentation(cfg) | |||
return string.format('timeout=%f', cfg:get_dns_timeout() or 0.0) | |||
end | |||
exports.dns_timeout_augmentation = dns_timeout_augmentation | |||
return exports |
@@ -802,6 +802,7 @@ if settings.whitelisted_signers_map then | |||
score = -2.0, | |||
group = 'policies', | |||
groups = {'arc'}, | |||
augmentations = {lua_util.dns_timeout_augmentation(rspamd_config)}, | |||
}) | |||
end | |||
@@ -145,6 +145,7 @@ if configure_asn_module() then | |||
callback = asn_check, | |||
priority = 8, | |||
flags = 'empty,nostat', | |||
augmentations = {lua_util.dns_timeout_augmentation(rspamd_config)}, | |||
}) | |||
if options['symbol'] then | |||
rspamd_config:register_symbol({ |
@@ -1469,6 +1469,7 @@ if opts then | |||
callback = clickhouse_collect, | |||
priority = 10, | |||
flags = 'empty,explicit_disable,ignore_passthrough', | |||
augmentations = {string.format("timeout=%f", settings.timeout)}, | |||
}) | |||
rspamd_config:register_finish_script(function(task) | |||
if nrows > 0 then |
@@ -657,7 +657,8 @@ if settings.munging then | |||
score = 0, | |||
group = 'policies', | |||
groups = {'dmarc'}, | |||
callback = dmarc_common.gen_munging_callback(munging_opts, settings) | |||
callback = dmarc_common.gen_munging_callback(munging_opts, settings), | |||
augmentations = {lua_util.dns_timeout_augmentation(rspamd_config)}, | |||
}) | |||
rspamd_config:register_dependency('DMARC_MUNGED', 'DMARC_CHECK') |
@@ -551,6 +551,7 @@ local auth_and_local_conf = lua_util.config_check_local_or_authed(rspamd_config, | |||
false, false) | |||
check_local = auth_and_local_conf[1] | |||
check_authed = auth_and_local_conf[2] | |||
local timeout = 0.0 | |||
local opts = rspamd_config:get_all_opt('hfilter') | |||
if opts then | |||
@@ -568,15 +569,18 @@ if config['helo_enabled'] then | |||
checks_hellohost_map = add_static_map(checks_hellohost) | |||
checks_hello_map = add_static_map(checks_hello) | |||
append_t(symbols_enabled, symbols_helo) | |||
timeout = math.max(timeout, rspamd_config:get_dns_timeout() * 3) | |||
end | |||
if config['hostname_enabled'] then | |||
if not checks_hellohost_map then | |||
checks_hellohost_map = add_static_map(checks_hellohost) | |||
end | |||
append_t(symbols_enabled, symbols_hostname) | |||
timeout = math.max(timeout, rspamd_config:get_dns_timeout()) | |||
end | |||
if config['from_enabled'] then | |||
append_t(symbols_enabled, symbols_from) | |||
timeout = math.max(timeout, rspamd_config:get_dns_timeout()) | |||
end | |||
if config['rcpt_enabled'] then | |||
append_t(symbols_enabled, symbols_rcpt) | |||
@@ -594,6 +598,7 @@ if #symbols_enabled > 0 then | |||
name = 'HFILTER_CHECK', | |||
callback = hfilter_callback, | |||
type = 'callback', | |||
augmentations = {string.format("timeout=%f", timeout)}, | |||
} | |||
for _,sym in ipairs(symbols_enabled) do | |||
rspamd_config:register_symbol{ |