From: Andrew Lewis Date: Mon, 5 Sep 2016 06:48:00 +0000 (+0200) Subject: Revert "[Feature] Add common way to disable Lua modules" X-Git-Tag: 1.4.0~485^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68d3c2f3f31e24816f55d0c7e3838e199da1a9e0;p=thirdparty%2Frspamd.git Revert "[Feature] Add common way to disable Lua modules" This reverts commit f552edd887794a5086dcf93d36f8f82d83553196. Conflicts: src/plugins/lua/antivirus.lua src/plugins/lua/asn.lua src/plugins/lua/dcc.lua src/plugins/lua/dmarc.lua src/plugins/lua/emails.lua src/plugins/lua/forged_recipients.lua src/plugins/lua/greylist.lua src/plugins/lua/hfilter.lua src/plugins/lua/ip_score.lua src/plugins/lua/maillist.lua src/plugins/lua/mime_types.lua src/plugins/lua/multimap.lua src/plugins/lua/once_received.lua src/plugins/lua/ratelimit.lua src/plugins/lua/rbl.lua src/plugins/lua/replies.lua src/plugins/lua/rspamd_update.lua src/plugins/lua/trie.lua src/plugins/lua/whitelist.lua --- diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua index 19466678ef..96a723fe0a 100644 --- a/src/plugins/lua/antivirus.lua +++ b/src/plugins/lua/antivirus.lua @@ -273,10 +273,6 @@ end -- Registration local opts = rspamd_config:get_all_opt('antivirus') if opts and type(opts) == 'table' then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, '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 diff --git a/src/plugins/lua/asn.lua b/src/plugins/lua/asn.lua index 74672af271..25b684dc47 100644 --- a/src/plugins/lua/asn.lua +++ b/src/plugins/lua/asn.lua @@ -74,10 +74,6 @@ end local configure_asn_module = function() local opts = rspamd_config:get_all_opt('asn') if opts then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - return - end for k,v in pairs(opts) do options[k] = v end diff --git a/src/plugins/lua/dcc.lua b/src/plugins/lua/dcc.lua index 7c3616073c..216139fabd 100644 --- a/src/plugins/lua/dcc.lua +++ b/src/plugins/lua/dcc.lua @@ -116,10 +116,6 @@ end -- Configuration if opts and opts['host'] then - if opts['enabled'] == false then - logger.infox(rspamd_config, 'module is disabled') - return - end rspamd_config:register_symbol({ name = symbol_bulk, callback = check_dcc diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua index f2faef89fd..fc85c47662 100644 --- a/src/plugins/lua/dmarc.lua +++ b/src/plugins/lua/dmarc.lua @@ -328,11 +328,6 @@ if not opts or type(opts) ~= 'table' then return end -if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - return -end - if opts['symbols'] then for k,_ in pairs(dmarc_symbols) do if opts['symbols'][k] then diff --git a/src/plugins/lua/emails.lua b/src/plugins/lua/emails.lua index 3d0fddd6aa..9d9a54d03c 100644 --- a/src/plugins/lua/emails.lua +++ b/src/plugins/lua/emails.lua @@ -81,10 +81,6 @@ end local opts = rspamd_config:get_all_opt('emails', 'rule') if opts and type(opts) == 'table' then - if opts['enabled'] == false then - logger.infox(rspamd_config, 'module is disabled') - return - end local r = opts['rule'] if r then diff --git a/src/plugins/lua/fann_scores.lua b/src/plugins/lua/fann_scores.lua index cafa5befa7..fc9ea59c98 100644 --- a/src/plugins/lua/fann_scores.lua +++ b/src/plugins/lua/fann_scores.lua @@ -39,10 +39,7 @@ 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') + rspamd_logger.infox(rspamd_config, 'Module is unconfigured') return end diff --git a/src/plugins/lua/forged_recipients.lua b/src/plugins/lua/forged_recipients.lua index 4c52295b9d..957491a56d 100644 --- a/src/plugins/lua/forged_recipients.lua +++ b/src/plugins/lua/forged_recipients.lua @@ -72,10 +72,6 @@ end -- Configuration local opts = rspamd_config:get_all_opt('forged_recipients') if opts then - if opts['enabled'] == false then - logger.infox(rspamd_config, 'Module is disabled') - return - end if opts['symbol_rcpt'] or opts['symbol_sender'] then local id = rspamd_config:register_symbol({ callback = check_forged_headers, diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua index 71a8a86cae..05afaeab68 100644 --- a/src/plugins/lua/greylist.lua +++ b/src/plugins/lua/greylist.lua @@ -321,10 +321,6 @@ end local opts = rspamd_config:get_all_opt('greylist') if opts then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - return - end if opts['whitelisted_ip'] then whitelisted_ip = rspamd_config:add_radix_map(opts['whitelisted_ip'], 'Greylist whitelist ip map') diff --git a/src/plugins/lua/hfilter.lua b/src/plugins/lua/hfilter.lua index b11b567b74..34a6796415 100644 --- a/src/plugins/lua/hfilter.lua +++ b/src/plugins/lua/hfilter.lua @@ -481,10 +481,6 @@ local symbols_from = { local opts = rspamd_config:get_all_opt('hfilter') if opts then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - return - end for k,v in pairs(opts) do config[k] = v end diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua index bb6119bdaf..6b6ac900a6 100644 --- a/src/plugins/lua/ip_score.lua +++ b/src/plugins/lua/ip_score.lua @@ -317,10 +317,6 @@ 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.infox(rspamd_config, 'module is disabled') - return - end for k,v in pairs(opts) do options[k] = v end diff --git a/src/plugins/lua/maillist.lua b/src/plugins/lua/maillist.lua index 4ec0a41f17..1e4c104ded 100644 --- a/src/plugins/lua/maillist.lua +++ b/src/plugins/lua/maillist.lua @@ -272,10 +272,6 @@ end -- Configuration local opts = rspamd_config:get_all_opt('maillist') if opts then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - return - end if opts['symbol'] then symbol = opts['symbol'] rspamd_config:register_symbol({ diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua index ad725820b7..e1b2123f44 100644 --- a/src/plugins/lua/mime_types.lua +++ b/src/plugins/lua/mime_types.lua @@ -200,10 +200,6 @@ end local opts = rspamd_config:get_all_opt('mime_types') if opts then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - return - end for k,v in pairs(opts) do settings[k] = v end diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index a1333d7d9a..f21bc5b117 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -774,10 +774,6 @@ end -- Registration local opts = rspamd_config:get_all_opt('multimap') if opts and type(opts) == 'table' then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, '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 diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua index 84b0e48b44..63de22776b 100644 --- a/src/plugins/lua/once_received.lua +++ b/src/plugins/lua/once_received.lua @@ -142,10 +142,6 @@ end -- Configuration local opts = rspamd_config:get_all_opt('once_received') if opts then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - return - end if opts['symbol'] then local symbol = opts['symbol'] diff --git a/src/plugins/lua/phishing.lua b/src/plugins/lua/phishing.lua index e38ceeac97..adddce2559 100644 --- a/src/plugins/lua/phishing.lua +++ b/src/plugins/lua/phishing.lua @@ -36,10 +36,7 @@ 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') + rspamd_logger.infox(rspamd_config, 'Module is unconfigured') return end @@ -334,9 +331,6 @@ local function phishtank_json_cb(string) end if opts then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - end if opts['symbol'] then symbol = opts['symbol'] -- Register symbol's callback diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index 2e67a55244..48052502f8 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -442,10 +442,6 @@ end local opts = rspamd_config:get_all_opt('ratelimit') if opts then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - return - end local rates = opts['limit'] if rates and type(rates) == 'table' then fun.each(parse_limit, rates) diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index f22199b63a..50a49adcda 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -386,9 +386,7 @@ end -- Configuration local opts = rspamd_config:get_all_opt('rbl') if not (opts and type(opts) == 'table') then - rspamd_logger.info('Module is unconfigured') -elseif opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') + rspamd_logger.infox(rspamd_config, 'Module is unconfigured') return end diff --git a/src/plugins/lua/replies.lua b/src/plugins/lua/replies.lua index d6793a3d87..9916dc3cf6 100644 --- a/src/plugins/lua/replies.lua +++ b/src/plugins/lua/replies.lua @@ -108,14 +108,11 @@ local function replies_set(task) end local opts = rspamd_config:get_all_opt('replies') +if not (opts and type(opts) == 'table') then + rspamd_logger.infox(rspamd_config, 'module is unconfigured') + return +end if opts then - if not (opts and type(opts) == 'table') then - rspamd_logger.infox(rspamd_config, 'module is unconfigured') - return - elseif opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, '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') diff --git a/src/plugins/lua/rspamd_update.lua b/src/plugins/lua/rspamd_update.lua index 779cec2ddc..19e481019d 100644 --- a/src/plugins/lua/rspamd_update.lua +++ b/src/plugins/lua/rspamd_update.lua @@ -125,10 +125,6 @@ end -- Configuration part local section = rspamd_config:get_all_opt("rspamd_update") if section then - if section['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - return - end local trusted_key each(function(k, elt) if k == 'priority' then @@ -158,5 +154,5 @@ if section then end end, maps) else - rspamd_logger.infox('Module is unconfigured') + rspamd_logger.infox(rspamd_config, 'Module is unconfigured') end diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index e857d7f8ec..b25698f279 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -21,10 +21,7 @@ limitations under the License. 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 + rspamd_logger.infox(rspamd_config, 'Module is unconfigured') end local settings = { diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index 533b83864f..a752f67a50 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -115,10 +115,7 @@ local sa_lists = { 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 + rspamd_logger.infox(rspamd_config, 'Module is unconfigured') end -- Minimum score to treat symbols as meta diff --git a/src/plugins/lua/trie.lua b/src/plugins/lua/trie.lua index 927efbc26c..ebc4e2a7e4 100644 --- a/src/plugins/lua/trie.lua +++ b/src/plugins/lua/trie.lua @@ -130,10 +130,6 @@ end local opts = rspamd_config:get_all_opt("trie") if opts then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - return - end for sym, opt in pairs(opts) do process_trie_conf(sym, opt) end @@ -173,5 +169,5 @@ if opts then end end else - rspamd_logger.info("Module is unconfigured") + rspamd_logger.infox(rspamd_config, "Module is unconfigured") end diff --git a/src/plugins/lua/whitelist.lua b/src/plugins/lua/whitelist.lua index 7344a1d67a..517b4e63b0 100644 --- a/src/plugins/lua/whitelist.lua +++ b/src/plugins/lua/whitelist.lua @@ -185,10 +185,6 @@ end local configure_whitelist_module = function() local opts = rspamd_config:get_all_opt('whitelist') if opts then - if opts['enabled'] == false then - rspamd_logger.infox(rspamd_config, 'module is disabled') - return - end for k,v in pairs(opts) do options[k] = v end