Merge branch 'dev' of https://github.com/andryyy/mailcow-dockerized
commit
e66f566e86
|
@ -23,51 +23,56 @@ auth_domain_map = rspamd_config:add_map({
|
|||
description = 'Map of domains we are authoritative for'
|
||||
})
|
||||
|
||||
rspamd_config:register_post_filter(function(task)
|
||||
local util = require("rspamd_util")
|
||||
local rspamd_logger = require "rspamd_logger"
|
||||
rspamd_config:register_symbol({
|
||||
name = 'TAG_MOO',
|
||||
type = 'postfilter',
|
||||
callback = function(task)
|
||||
local util = require("rspamd_util")
|
||||
local rspamd_logger = require "rspamd_logger"
|
||||
|
||||
local tagged_rcpt = task:get_symbol("TAGGED_RCPT")
|
||||
local user = task:get_recipients(0)[1]['user']
|
||||
local domain = task:get_recipients(0)[1]['domain']
|
||||
local rcpt = user .. '@' .. domain
|
||||
local authdomain = auth_domain_map:get_key(domain)
|
||||
local tagged_rcpt = task:get_symbol("TAGGED_RCPT")
|
||||
local user = task:get_recipients(0)[1]['user']
|
||||
local domain = task:get_recipients(0)[1]['domain']
|
||||
local rcpt = user .. '@' .. domain
|
||||
local authdomain = auth_domain_map:get_key(domain)
|
||||
|
||||
if tagged_rcpt then
|
||||
local tag = tagged_rcpt[1].options[1]
|
||||
rspamd_logger.infox("found tag: %s", tag)
|
||||
local action = task:get_metric_action('default')
|
||||
rspamd_logger.infox("metric action now: %s", action)
|
||||
if tagged_rcpt then
|
||||
local tag = tagged_rcpt[1].options[1]
|
||||
rspamd_logger.infox("found tag: %s", tag)
|
||||
local action = task:get_metric_action('default')
|
||||
rspamd_logger.infox("metric action now: %s", action)
|
||||
|
||||
if action ~= 'no action' and action ~= 'greylist' then
|
||||
rspamd_logger.infox("skipping tag handler for action: %s", action)
|
||||
if action ~= 'no action' and action ~= 'greylist' then
|
||||
rspamd_logger.infox("skipping tag handler for action: %s", action)
|
||||
task:set_metric_action('default', action)
|
||||
end
|
||||
|
||||
if authdomain then
|
||||
rspamd_logger.infox("found mailcow domain %s", domain)
|
||||
rspamd_logger.infox("querying tag settings for user %s", rcpt)
|
||||
|
||||
if modify_subject_map:get_key(rcpt) then
|
||||
rspamd_logger.infox("user wants subject modified for tagged mail")
|
||||
local sbj = task:get_header('Subject')
|
||||
new_sbj = '=?UTF-8?B?' .. tostring(util.encode_base64('[' .. tag .. '] ' .. sbj)) .. '?='
|
||||
task:set_rmilter_reply({
|
||||
remove_headers = {['Subject'] = 1},
|
||||
add_headers = {['Subject'] = new_sbj}
|
||||
})
|
||||
else
|
||||
rspamd_logger.infox("Add X-Moo-Tag header")
|
||||
task:set_rmilter_reply({
|
||||
add_headers = {['X-Moo-Tag'] = 'YES'}
|
||||
})
|
||||
end
|
||||
else
|
||||
rspamd_logger.infox("skip delimiter handling for unknown domain")
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
if authdomain then
|
||||
rspamd_logger.infox("found mailcow domain %s", domain)
|
||||
rspamd_logger.infox("querying tag settings for user %s", rcpt)
|
||||
|
||||
if modify_subject_map:get_key(rcpt) then
|
||||
rspamd_logger.infox("user wants subject modified for tagged mail")
|
||||
local sbj = task:get_header('Subject')
|
||||
new_sbj = '=?UTF-8?B?' .. tostring(util.encode_base64('[' .. tag .. '] ' .. sbj)) .. '?='
|
||||
task:set_rmilter_reply({
|
||||
remove_headers = {['Subject'] = 1},
|
||||
add_headers = {['Subject'] = new_sbj}
|
||||
})
|
||||
else
|
||||
rspamd_logger.infox("Add X-Moo-Tag header")
|
||||
task:set_rmilter_reply({
|
||||
add_headers = {['X-Moo-Tag'] = 'YES'}
|
||||
})
|
||||
end
|
||||
else
|
||||
rspamd_logger.infox("skip delimiter handling for unknown domain")
|
||||
end
|
||||
return false
|
||||
end
|
||||
end)
|
||||
end,
|
||||
priority = 10
|
||||
})
|
||||
|
||||
rspamd_config.MRAPTOR = {
|
||||
callback = function(task)
|
||||
|
|
|
@ -3320,7 +3320,7 @@ function mailbox_edit_alias_domain($postarray) {
|
|||
$stmt = $pdo->prepare("UPDATE `alias_domain` SET
|
||||
`alias_domain` = :alias_domain,
|
||||
`active` = :active,
|
||||
`modified` = :modified,
|
||||
`modified` = :modified
|
||||
WHERE `alias_domain` = :alias_domain_now");
|
||||
$stmt->execute(array(
|
||||
':alias_domain' => $alias_domain,
|
||||
|
|
Loading…
Reference in New Issue