From 8f686c154327e2748e5aeaa372eff9fcf870e04c Mon Sep 17 00:00:00 2001 From: andryyy Date: Wed, 19 Dec 2018 09:38:56 +0100 Subject: [PATCH] [Postfix] Split sasl passwd maps to not lookup sender_dependent_default_transport_maps auth info when querying for transport_maps --- data/Dockerfiles/postfix/postfix.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/data/Dockerfiles/postfix/postfix.sh b/data/Dockerfiles/postfix/postfix.sh index 7a69258f..425d65ff 100755 --- a/data/Dockerfiles/postfix/postfix.sh +++ b/data/Dockerfiles/postfix/postfix.sh @@ -85,7 +85,17 @@ query = SELECT GROUP_CONCAT(transport SEPARATOR '') AS transport_maps AS transport_view; EOF -cat < /opt/postfix/conf/sql/mysql_sasl_passwd_maps.cf +cat < /opt/postfix/conf/sql/mysql_transport_maps.cf +user = ${DBUSER} +password = ${DBPASS} +hosts = unix:/var/run/mysqld/mysqld.sock +dbname = ${DBNAME} +query = SELECT CONCAT('smtp_via_transport_maps:', nexthop) AS transport FROM transports + WHERE active = '1' + AND destination = '%s'; +EOF + +cat < /opt/postfix/conf/sql/mysql_sasl_passwd_maps_sender_dependent.cf user = ${DBUSER} password = ${DBPASS} hosts = unix:/var/run/mysqld/mysqld.sock @@ -98,6 +108,18 @@ query = SELECT CONCAT_WS(':', username, password) AS auth_data FROM relayhosts SELECT CONCAT('@', alias_domain) FROM alias_domain ) ) + AND active = '1' + AND username != ''; +EOF + +cat < /opt/postfix/conf/sql/mysql_sasl_passwd_maps_transport_maps.cf +user = ${DBUSER} +password = ${DBPASS} +hosts = unix:/var/run/mysqld/mysqld.sock +dbname = ${DBNAME} +query = SELECT CONCAT_WS(':', username, password) AS auth_data FROM transports + WHERE nexthop = '%s' + AND active = '1' AND username != ''; EOF