-- Registration
local opts = rspamd_config:get_all_opt('antivirus')
if opts and type(opts) == 'table' then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
redis_params = rspamd_parse_redis_server('antivirus')
for k, m in pairs(opts) do
if type(m) == 'table' and m['type'] then
local configure_asn_module = function()
local opts = rspamd_config:get_all_opt('asn')
if opts then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
for k,v in pairs(opts) do
options[k] = v
end
-- Configuration
if opts and opts['host'] then
+ if opts['enabled'] == false then
+ logger.info('Module is disabled')
+ return
+ end
rspamd_config:register_symbol({
name = symbol_bulk,
callback = check_dcc
return
end
+if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+end
+
if opts['symbols'] then
for k,_ in pairs(dmarc_symbols) do
if opts['symbols'][k] then
local opts = rspamd_config:get_all_opt('emails', 'rule')
if opts and type(opts) == 'table' then
+ if opts['enabled'] == false then
+ logger.info('Module is disabled')
+ return
+ end
local r = opts['rule']
if r then
local max_epoch = 100
local use_settings = false
local opts = rspamd_config:get_all_opt("fann_scores")
+if not (opts and type(opts) == 'table') then
+ rspamd_logger.infox('Module is unconfigured')
+ return
+elseif opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+end
local function symbols_to_fann_vector(syms)
local learn_data = {}
-- Configuration
local opts = rspamd_config:get_all_opt('forged_recipients')
if opts then
+ if opts['enabled'] == false then
+ logger.info('Module is disabled')
+ return
+ end
if opts['symbol_rcpt'] or opts['symbol_sender'] then
local id = rspamd_config:register_symbol({
callback = check_forged_headers,
local opts = rspamd_config:get_all_opt('greylist')
if opts then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
if opts['whitelisted_ip'] then
whitelisted_ip = rspamd_config:add_radix_map(opts['whitelisted_ip'],
'Greylist whitelist ip map')
local opts = rspamd_config:get_all_opt('hfilter')
if opts then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
for k,v in pairs(opts) do
config[k] = v
end
local configure_ip_score_module = function()
local opts = rspamd_config:get_all_opt('ip_score')
if opts then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
for k,v in pairs(opts) do
options[k] = v
end
-- Configuration
-local opts = rspamd_config:get_all_opt('maillist')if opts then
+local opts = rspamd_config:get_all_opt('maillist')
+if opts then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
if opts['symbol'] then
symbol = opts['symbol']
rspamd_config:register_symbol({
local opts = rspamd_config:get_all_opt('mime_types')
if opts then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
for k,v in pairs(opts) do
settings[k] = v
end
-- Registration
local opts = rspamd_config:get_all_opt('multimap')
if opts and type(opts) == 'table' then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
redis_params = rspamd_parse_redis_server('multimap')
for k,m in pairs(opts) do
if type(m) == 'table' and m['type'] then
-- Configuration
local opts = rspamd_config:get_all_opt('once_received')
if opts then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
if opts['symbol'] then
local symbol = opts['symbol']
local rspamd_logger = require "rspamd_logger"
local util = require "rspamd_util"
local opts = rspamd_config:get_all_opt('phishing')
+if not (opts and type(opts) == 'table') then
+ rspamd_logger.info('Module is unconfigured')
+ return
+elseif opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+end
local function phishing_cb(task)
local function check_phishing_map(map, url, symbol)
local opts = rspamd_config:get_all_opt('ratelimit')
if opts then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
local rates = opts['limit']
if rates and type(rates) == 'table' then
fun.each(parse_limit, rates)
-- Configuration
local opts = rspamd_config:get_all_opt('rbl')
-if not opts or type(opts) ~= 'table' then
+if not (opts and type(opts) == 'table') then
+ rspamd_logger.info('Module is unconfigured')
+elseif opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
return
end
local opts = rspamd_config:get_all_opt('replies')
if opts then
- redis_params = rspamd_parse_redis_server('replies')
- if not redis_params then
- rspamd_logger.infox(rspamd_config, 'no servers are specified, disabling module')
- else
- rspamd_config:register_symbol({
- name = 'REPLIES_SET',
- type = 'postfilter',
- callback = replies_set,
- priority = 10
- })
- rspamd_config:register_symbol({
- name = 'REPLIES_CHECK',
- type = 'prefilter',
- callback = replies_check,
- priority = 10
- })
- end
+ if not (opts and type(opts) == 'table') then
+ rspamd_logger.info('Module is unconfigured')
+ return
+ elseif opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
+ redis_params = rspamd_parse_redis_server('replies')
+ if not redis_params then
+ rspamd_logger.infox(rspamd_config, 'no servers are specified, disabling module')
+ else
+ rspamd_config:register_symbol({
+ name = 'REPLIES_SET',
+ type = 'postfilter',
+ callback = replies_set,
+ priority = 10
+ })
+ rspamd_config:register_symbol({
+ name = 'REPLIES_CHECK',
+ type = 'prefilter',
+ callback = replies_check,
+ priority = 10
+ })
+ end
for k,v in pairs(opts) do
settings[k] = v
-- Configuration part
local section = rspamd_config:get_all_opt("rspamd_update")
if section then
+ if section['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
local trusted_key
each(function(k, elt)
if k == 'priority' then
end
end
end, maps)
+else
+ rspamd_logger.infox('Module is unconfigured')
end
-- Settings documentation can be found here:
-- https://rspamd.com/doc/configuration/settings.html
+local rspamd_logger = require "rspamd_logger"
local set_section = rspamd_config:get_all_opt("settings")
+if not (set_section and type(set_section) == 'table') then
+ rspamd_logger.infox('Module is unconfigured')
+elseif set_section['enabled'] == false then
+ rspamd_logger.infox('Module is disabled')
+ return
+end
local settings = {
[1] = {},
local settings_ids = {}
local settings_initialized = false
local max_pri = 0
-local rspamd_logger = require "rspamd_logger"
local rspamd_ip = require "rspamd_ip"
local rspamd_regexp = require "rspamd_regexp"
local ucl = require "ucl"
local func_cache = {}
local section = rspamd_config:get_all_opt("spamassassin")
+if not (section and type(section) == 'table') then
+ rspamd_logger.info('Module is unconfigured')
+elseif section['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+end
-- Minimum score to treat symbols as meta
local meta_score_alpha = 0.5
local opts = rspamd_config:get_all_opt("trie")
if opts then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
for sym, opt in pairs(opts) do
process_trie_conf(sym, opt)
end
})
end
end
+else
+ rspamd_logger.info("Module is disabled")
end
local configure_whitelist_module = function()
local opts = rspamd_config:get_all_opt('whitelist')
if opts then
+ if opts['enabled'] == false then
+ rspamd_logger.info('Module is disabled')
+ return
+ end
for k,v in pairs(opts) do
options[k] = v
end
+ else
+ rspamd_logger.info('Module is unconfigured')
+ return
end
if options['rules'] then