From 973c10d4bc96335942dd2a6897d160eee402dca1 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 27 Apr 2017 10:34:35 +0100 Subject: [PATCH] [Feature] Allow to exclude specific domains from mx check --- src/plugins/lua/mx_check.lua | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/plugins/lua/mx_check.lua b/src/plugins/lua/mx_check.lua index b1d07209b..6bca83be9 100644 --- a/src/plugins/lua/mx_check.lua +++ b/src/plugins/lua/mx_check.lua @@ -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 -- 2.39.5