From 1513c062a7fc54abeab5bcd14a8313b562a56bcb Mon Sep 17 00:00:00 2001 From: putro <putro@autistici.org> Date: Fri, 24 May 2019 16:30:42 +0200 Subject: [PATCH] fixed recipients with aliases --- roles/mail/templates/postfix-in/main.cf | 3 +-- roles/mail/templates/postfix-out/main.cf | 4 ++-- roles/mail/templates/postfix/ldap/all-recipients | 9 +++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 roles/mail/templates/postfix/ldap/all-recipients diff --git a/roles/mail/templates/postfix-in/main.cf b/roles/mail/templates/postfix-in/main.cf index 13d1c97e..717e1fad 100644 --- a/roles/mail/templates/postfix-in/main.cf +++ b/roles/mail/templates/postfix-in/main.cf @@ -86,8 +86,7 @@ postscreen_cache_map = lmdb:${data_directory}/postscreen_cache relay_domains = ${indexed}domains cdb:/etc/postfix/domains-auto relay_recipient_maps = ${indexed}virtual, - ${ldap}recipients, - ${ldap}aliases, + ${ldap}all-recipients, ${indexed}transport, ${indexed}mailman_transport diff --git a/roles/mail/templates/postfix-out/main.cf b/roles/mail/templates/postfix-out/main.cf index 2e2bd881..65b94a5e 100644 --- a/roles/mail/templates/postfix-out/main.cf +++ b/roles/mail/templates/postfix-out/main.cf @@ -39,11 +39,11 @@ smtpd_timeout = 1200s # "smtp" transport for outbound mail (bounces, ...). The latter # won't starve the former of delivery agent slots. relay_domains = ${indexed}domains cdb:/etc/postfix/domains-auto -relay_recipient_maps = ${ldap}recipients ${ldap}aliases ${indexed}virtual ${indexed}transport ${indexed}mailman_transport +relay_recipient_maps = ${ldap}all-recipients ${indexed}virtual ${indexed}transport ${indexed}mailman_transport relay_destination_recipient_limit = 1 # Send each message to its target backend. -transport_maps = ${ldap}recipients ${indexed}transport ${indexed}mailman_transport +transport_maps = ${ldap}all-recipients ${indexed}transport ${indexed}mailman_transport # Message size limit. message_size_limit = 15000000 diff --git a/roles/mail/templates/postfix/ldap/all-recipients b/roles/mail/templates/postfix/ldap/all-recipients new file mode 100644 index 00000000..3febe165 --- /dev/null +++ b/roles/mail/templates/postfix/ldap/all-recipients @@ -0,0 +1,9 @@ +# LDAP query resolving valid mailbox users + +{% include "ldap.base.j2" %} + +search_base = {{ postfix_ldap_base }} +query_filter = (&(|(mail=%s)(mailAlternateAddress=%s))(objectClass=virtualMailUser)(|(status=active)(status=temporary)(status=readonly))) +scope = sub +result_attribute = host +result_format = relay:[%s.mail-backend.{{ domain }}] -- GitLab