20 lines
747 B
Plaintext
20 lines
747 B
Plaintext
|
sign_condition =<<EOD
|
||
|
return function(task)
|
||
|
local from = task:get_from('smtp')
|
||
|
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("/etc/rspamd/dkim/keys/" .. domain .. ".default")
|
||
|
if keyfile then
|
||
|
keyfile:close()
|
||
|
return {
|
||
|
key = "/etc/rspamd/dkim/keys/" .. domain .. ".default",
|
||
|
domain = domain,
|
||
|
selector = "default"
|
||
|
}
|
||
|
end
|
||
|
end
|
||
|
return false
|
||
|
end
|
||
|
EOD;
|