commit abf0834: [Minor] Rbl: Add some more compat knobs for the emails cases

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Sep 17 14:21:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-17 15:18:28 +0100
URL: https://github.com/rspamd/rspamd/commit/abf083471dbf6090603ba2331b9ac89e2a014432 (HEAD -> master)

[Minor] Rbl: Add some more compat knobs for the emails cases

---
 src/plugins/lua/rbl.lua | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index 38c9224f4..aa3857b6a 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -460,17 +460,23 @@ local function gen_rbl_callback(rule)
         add_dns_request(task, email:get_tld(), false, false, requests_table,
             'email', whitelist)
       else
-        local delimiter = '.'
-        if rule.emails_delimiter then
-          delimiter = rule.emails_delimiter
-        else
-          if rule.hash then
-            delimiter = '@'
+        if not is_whitelisted(task,
+            email:get_tld(),
+            email:get_tld(),
+            whitelist,
+            'email replyto')  then
+          local delimiter = '.'
+          if rule.emails_delimiter then
+            delimiter = rule.emails_delimiter
+          else
+            if rule.hash then
+              delimiter = '@'
+            end
           end
+          add_dns_request(task, string.format('%s%s%s',
+              email:get_user(), delimiter, email:get_host()), false, false,
+              requests_table, 'email', whitelist)
         end
-        add_dns_request(task, string.format('%s%s%s',
-            email:get_user(), delimiter, email:get_host()), false, false,
-            requests_table, 'email', whitelist)
       end
     end
 
@@ -571,9 +577,14 @@ local function gen_rbl_callback(rule)
       if rt and rt[1] and (rt[1].addr and #rt[1].addr > 0) then
         lua_util.remove_email_aliases(rt[1])
         rt[1].addr = rt[1].addr:lower()
+        lua_util.debugm(N, task, 'check replyto %s', rt[1].addr)
+        if is_whitelisted(task, rt[1].host, rt[1].host, whitelist, 'email replyto')
+          then return
+        end
+
         if rule.emails_domainonly then
           add_dns_request(task, rt[1].host, true, false, requests_table,
-              'email replyt', whitelist)
+              'email replyto', whitelist)
         else
           local delimiter = '.'
           if rule.emails_delimiter then
@@ -585,7 +596,7 @@ local function gen_rbl_callback(rule)
           end
           add_dns_request(task, string.format('%s%s%s',
               rt[1].user, delimiter, rt[1].host), true, false,
-              requests_table, 'email replyt', whitelist)
+              requests_table, 'email replyto', whitelist)
         end
       end
     end
@@ -771,7 +782,7 @@ local function add_rbl(key, rbl, global_opts)
   end
 
   -- Check if rbl is available for empty tasks
-  if not (rbl.emails or rbl.urls or rbl.dkim or rbl.received or rbl.selector) or
+  if not (rbl.emails or rbl.urls or rbl.dkim or rbl.received or rbl.selector or rbl.replyto) or
       rbl.is_empty then
     flags_tbl[#flags_tbl + 1] = 'empty'
   end
@@ -823,7 +834,7 @@ local function add_rbl(key, rbl, global_opts)
   end
 
   if not rbl.whitelist and global_opts.url_whitelist and
-      (rbl.urls or rbl.emails or rbl.dkim) then
+      (rbl.urls or rbl.emails or rbl.dkim or rbl.replyto) then
     local def_type = 'set'
     rbl.whitelist = lua_maps.map_add_from_ucl(global_opts.url_whitelist, def_type,
         'RBL url whitelist for ' .. rbl.symbol)


More information about the Commits mailing list