aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-25 16:23:24 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-25 16:23:24 +0100
commit8cb310ccc99cc0ab3f1af8781d19d0cd08a9fb44 (patch)
tree6d115afd2c9d0c79554b3853434fa4c9393a27bc /src/plugins/lua
parent15c5e04497551abb6c9d672bf2c624fd3b32b149 (diff)
downloadrspamd-8cb310ccc99cc0ab3f1af8781d19d0cd08a9fb44.tar.gz
rspamd-8cb310ccc99cc0ab3f1af8781d19d0cd08a9fb44.zip
[Feature] Allow whitelisting by IP for greylisting plugin
Diffstat (limited to 'src/plugins/lua')
-rw-r--r--src/plugins/lua/greylist.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua
index 05afaeab6..646164424 100644
--- a/src/plugins/lua/greylist.lua
+++ b/src/plugins/lua/greylist.lua
@@ -132,6 +132,14 @@ local function greylist_check(task)
return
end
+ if ip and ip:is_valid() and whitelisted_ip then
+ if whitelisted_ip:get_key(ip) then
+ -- Do not check whitelisted ip
+ rspamd_logger.infox(task, 'skip greylisting for whitelisted IP')
+ return
+ end
+ end
+
local body_key = data_key(task)
local meta_key = envelope_key(task)
local hash_key = body_key .. meta_key
@@ -216,6 +224,12 @@ local function greylist_set(task)
return
end
+ if ip and ip:is_valid() and whitelisted_ip then
+ if whitelisted_ip:get_key(ip) then
+ return
+ end
+ end
+
local is_whitelisted = task:get_mempool():get_variable("grey_whitelisted")
local do_greylisting = task:get_mempool():get_variable("grey_greylisted")