]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow to exclude specific domains from mx check
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 27 Apr 2017 09:34:35 +0000 (10:34 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 27 Apr 2017 09:34:35 +0000 (10:34 +0100)
src/plugins/lua/mx_check.lua

index b1d07209bdb47155176544b7dcac29ddb67eaccc..6bca83be9b55f3aea690be8bd2c98911051614bd 100644 (file)
@@ -32,9 +32,10 @@ local settings = {
   expire = 86400, -- 1 day by default
   expire_novalid = 7200, -- 2 hours by default for no valid mxes
   greylist_invalid = false, -- Greylist first message with invalid MX (require greylist plugin)
-  key_prefix = 'rmx'
+  key_prefix = 'rmx',
 }
 local redis_params
+local exclude_domains
 
 local E = {}
 
@@ -60,6 +61,14 @@ local function mx_check(task)
     return
   end
 
+  if exclude_domains then
+    if exclude_domains:get_key(mx_domain) then
+      rspamd_logger.infox(task, 'skip mx check for %s, excluded', mx_domain)
+
+      return
+    end
+  end
+
   local valid = false
 
   local function check_results(mxes)
@@ -307,4 +316,12 @@ if opts then
     one_shot = true,
     one_param = true,
   })
-end
+
+  if settings.exclude_domains then
+    exclude_domains = rspamd_config:add_map{
+      type = 'set',
+      description = 'Exclude specific domains from MX checks',
+      url = settings.exclude_domains,
+    }
+  end
+end
\ No newline at end of file