Hi all,

Venturing into postfix+openldap country I bumped into a challenge: is it possible to use an LDAP table for canonical_maps to generically rewrite domainA to domainB (so for all email addresses @domainA.org)? It works fine when I use this in a hash table:

@domainA.org  @domainB.org

But I can't make this work via LDAP.

The OpenLDAP server uses this setup:

uid=t...@domaina.org,ou=people,ou=domainA.org,ou=hosted,dc=example,dc=org

$ grep canonical /etc/postfix/main.cf
canonical_maps = proxy:ldap:/etc/postfix/ldap-canonical.cf
canonical_classes = envelope_recipient

$ cat /etc/postfix/ldap-canonical.cf
server_host = ldapi://%2Fvar%2Frun%2Fldapi
bind = yes
bind_dn = cn=Manager,dc=example,dc=org
bind_pw = <scrubbed>
search_base = ou=hosted,dc=example,dc=org
version = 3
scope = one
query_filter = ou=%d
result_attribute = description
result_format  = %s

I abused the "description" attribute under ou=domainA.org to contain the new domainB.org that domainA.org should be rewritten to. The ldif of ou=domainA.org is:

dn: ou=domainA.org,ou=hosted,dc=example,dc=org
objectClass: organizationalUnit
objectClass: top
ou: domainA.org
description: @domainB.org

When testing only @domainB.org shows up instead of the rewritten email address (use of %d):

postmap -q t...@domaina.org ldap:/etc/postfix/ldap-canonical.cf
@domainB.org

I can't figure out how to make it do the rewrite for all email addresses under domainA.org to domainB.org. I would appreciate it if anyone could give me a hint or point me to some fine material to read how to make this work (if possible).

Thanks and regards,
Patrick

Reply via email to