mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2024-12-12 10:45:14 +02:00
Merge branch 'dev' of https://github.com/andryyy/mailcow-dockerized
This commit is contained in:
commit
e66f566e86
@ -23,51 +23,56 @@ auth_domain_map = rspamd_config:add_map({
|
|||||||
description = 'Map of domains we are authoritative for'
|
description = 'Map of domains we are authoritative for'
|
||||||
})
|
})
|
||||||
|
|
||||||
rspamd_config:register_post_filter(function(task)
|
rspamd_config:register_symbol({
|
||||||
local util = require("rspamd_util")
|
name = 'TAG_MOO',
|
||||||
local rspamd_logger = require "rspamd_logger"
|
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 tagged_rcpt = task:get_symbol("TAGGED_RCPT")
|
||||||
local user = task:get_recipients(0)[1]['user']
|
local user = task:get_recipients(0)[1]['user']
|
||||||
local domain = task:get_recipients(0)[1]['domain']
|
local domain = task:get_recipients(0)[1]['domain']
|
||||||
local rcpt = user .. '@' .. domain
|
local rcpt = user .. '@' .. domain
|
||||||
local authdomain = auth_domain_map:get_key(domain)
|
local authdomain = auth_domain_map:get_key(domain)
|
||||||
|
|
||||||
if tagged_rcpt then
|
if tagged_rcpt then
|
||||||
local tag = tagged_rcpt[1].options[1]
|
local tag = tagged_rcpt[1].options[1]
|
||||||
rspamd_logger.infox("found tag: %s", tag)
|
rspamd_logger.infox("found tag: %s", tag)
|
||||||
local action = task:get_metric_action('default')
|
local action = task:get_metric_action('default')
|
||||||
rspamd_logger.infox("metric action now: %s", action)
|
rspamd_logger.infox("metric action now: %s", action)
|
||||||
|
|
||||||
if action ~= 'no action' and action ~= 'greylist' then
|
if action ~= 'no action' and action ~= 'greylist' then
|
||||||
rspamd_logger.infox("skipping tag handler for action: %s", action)
|
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
|
return false
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
if authdomain then
|
priority = 10
|
||||||
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)
|
|
||||||
|
|
||||||
rspamd_config.MRAPTOR = {
|
rspamd_config.MRAPTOR = {
|
||||||
callback = function(task)
|
callback = function(task)
|
||||||
|
@ -3320,7 +3320,7 @@ function mailbox_edit_alias_domain($postarray) {
|
|||||||
$stmt = $pdo->prepare("UPDATE `alias_domain` SET
|
$stmt = $pdo->prepare("UPDATE `alias_domain` SET
|
||||||
`alias_domain` = :alias_domain,
|
`alias_domain` = :alias_domain,
|
||||||
`active` = :active,
|
`active` = :active,
|
||||||
`modified` = :modified,
|
`modified` = :modified
|
||||||
WHERE `alias_domain` = :alias_domain_now");
|
WHERE `alias_domain` = :alias_domain_now");
|
||||||
$stmt->execute(array(
|
$stmt->execute(array(
|
||||||
':alias_domain' => $alias_domain,
|
':alias_domain' => $alias_domain,
|
||||||
|
Loading…
Reference in New Issue
Block a user