[Postfix] Lookup credentials for user-specific sender transports

master
andryyy 2021-08-17 16:51:06 +02:00
parent 4925487b44
commit 82f4f1fd15
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
2 changed files with 25 additions and 5 deletions

View File

@ -181,10 +181,30 @@ hosts = unix:/var/run/mysqld/mysqld.sock
dbname = ${DBNAME}
query = SELECT CONCAT_WS(':', username, password) AS auth_data FROM relayhosts
WHERE id IN (
SELECT relayhost FROM domain
WHERE CONCAT('@', domain) = '%s'
OR domain IN (
SELECT target_domain FROM alias_domain WHERE CONCAT('@', alias_domain) = '%s'
SELECT COALESCE(
(SELECT id FROM relayhosts
LEFT OUTER JOIN domain ON domain.relayhost = relayhosts.id
WHERE relayhosts.active = '1'
AND (domain.domain = '%d'
OR domain.domain IN (
SELECT target_domain FROM alias_domain
WHERE alias_domain = '%d'
)
)
),
(SELECT id FROM relayhosts
LEFT OUTER JOIN mailbox ON JSON_UNQUOTE(JSON_VALUE(mailbox.attributes, '$.relayhost')) = relayhosts.id
WHERE relayhosts.active = '1'
AND (
mailbox.username IN (
SELECT alias.goto from alias
JOIN mailbox ON mailbox.username = alias.goto
WHERE alias.active = '1'
AND alias.address = '%s'
AND alias.address NOT LIKE '@%%'
)
)
)
)
)
AND active = '1'

View File

@ -290,7 +290,7 @@ services:
- dovecot
postfix-mailcow:
image: mailcow/postfix:1.65
image: mailcow/postfix:1.66
depends_on:
- mysql-mailcow
volumes: