[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,11 +181,31 @@ hosts = unix:/var/run/mysqld/mysqld.sock
dbname = ${DBNAME} dbname = ${DBNAME}
query = SELECT CONCAT_WS(':', username, password) AS auth_data FROM relayhosts query = SELECT CONCAT_WS(':', username, password) AS auth_data FROM relayhosts
WHERE id IN ( WHERE id IN (
SELECT relayhost FROM domain SELECT COALESCE(
WHERE CONCAT('@', domain) = '%s' (SELECT id FROM relayhosts
OR domain IN ( LEFT OUTER JOIN domain ON domain.relayhost = relayhosts.id
SELECT target_domain FROM alias_domain WHERE CONCAT('@', alias_domain) = '%s' 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' AND active = '1'
AND username != ''; AND username != '';

View File

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