So, I had a request from user to disable greylisting for he’s mail account only. Greylisting on server otherwise should be enabled. Rspamd offers few different filters to disable greylist: for IP, for sender domain, but I didn’t see any options for recipient.
Here is a simple lua script which disables greylisting for a specific recipient on your mail server. To do exactly like described here, you should upgrade your Rspamd to at least 3.11.
First, create file “/etc/rspamd/lua.local.d/disable_gl.lua” and add code bellow. Also, create “/etc/rspamd/maps.d/disable_grey.map” map file which will contain with recipient addresses with greylist disabled.
local rspamd_logger = require "rspamd_logger"
local rspamd_util = require "rspamd_util"
local disable_grey_map = rspamd_config:add_map({
type = "regexp",
url = "/etc/rspamd/maps.d/disable_grey.map",
description = "Disable greylisting map"
})
local function disable_greylisting(task)
local rcpt = task:get_recipients("smtp")
if not rcpt then return end
for _, r in ipairs(rcpt) do
if disable_grey_map and disable_grey_map:get_key(r['addr']) then
rspamd_logger.infox(task, "Disabling greylisting for recipient: %s", r['addr'])
task:disable_action('greylist')
return
end
end
end
rspamd_config:register_symbol({
name = "DISABLE_GREYLIST",
type = "callback",
callback = disable_greylisting
})
Recent Comments