summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-30 16:07:45 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-30 16:07:45 +0100
commit9a7f377edfe557a926e080ca9ecdbbd15b1cd7ce (patch)
treec4b394b8cb493118ecdcb59af4ac017cce994451
parent2aaf45f8f38ace7fa6b39d5e161d5389c1d52e40 (diff)
downloadrspamd-9a7f377edfe557a926e080ca9ecdbbd15b1cd7ce.tar.gz
rspamd-9a7f377edfe557a926e080ca9ecdbbd15b1cd7ce.zip
[Feature] Rbl: Make config checks much more strict
-rw-r--r--lualib/lua_cfg_transform.lua1
-rw-r--r--src/plugins/lua/rbl.lua15
2 files changed, 11 insertions, 5 deletions
diff --git a/lualib/lua_cfg_transform.lua b/lualib/lua_cfg_transform.lua
index 17e77645d..ae7d8997c 100644
--- a/lualib/lua_cfg_transform.lua
+++ b/lualib/lua_cfg_transform.lua
@@ -257,6 +257,7 @@ local function surbl_section_convert(cfg, section)
if k == 'suffix' then k = 'rbl' end
if k == 'ips' then k = 'returncodes' end
if k == 'bits' then k = 'returnbits' end
+ if k == 'noip' then k = 'no_ip' end
-- Crappy legacy
if k == 'options' then
if v == 'noip' or v == 'no_ip' then
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index 59ac8f7e1..a3a9ffb63 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -1017,6 +1017,7 @@ local default_options = {
['default_no_ip'] = false,
['default_images'] = false,
['default_replyto'] = false,
+ ['default_dkim_match_from'] = false,
}
opts = lua_util.override_defaults(default_options, opts)
@@ -1048,7 +1049,7 @@ local return_bits_schema = ts.map_of(
)
)
-local rule_schema = ts.shape({
+local rule_schema_tbl = {
enabled = ts.boolean:is_optional(),
disabled = ts.boolean:is_optional(),
rbl = ts.string,
@@ -1070,11 +1071,15 @@ local rule_schema = ts.shape({
requests_limit = (ts.integer + ts.string / tonumber):is_optional(),
process_script = ts.string:is_optional(),
emails_delimiter = ts.string:is_optional(),
+ ignore_defaults = ts.boolean:is_optional(),
symbols_prefixes = ts.map_of(ts.string, ts.string):is_optional(),
-}, {
- -- Covers boolean defaults
- extra_fields = ts.map_of(ts.string, ts.boolean)
-})
+}
+-- Add default boolean flags to the schema
+for def_k,_ in pairs(default_options) do
+ rule_schema_tbl[def_k:sub(#('default_') + 1)] = ts.boolean:is_optional()
+end
+
+local rule_schema = ts.shape(rule_schema_tbl)
for key,rbl in pairs(opts.rbls or opts.rules) do
if type(rbl) ~= 'table' or rbl.disabled == true or rbl.enabled == false then