aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/mx_check.lua
diff options
context:
space:
mode:
authorAL <AlexeySa@users.noreply.github.com>2016-10-27 14:32:18 +0300
committerGitHub <noreply@github.com>2016-10-27 14:32:18 +0300
commit7fd22c46fd00b93a8d2372c9369d07c8d2ced1db (patch)
tree3a217541cfd5cbd4d592cd646df11b0bfaa151d8 /src/plugins/lua/mx_check.lua
parentfa1e7f8425a07af47cbf91711a36657aad89f623 (diff)
downloadrspamd-7fd22c46fd00b93a8d2372c9369d07c8d2ced1db.tar.gz
rspamd-7fd22c46fd00b93a8d2372c9369d07c8d2ced1db.zip
[Minor] Greylist first message with invalid MX
Diffstat (limited to 'src/plugins/lua/mx_check.lua')
-rw-r--r--src/plugins/lua/mx_check.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/lua/mx_check.lua b/src/plugins/lua/mx_check.lua
index bf38f63c6..e92a5e7fa 100644
--- a/src/plugins/lua/mx_check.lua
+++ b/src/plugins/lua/mx_check.lua
@@ -28,6 +28,7 @@ local settings = {
symbol_good_mx = 'MX_GOOD',
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'
}
local redis_params
@@ -68,6 +69,14 @@ local function mx_check(task)
end
if not valid then
task:insert_result(settings.symbol_bad_mx, 1.0)
+ -- Greylist message
+ if settings.greylist_invalid then
+ local grey_is_whitelisted = task:get_mempool():get_variable("grey_whitelisted")
+ if not grey_is_whitelisted then
+ local end_time = rspamd_util.time_to_string(rspamd_util.get_time() + 3600)
+ task:get_mempool():set_variable("grey_greylisted", end_time)
+ end
+ end
local ret,_,_ = rspamd_redis_make_request(task,
redis_params, -- connect params
key, -- hash key