From ef2904e51391a34fec73d6ea9f58add91671406c Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 24 Jan 2022 17:56:25 +0100 Subject: [PATCH] correctly configure login maps --- rootfs/etc/confd/templates/main.cf.tmpl | 5 +---- rootfs/etc/confd/templates/pgsql-login-maps.cf.tmpl | 2 +- rootfs/etc/confd/templates/pgsql-virtual-alias-maps.cf.tmpl | 2 +- .../confd/templates/pgsql-virtual-mailbox-domains.cf.tmpl | 2 +- .../etc/confd/templates/pgsql-virtual-mailbox-maps.cf.tmpl | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/rootfs/etc/confd/templates/main.cf.tmpl b/rootfs/etc/confd/templates/main.cf.tmpl index e3c6081..37aaeb6 100644 --- a/rootfs/etc/confd/templates/main.cf.tmpl +++ b/rootfs/etc/confd/templates/main.cf.tmpl @@ -63,10 +63,7 @@ smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_u smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination, reject_unverified_recipient smtpd_sender_restrictions = reject_sender_login_mismatch -smtpd_sender_login_maps = unionmap:{ - $virtual_mailbox_maps, - pgsql:/etc/postfix/pgsql-login-maps.cf -} +smtpd_sender_login_maps = pgsql:/etc/postfix/pgsql-login-maps.cf smtpd_milters={{getenv "RSPAMD_ADDRESS" "inet:127.0.0.1:11332"}} non_smtpd_milters=$smtpd_milters diff --git a/rootfs/etc/confd/templates/pgsql-login-maps.cf.tmpl b/rootfs/etc/confd/templates/pgsql-login-maps.cf.tmpl index 86983da..98f90dd 100644 --- a/rootfs/etc/confd/templates/pgsql-login-maps.cf.tmpl +++ b/rootfs/etc/confd/templates/pgsql-login-maps.cf.tmpl @@ -2,4 +2,4 @@ hosts = {{ getenv "DB_HOST" }} user = {{ getenv "DB_USER" "email" }} password = {{ getenv "DB_PASSWORD" }} dbname = {{ getenv "DB_NAME" "email" }} -query = SELECT source FROM virtual_aliases WHERE destination='%u' +query = SELECT email FROM virtual_users WHERE email='%s' UNION SELECT destination FROM virtual_aliases WHERE email='%s' diff --git a/rootfs/etc/confd/templates/pgsql-virtual-alias-maps.cf.tmpl b/rootfs/etc/confd/templates/pgsql-virtual-alias-maps.cf.tmpl index d7e5ef4..302129d 100644 --- a/rootfs/etc/confd/templates/pgsql-virtual-alias-maps.cf.tmpl +++ b/rootfs/etc/confd/templates/pgsql-virtual-alias-maps.cf.tmpl @@ -2,4 +2,4 @@ hosts = {{ getenv "DB_HOST" }} user = {{ getenv "DB_USER" "email" }} password = {{ getenv "DB_PASSWORD" }} dbname = {{ getenv "DB_NAME" "email" }} -query = SELECT destination FROM virtual_aliases WHERE source='%u' +query = SELECT destination FROM virtual_aliases WHERE email='%s' diff --git a/rootfs/etc/confd/templates/pgsql-virtual-mailbox-domains.cf.tmpl b/rootfs/etc/confd/templates/pgsql-virtual-mailbox-domains.cf.tmpl index 89292e5..6fd5b58 100644 --- a/rootfs/etc/confd/templates/pgsql-virtual-mailbox-domains.cf.tmpl +++ b/rootfs/etc/confd/templates/pgsql-virtual-mailbox-domains.cf.tmpl @@ -2,4 +2,4 @@ hosts = {{ getenv "DB_HOST" }} user = {{ getenv "DB_USER" "email" }} password = {{ getenv "DB_PASSWORD" }} dbname = {{ getenv "DB_NAME" "email" }} -query = SELECT name FROM virtual_domains WHERE name='%u' +query = SELECT name FROM virtual_domains WHERE name='%s' diff --git a/rootfs/etc/confd/templates/pgsql-virtual-mailbox-maps.cf.tmpl b/rootfs/etc/confd/templates/pgsql-virtual-mailbox-maps.cf.tmpl index addd0fb..971fa97 100644 --- a/rootfs/etc/confd/templates/pgsql-virtual-mailbox-maps.cf.tmpl +++ b/rootfs/etc/confd/templates/pgsql-virtual-mailbox-maps.cf.tmpl @@ -2,4 +2,4 @@ hosts = {{ getenv "DB_HOST" }} user = {{ getenv "DB_USER" "email" }} password = {{ getenv "DB_PASSWORD" }} dbname = {{ getenv "DB_NAME" "email" }} -query = SELECT email FROM virtual_users WHERE email ='%u' +query = SELECT email FROM virtual_users WHERE email ='%s'