Browse Source

[Feature] Allow whitelisting by IP for greylisting plugin

tags/1.4.0
Vsevolod Stakhov 7 years ago
parent
commit
8cb310ccc9
1 changed files with 14 additions and 0 deletions
  1. 14
    0
      src/plugins/lua/greylist.lua

+ 14
- 0
src/plugins/lua/greylist.lua View File

@@ -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")


Loading…
Cancel
Save