1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2024-12-16 10:59:39 +02:00
mailcow-dockerized/data/conf/rspamd/local.d/dkim.conf

28 lines
906 B
Plaintext
Raw Normal View History

2016-12-09 21:39:02 +02:00
sign_condition =<<EOD
return function(task)
local from = task:get_from('smtp')
local rspamd_logger = require "rspamd_logger"
if not task:get_user() then
rspamd_logger.infox(task, "Skip DKIM signing for unauthorized user")
return false
end
if from and from[1]['addr'] then
lastAtSymbol = from[1]['addr']:find("[^%@]+$")
local domain = from[1]['addr']:sub(lastAtSymbol, #from[1]['addr'])
local keyfile = io.open("/data/dkim/keys/" .. domain .. ".dkim")
if keyfile then
rspamd_logger.infox(task, "DKIM signing mail for authorized user of domain %s", domain)
keyfile:close()
return {
key = "/data/dkim/keys/" .. domain .. ".dkim",
domain = domain,
selector = "dkim"
}
else
rspamd_logger.infox(task, "Authorized user, but no key file for domain %s - skipped DKIM signing", domain)
end
end
return false
2016-12-09 21:39:02 +02:00
end
EOD;