From 8a8358780059abfb2c8ffe395392b220c3f39fdb Mon Sep 17 00:00:00 2001 From: andryyy Date: Fri, 28 May 2021 10:40:41 +0200 Subject: [PATCH] [Postfix] Finally here: MX based transport map routing; Sorry it took years, Patrik [Web] Small fixes --- data/Dockerfiles/postfix/postfix.sh | 13 +++++++ data/conf/postfix/main.cf | 2 + data/web/admin.php | 24 ++++++------ data/web/css/build/008-mailcow.css | 3 ++ data/web/edit.php | 8 ++++ data/web/inc/functions.transports.inc.php | 45 ++++++++++++++++++----- data/web/inc/init_db.inc.php | 8 ++-- data/web/js/build/014-mailcow.js | 2 +- data/web/js/site/admin.js | 22 +++++++---- data/web/lang/lang.de.json | 16 ++++---- data/web/lang/lang.en.json | 16 ++++---- docker-compose.yml | 2 +- 12 files changed, 112 insertions(+), 49 deletions(-) diff --git a/data/Dockerfiles/postfix/postfix.sh b/data/Dockerfiles/postfix/postfix.sh index fac8bbf4..dec007fa 100755 --- a/data/Dockerfiles/postfix/postfix.sh +++ b/data/Dockerfiles/postfix/postfix.sh @@ -337,6 +337,19 @@ query = SELECT goto FROM alias AND alias_domain.active='1' EOF +# MX based routing +cat < /opt/postfix/conf/sql/mysql_mbr_access_maps.cf +# Autogenerated by mailcow +user = ${DBUSER} +password = ${DBPASS} +hosts = unix:/var/run/mysqld/mysqld.sock +dbname = ${DBNAME} +query = SELECT CONCAT('FILTER smtp_via_transport_maps:', nexthop) as transport FROM transports + WHERE '%s' REGEXP destination + AND active='1' + AND is_mx_based='1'; +EOF + # Reject sasl usernames with smtp disabled cat < /opt/postfix/conf/sql/mysql_sasl_access_maps.cf # Autogenerated by mailcow diff --git a/data/conf/postfix/main.cf b/data/conf/postfix/main.cf index 1005b284..a1bcf578 100644 --- a/data/conf/postfix/main.cf +++ b/data/conf/postfix/main.cf @@ -78,6 +78,7 @@ postscreen_non_smtp_command_enable = no postscreen_pipelining_enable = no proxy_read_maps = proxy:mysql:/opt/postfix/conf/sql/mysql_sasl_passwd_maps_transport_maps.cf, proxy:mysql:/opt/postfix/conf/sql/mysql_sasl_access_maps.cf, + proxy:mysql:/opt/postfix/conf/sql/mysql_mbr_access_maps.cf, proxy:mysql:/opt/postfix/conf/sql/mysql_tls_enforce_in_policy.cf, $sender_dependent_default_transport_maps, $smtp_tls_policy_maps, @@ -116,6 +117,7 @@ smtpd_hard_error_limit = ${stress?1}${stress:5} smtpd_helo_required = yes smtpd_proxy_timeout = 600s smtpd_recipient_restrictions = check_sasl_access proxy:mysql:/opt/postfix/conf/sql/mysql_sasl_access_maps.cf, + check_recipient_mx_access proxy:mysql:/opt/postfix/conf/sql/mysql_mbr_access_maps.cf, permit_sasl_authenticated, permit_mynetworks, check_recipient_access proxy:mysql:/opt/postfix/conf/sql/mysql_tls_enforce_in_policy.cf, diff --git a/data/web/admin.php b/data/web/admin.php index 136b65e9..58d17ab3 100644 --- a/data/web/admin.php +++ b/data/web/admin.php @@ -431,19 +431,19 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC

-
+
- +
- +
- +
@@ -474,29 +474,29 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC

-
+
- ' required> + ' required>
- +
- +
- +
- +