Log some infos, sign using dkim separator
parent
1aa5280fc2
commit
5afda018ce
|
@ -1,19 +1,27 @@
|
||||||
sign_condition =<<EOD
|
sign_condition =<<EOD
|
||||||
return function(task)
|
return function(task)
|
||||||
local from = task:get_from('smtp')
|
local from = task:get_from('smtp')
|
||||||
if from and from[1]['addr'] then
|
local rspamd_logger = require "rspamd_logger"
|
||||||
lastAtSymbol = from[1]['addr']:find("[^%@]+$")
|
if not task:get_user() then
|
||||||
local domain = from[1]['addr']:sub(lastAtSymbol, #from[1]['addr'])
|
rspamd_logger.infox(task, "Skip DKIM signing for unauthorized user")
|
||||||
local keyfile = io.open("/etc/rspamd/dkim/keys/" .. domain .. ".default")
|
return false
|
||||||
if keyfile then
|
end
|
||||||
keyfile:close()
|
if from and from[1]['addr'] then
|
||||||
return {
|
lastAtSymbol = from[1]['addr']:find("[^%@]+$")
|
||||||
key = "/etc/rspamd/dkim/keys/" .. domain .. ".default",
|
local domain = from[1]['addr']:sub(lastAtSymbol, #from[1]['addr'])
|
||||||
domain = domain,
|
local keyfile = io.open("/data/dkim/keys/" .. domain .. ".dkim")
|
||||||
selector = "default"
|
if keyfile then
|
||||||
}
|
rspamd_logger.infox(task, "DKIM signing mail for authorized user of domain %s", domain)
|
||||||
end
|
keyfile:close()
|
||||||
end
|
return {
|
||||||
return false
|
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
|
||||||
end
|
end
|
||||||
EOD;
|
EOD;
|
||||||
|
|
Loading…
Reference in New Issue