From: Andrew Lewis Date: Tue, 28 Feb 2017 15:02:02 +0000 (+0200) Subject: [Minor] Add default configs for several modules X-Git-Tag: 1.5.0~7^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1463%2Fhead;p=rspamd.git [Minor] Add default configs for several modules --- diff --git a/conf/modules.d/force_actions.conf b/conf/modules.d/force_actions.conf new file mode 100644 index 000000000..bdb10f51c --- /dev/null +++ b/conf/modules.d/force_actions.conf @@ -0,0 +1,23 @@ +# Please don't modify this file as your changes might be overwritten with +# the next update. +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local.override' to redefine +# parameters defined on the top level +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local' to add +# parameters defined on the top level +# +# For specific modules or configuration you can also modify +# '$LOCAL_CONFDIR/local.d/file.conf' - to add your options or rewrite defaults +# '$LOCAL_CONFDIR/override.d/file.conf' - to override the defaults +# +# See https://rspamd.com/doc/tutorials/writing_rules.html for details + +force_actions { + + # Refer to https://rspamd.com/doc/modules/force_actions.html for information on configuration + + .include(try=true,priority=5) "${DBDIR}/dynamic/force_actions.conf" + .include(try=true,priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/force_actions.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/force_actions.conf" +} diff --git a/conf/modules.d/metadata_exporter.conf b/conf/modules.d/metadata_exporter.conf new file mode 100644 index 000000000..2284f7431 --- /dev/null +++ b/conf/modules.d/metadata_exporter.conf @@ -0,0 +1,25 @@ +# Please don't modify this file as your changes might be overwritten with +# the next update. +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local.override' to redefine +# parameters defined on the top level +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local' to add +# parameters defined on the top level +# +# For specific modules or configuration you can also modify +# '$LOCAL_CONFDIR/local.d/file.conf' - to add your options or rewrite defaults +# '$LOCAL_CONFDIR/override.d/file.conf' - to override the defaults +# +# See https://rspamd.com/doc/tutorials/writing_rules.html for details + +metadata_exporter { + + # Refer to https://rspamd.com/doc/modules/metadata_exporter.html for information on configuration + rules { + } + + .include(try=true,priority=5) "${DBDIR}/dynamic/metadata_exporter.conf" + .include(try=true,priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/metadata_exporter.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/metadata_exporter.conf" +} diff --git a/conf/modules.d/metric_exporter.conf b/conf/modules.d/metric_exporter.conf new file mode 100644 index 000000000..b334d4c5a --- /dev/null +++ b/conf/modules.d/metric_exporter.conf @@ -0,0 +1,23 @@ +# Please don't modify this file as your changes might be overwritten with +# the next update. +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local.override' to redefine +# parameters defined on the top level +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local' to add +# parameters defined on the top level +# +# For specific modules or configuration you can also modify +# '$LOCAL_CONFDIR/local.d/file.conf' - to add your options or rewrite defaults +# '$LOCAL_CONFDIR/override.d/file.conf' - to override the defaults +# +# See https://rspamd.com/doc/tutorials/writing_rules.html for details + +metric_exporter { + + # Refer to https://rspamd.com/doc/modules/metric_exporter.html for information on configuration + + .include(try=true,priority=5) "${DBDIR}/dynamic/metric_exporter.conf" + .include(try=true,priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/metric_exporter.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/metric_exporter.conf" +} diff --git a/conf/modules.d/rmilter_headers.conf b/conf/modules.d/rmilter_headers.conf new file mode 100644 index 000000000..432057e03 --- /dev/null +++ b/conf/modules.d/rmilter_headers.conf @@ -0,0 +1,25 @@ +# Please don't modify this file as your changes might be overwritten with +# the next update. +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local.override' to redefine +# parameters defined on the top level +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local' to add +# parameters defined on the top level +# +# For specific modules or configuration you can also modify +# '$LOCAL_CONFDIR/local.d/file.conf' - to add your options or rewrite defaults +# '$LOCAL_CONFDIR/override.d/file.conf' - to override the defaults +# +# See https://rspamd.com/doc/tutorials/writing_rules.html for details + +rmilter_headers { + + # Refer to https://rspamd.com/doc/modules/rmilter_headers.html for information on configuration + + use = []; + + .include(try=true,priority=5) "${DBDIR}/dynamic/rmilter_headers.conf" + .include(try=true,priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/rmilter_headers.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/rmilter_headers.conf" +} diff --git a/conf/modules.d/url_reputation.conf b/conf/modules.d/url_reputation.conf new file mode 100644 index 000000000..6bc347311 --- /dev/null +++ b/conf/modules.d/url_reputation.conf @@ -0,0 +1,48 @@ +# Please don't modify this file as your changes might be overwritten with +# the next update. +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local.override' to redefine +# parameters defined on the top level +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local' to add +# parameters defined on the top level +# +# For specific modules or configuration you can also modify +# '$LOCAL_CONFDIR/local.d/file.conf' - to add your options or rewrite defaults +# '$LOCAL_CONFDIR/override.d/file.conf' - to override the defaults +# +# See https://rspamd.com/doc/tutorials/writing_rules.html for details + +url_reputation { + enabled = false; # Please set enabled = true to activate + + # Key prefix for redis - default "Ur." + #key_prefix = "Ur."; + # Symbols to insert - defaults as shown + #symbols { + # white = "URL_REPUTATION_WHITE"; + # black = "URL_REPUTATION_BLACK"; + # grey = "URL_REPUTATION_GREY"; + # neutral = "URL_REPUTATION_NEUTRAL"; + #} + # DKIM/DMARC/SPF allow symbols - defaults as shown + #foreign_symbols { + # dmarc = "DMARC_POLICY_ALLOW"; + # dkim = "R_DKIM_ALLOW"; + # spf = "R_SPF_ALLOW"; + #} + # SURBL metatags to ignore - default as shown + #ignore_surbl = ["URIBL_BLOCKED", "DBL_PROHIBIT", "SURBL_BLOCKED"]; + # Amount of samples required for scoring - default 5 + #threshold = 5; + # Maximum number of TLDs to update reputation on (default 1) + #update_limit = 1; + # Maximum number of TLDs to query reputation on (default 100) + #query_limit = 100; + # If true, try to find most 'relevant' URL (default true) + #relevance = true; + + .include(try=true,priority=5) "${DBDIR}/dynamic/url_reputation.conf" + .include(try=true,priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/url_reputation.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/url_reputation.conf" +} diff --git a/conf/modules.d/url_tags.conf b/conf/modules.d/url_tags.conf new file mode 100644 index 000000000..a1e53e340 --- /dev/null +++ b/conf/modules.d/url_tags.conf @@ -0,0 +1,29 @@ +# Please don't modify this file as your changes might be overwritten with +# the next update. +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local.override' to redefine +# parameters defined on the top level +# +# You can modify '$LOCAL_CONFDIR/rspamd.conf.local' to add +# parameters defined on the top level +# +# For specific modules or configuration you can also modify +# '$LOCAL_CONFDIR/local.d/file.conf' - to add your options or rewrite defaults +# '$LOCAL_CONFDIR/override.d/file.conf' - to override the defaults +# +# See https://rspamd.com/doc/tutorials/writing_rules.html for details + +url_tags { + enabled = false; # Please set enabled = true to activate + + # expiry time for tags - default 1 hour + #expire = 1h; + # key prefix for redis - default "Ut." + #key_prefix = "Ut."; + # tags that shouldn't be persisted - default empty + #ignore_tags = ["surbl"]; + + .include(try=true,priority=5) "${DBDIR}/dynamic/url_tags.conf" + .include(try=true,priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/url_tags.conf" + .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/url_tags.conf" +} diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua index 6e3f66fa5..90b28193f 100644 --- a/src/plugins/lua/metadata_exporter.lua +++ b/src/plugins/lua/metadata_exporter.lua @@ -524,6 +524,9 @@ if type(settings.rules) ~= 'table' then rspamd_logger.errx(rspamd_config, 'No push backend enabled') return end +elseif not next(settings.rules) then + rspamd_logger.debugm(N, rspamd_config, 'No rules enabled') + return end if not settings.rules or not next(settings.rules) then rspamd_logger.errx(rspamd_config, 'No rules enabled') diff --git a/src/plugins/lua/metric_exporter.lua b/src/plugins/lua/metric_exporter.lua index a7b116c7a..2a2ebb597 100644 --- a/src/plugins/lua/metric_exporter.lua +++ b/src/plugins/lua/metric_exporter.lua @@ -144,14 +144,19 @@ local backends = { local function configure_metric_exporter() local opts = rspamd_config:get_all_opt(N) - if not backends[opts['backend']] then - logger.errx(rspamd_config, 'Backend is invalid or unspecified') + local be = opts['backend'] + if not be then + logger.debugm(N, rspamd_config, 'Backend is unspecified') + return + end + if not backends[be] then + logger.errx(rspamd_config, 'Backend is invalid: ' .. be) return false end for k, v in pairs(opts) do settings[k] = v end - return backends[opts['backend']]['configure']() + return backends[be]['configure']() end if not configure_metric_exporter() then return end diff --git a/src/plugins/lua/rmilter_headers.lua b/src/plugins/lua/rmilter_headers.lua index 77eed1785..82a4de6bf 100644 --- a/src/plugins/lua/rmilter_headers.lua +++ b/src/plugins/lua/rmilter_headers.lua @@ -322,6 +322,9 @@ local opts = rspamd_config:get_all_opt(N) if not opts then return end if type(opts['use']) == 'string' then opts['use'] = {opts['use']} +elseif (type(opts['use']) == 'table' and not opts['use'][1]) then + logger.debugm(N, rspamd_config, 'no functions are enabled') + return end if type(opts['use']) ~= 'table' then logger.errx(rspamd_config, 'unexpected type for "use" option: %s', type(opts['use']))