Thanks for that. Is there any reason not to use something like this
instead?

main.cf:
local_recipient_maps = ldap:/etc/postfix/ldap-recipients.cf
mydestination = $myhostname, localhost.localdomain, localhost,
ldap:/etc/postfix/ldap-domains.cf

ldap-recipients.cf:
server_host = localhost
search_base = dc=example,dc=org
query_filter = mail=%s
result_attribute = mail

ldap-domains.cf:
server_host = localhost
search_base = dc=example,dc=org
query_filter = mail=%s
result_attribute = mail
result_format = %d

My main concern is what happens with aliases. Say I have a user that has a
primary account [email protected], but also wants an alias [email protected]. Will both
[email protected] and [email protected] end up as separate "mail" attributes in ldap
after being added with "dbmail-users -s"? Or is the "mail" attribute only
for the primary email address and aliases go elsewhere?

Gordan

On Fri, 22 May 2009 17:27:38 +0200, Paul J Stevens <[email protected]> wrote:
> 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
>>
_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to