Gordan, We use the dbmailDomain objectClass for that purpose.
We stuff domains in their own subtree, and add users to the correct subtree below that: dn: mailDomain=domain.nl,ou=mailDomains,dc=nfg,dc=nl objectClass: top objectClass: dbmailDomain mailDomain: domain.nl mailHost: lmtp:[dbmail]:24 dn: [email protected],mailDomain=domain.nl,ou=MailDomains,dc=nf g,dc=nl objectClass: account objectClass: dbmailUser objectClass: top uidNumber: 1234 gidNumber: 1010 mail: [email protected] mailQuota: 10000000 mailHost: dbmail uid: [email protected] with this setup we use a set of ldap queries in postfix: relay_domains = $mydestination, ldap:/etc/postfix/ldap_relay.cf transport_maps = ldap:/etc/postfix/ldap_transport.cf virtual_transport = lmtp:[dbmail]:24 virtual_mailbox_domains = ldap:/etc/postfix/ldap_virtual_domains.cf virtual_mailbox_maps = ldap:/etc/postfix/ldap_virtual_mailbox.cf alias_maps = ldap:/etc/postfix/ldap_aliases.cf ldap_relay.cf: server_host = ldap bind = no search_base = dc=nfg,dc=nl query_filter = (&(mailDomain=%s)(objectClass=dbmailDomain)(!(mailHost=lmtp:[dbmail]:24))) result_attribute = mailDomain ldap_transport.cf: server_host = ldap bind = no search_base = dc=nfg,dc=nl query_filter = (&(mailDomain=%d)(objectClass=dbmailDomain)) result_attribute = mailHost result_filter = %s ldap_virtual_domains.cf: server_host = ldap bind = no search_base = dc=nfg,dc=nl query_filter = (&(objectClass=dbmailDomain)(mailDomain=%s)(mailHost=lmtp:[dbmail]:24)) result_attribute = mailDomain ldap_virtual_mailbox.cf: server_host = ldap bind = no search_base = dc=nfg,dc=nl query_filter = (mail=%s) result_attribute = uid ldap_aliases.cf: server_host = ldap bind = no search_base = dc=nfg,dc=nl query_filter = (&(objectclass=dbmailforwardingaddress)(mail=%s)) result_attribute = mailForwardingAddress Of course, dbmail-users won't manage domains like this, so I wrote a set of shell scripts to control ldapmodify and perform CRUD operations on domains and users. Gordan Bobic wrote: > I'm currently using DBMail in standalone mode, and my Postfix domain and > recipient maps are as follows: > > main.cf: > mydestination = $myhostname, localhost.localdomain, localhost, > mysql:/etc/postfix/sql-domains.cf > local_recipient_maps = mysql:/etc/postfix/sql-recipients.cf > proxy:unix:passwd.byname $alias_maps > > sql-domains.cf: > query = SELECT DISTINCT SUBSTRING_INDEX(dbmail_aliases.alias,'@',-1) FROM > dbmail_aliases WHERE dbmail_aliases.alias LIKE '%...@%%' AND > SUBSTRING_INDEX(dbmail_aliases.alias,'@',-1) = '%s' UNION SELECT DISTINCT > SUBSTRING_INDEX(dbmail_users.userid,'@',-1) FROM dbmail_users WHERE userid > NOT LIKE '__%%' AND SUBSTRING_INDEX(dbmail_users.userid,'@',-1) = '%s'; > > sql-recipients.cf: > query = SELECT alias FROM dbmail_aliases WHERE alias='%s' UNION SELECT > userid FROM dbmail_users WHERE userid='%s'; > > How does this need to change when migrating to LDAP? Since the main address > is now in LDAP, I presume that so will be any aliases, whereas before the > aliases were in the dbmail database. Am I understanding this correctly or > will this end up being duplicated in the database my dbmail? What will end > up needing to be looked up from the DB and what will end up needing to be > looked up from LDAP? > > Thanks. > > Gordan > _______________________________________________ > DBmail mailing list > [email protected] > http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail > -- ________________________________________________________________ Paul Stevens paul at nfg.nl NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31 The Netherlands________________________________http://www.nfg.nl _______________________________________________ DBmail mailing list [email protected] http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
