aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-11-27 20:15:40 +0000
committerGitHub <noreply@github.com>2017-11-27 20:15:40 +0000
commit038baee6c9fcb560e11603d5219e18eac2973233 (patch)
treeb922c312c2002485322c9c2f6d35ade8fbe6d48c
parent34150e9a86aa04d18248701b9327a6176bcfed0a (diff)
parent082f48b7791500b079f70defde12df97fc80f19a (diff)
downloadrspamd-038baee6c9fcb560e11603d5219e18eac2973233.tar.gz
rspamd-038baee6c9fcb560e11603d5219e18eac2973233.zip
Merge pull request #1932 from AlexeySa/patch-4
[Minor] Add whitelist symbol to mx_check plugin
-rw-r--r--src/plugins/lua/mx_check.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/plugins/lua/mx_check.lua b/src/plugins/lua/mx_check.lua
index 1094c6c2d..3e43b4a9a 100644
--- a/src/plugins/lua/mx_check.lua
+++ b/src/plugins/lua/mx_check.lua
@@ -29,6 +29,7 @@ local settings = {
symbol_bad_mx = 'MX_INVALID',
symbol_no_mx = 'MX_MISSING',
symbol_good_mx = 'MX_GOOD',
+ symbol_white_mx = 'MX_WHITE',
expire = 86400, -- 1 day by default
expire_novalid = 7200, -- 2 hours by default for no valid mxes
greylist_invalid = true, -- Greylist first message with invalid MX (require greylist plugin)
@@ -64,7 +65,7 @@ local function mx_check(task)
if exclude_domains then
if exclude_domains:get_key(mx_domain) then
rspamd_logger.infox(task, 'skip mx check for %s, excluded', mx_domain)
-
+ task:insert_result(settings.symbol_white_mx, 1.0, mx_domain)
return
end
end
@@ -288,6 +289,11 @@ if opts then
type = 'virtual',
parent = id
})
+ rspamd_config:register_symbol({
+ name = settings.symbol_white_mx,
+ type = 'virtual',
+ parent = id
+ })
rspamd_config:set_metric_symbol({
name = settings.symbol_bad_mx,
@@ -306,6 +312,14 @@ if opts then
one_param = true,
})
rspamd_config:set_metric_symbol({
+ name = settings.symbol_white_mx,
+ score = 0.0,
+ description = 'Domain is whitelisted from MX check',
+ group = 'MX',
+ one_shot = true,
+ one_param = true,
+ })
+ rspamd_config:set_metric_symbol({
name = settings.symbol_no_mx,
score = 3.5,
description = 'Domain has no resolvable MX',
@@ -321,4 +335,4 @@ if opts then
url = settings.exclude_domains,
}
end
-end \ No newline at end of file
+end