commit d06fc3b: [Feature] rbl: support disabling or replacing url_whitelist per RBL

Andrew Lewis nerf at judo.za.org
Mon Jul 29 17:50:18 UTC 2024


Author: Andrew Lewis
Date: 2023-12-12 22:53:23 +0200
URL: https://github.com/rspamd/rspamd/commit/d06fc3bea376118d912821d106cf50ba03588ffa (refs/pull/4742/head)

[Feature] rbl: support disabling or replacing url_whitelist per RBL

---
 conf/modules.d/rbl.conf | 2 ++
 lualib/plugins/rbl.lua  | 2 ++
 src/plugins/lua/rbl.lua | 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)

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)


More information about the Commits mailing list