--]]]
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
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
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')
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
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)
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{