|
@@ -97,7 +97,7 @@ query = SELECT IF(EXISTS(
|
|
|
SELECT CONCAT('%u', '@', target_domain) FROM alias_domain
|
|
|
WHERE alias_domain='%d'
|
|
|
)
|
|
|
- ) AND json_extract(attributes, '$.tls_enforce_in') LIKE '%%1%%' AND mailbox.active = '1'
|
|
|
+ ) AND JSON_UNQUOTE(JSON_VALUE(attributes, '$.tls_enforce_in')) = '1' AND mailbox.active = '1'
|
|
|
), 'reject_plaintext_session', NULL) AS 'tls_enforce_in';
|
|
|
EOF
|
|
|
|
|
@@ -117,7 +117,7 @@ query = SELECT GROUP_CONCAT(transport SEPARATOR '') AS transport_maps
|
|
|
WHERE alias_domain = '%d'
|
|
|
)
|
|
|
)
|
|
|
- AND json_extract(attributes, '$.tls_enforce_out') LIKE '%%1%%'
|
|
|
+ AND JSON_UNQUOTE(JSON_VALUE(attributes, '$.tls_enforce_out')) = '1'
|
|
|
AND mailbox.active = '1'
|
|
|
), 'smtp_enforced_tls:', 'smtp:') AS 'transport'
|
|
|
UNION ALL
|
|
@@ -264,7 +264,7 @@ user = ${DBUSER}
|
|
|
password = ${DBPASS}
|
|
|
hosts = unix:/var/run/mysqld/mysqld.sock
|
|
|
dbname = ${DBNAME}
|
|
|
-query = SELECT CONCAT(JSON_UNQUOTE(JSON_EXTRACT(attributes, '$.mailbox_format')), mailbox_path_prefix, '%d/%u/') FROM mailbox WHERE username='%s' AND (active = '1' OR active = '2')
|
|
|
+query = SELECT CONCAT(JSON_UNQUOTE(JSON_VALUE(attributes, '$.mailbox_format')), mailbox_path_prefix, '%d/%u/') FROM mailbox WHERE username='%s' AND (active = '1' OR active = '2')
|
|
|
EOF
|
|
|
|
|
|
cat <<EOF > /opt/postfix/conf/sql/mysql_virtual_relay_domain_maps.cf
|
|
@@ -318,6 +318,16 @@ query = SELECT goto FROM alias
|
|
|
AND alias_domain.active='1'
|
|
|
EOF
|
|
|
|
|
|
+# Reject sasl usernames with smtp disabled
|
|
|
+cat <<EOF > /opt/postfix/conf/sql/mysql_sasl_access_maps.cf
|
|
|
+# Autogenerated by mailcow
|
|
|
+user = ${DBUSER}
|
|
|
+password = ${DBPASS}
|
|
|
+hosts = unix:/var/run/mysqld/mysqld.sock
|
|
|
+dbname = ${DBNAME}
|
|
|
+query = SELECT 'REJECT' FROM mailbox WHERE username = '%u' AND JSON_UNQUOTE(JSON_VALUE(attributes, '$.smtp_access')) = '0';
|
|
|
+EOF
|
|
|
+
|
|
|
cat <<EOF > /opt/postfix/conf/sql/mysql_virtual_spamalias_maps.cf
|
|
|
# Autogenerated by mailcow
|
|
|
user = ${DBUSER}
|