From: Andrew Lewis Date: Tue, 12 Dec 2023 20:53:23 +0000 (+0200) Subject: [Feature] rbl: support disabling or replacing url_whitelist per RBL X-Git-Tag: 3.8.0~36^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F4742%2Fhead;p=rspamd.git [Feature] rbl: support disabling or replacing url_whitelist per RBL --- diff --git a/conf/modules.d/rbl.conf b/conf/modules.d/rbl.conf index dcb5661c0..79dfc84ea 100644 --- a/conf/modules.d/rbl.conf +++ b/conf/modules.d/rbl.conf @@ -167,6 +167,7 @@ rbl { RSPAMD_EMAILBL { ignore_whitelist = true; + ignore_url_whitelist = true; ignore_defaults = true; exclude_users = false; emails_delimiter = "."; @@ -182,6 +183,7 @@ rbl { MSBL_EBL { ignore_whitelist = true; + ignore_url_whitelist = true; ignore_defaults = true; exclude_users = false; rbl = "ebl.msbl.org"; diff --git a/lualib/plugins/rbl.lua b/lualib/plugins/rbl.lua index bf8bd3cfa..7c5efb4cd 100644 --- a/lualib/plugins/rbl.lua +++ b/lualib/plugins/rbl.lua @@ -98,6 +98,7 @@ local rule_schema_tbl = { helo = ts.boolean:is_optional(), ignore_default = ts.boolean:is_optional(), -- alias ignore_defaults = ts.boolean:is_optional(), + ignore_url_whitelist = ts.boolean:is_optional(), ignore_whitelist = ts.boolean:is_optional(), ignore_whitelists = ts.boolean:is_optional(), -- alias images = ts.boolean:is_optional(), @@ -136,6 +137,7 @@ local rule_schema_tbl = { unknown = ts.boolean:is_optional(), url_compose_map = lua_maps.map_schema:is_optional(), url_full_hostname = ts.boolean:is_optional(), + url_whitelist = lua_maps.map_schema:is_optional(), urls = ts.boolean:is_optional(), whitelist = lua_maps.map_schema:is_optional(), whitelist_exception = ( diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index fda7cce16..a18f9a731 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -1117,11 +1117,11 @@ local function add_rbl(key, rbl, global_opts) end end - if not rbl.whitelist and global_opts.url_whitelist and + if not rbl.whitelist and not rbl.ignore_url_whitelist and (global_opts.url_whitelist or rbl.url_whitelist) and (rbl.urls or rbl.emails or rbl.dkim or rbl.replyto) and not (rbl.from or rbl.received) then local def_type = 'set' - rbl.whitelist = lua_maps.map_add_from_ucl(global_opts.url_whitelist, def_type, + rbl.whitelist = lua_maps.map_add_from_ucl(rbl.url_whitelist or global_opts.url_whitelist, def_type, 'RBL url whitelist for ' .. rbl.symbol) rspamd_logger.infox(rspamd_config, 'added URL whitelist for RBL %s', rbl.symbol)