Browse Source

[Minor] Add default configs for several modules

tags/1.5.0
Andrew Lewis 7 years ago
parent
commit
b355b984bc

+ 23
- 0
conf/modules.d/force_actions.conf View File

@@ -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"
}

+ 25
- 0
conf/modules.d/metadata_exporter.conf View File

@@ -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"
}

+ 23
- 0
conf/modules.d/metric_exporter.conf View File

@@ -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"
}

+ 25
- 0
conf/modules.d/rmilter_headers.conf View File

@@ -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"
}

+ 48
- 0
conf/modules.d/url_reputation.conf View File

@@ -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"
}

+ 29
- 0
conf/modules.d/url_tags.conf View File

@@ -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"
}

+ 3
- 0
src/plugins/lua/metadata_exporter.lua View File

@@ -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')

+ 8
- 3
src/plugins/lua/metric_exporter.lua View File

@@ -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

+ 3
- 0
src/plugins/lua/rmilter_headers.lua View File

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

Loading…
Cancel
Save