Skip to content

Instantly share code, notes, and snippets.

@fatalbanana
Last active May 29, 2024 08:57
Show Gist options
  • Save fatalbanana/76ec8617a46583cfa6dde35a0f7441d3 to your computer and use it in GitHub Desktop.
Save fatalbanana/76ec8617a46583cfa6dde35a0f7441d3 to your computer and use it in GitHub Desktop.
-- /etc/rspamd/rspamd.local.lua
local lua_maps = require 'lua_maps'
local rspamd_util = require 'rspamd_util'
local dn_to_email_map = rspamd_config:add_map{
type = "map",
url = '/etc/rspamd/restricted_dn.map',
--[[#example map content:
"Foo Bar" foo@example.net
]]--
}
rspamd_config.DN_RESTRICTION = {
callback = function(task)
local mfrom = task:get_from('mime')
if not mfrom and mfrom[1] then return end
local want_mail = dn_to_email_map:get_key(mfrom[1].name)
if not want_mail then return end
return not rspamd_util.strequal_caseless(mfrom[1].addr:lower(), want_mail)
end,
score = 10.0,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment