Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: DBMail: users

Migration to LDAP with Postfix

 

 

DBMail users RSS feed   Index | Next | Previous | View Threaded


gordan at bobich

May 22, 2009, 5:56 AM

Post #1 of 3 (477 views)
Permalink
Migration to LDAP with Postfix

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
DBmail[at]dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


paul at nfg

May 22, 2009, 8:27 AM

Post #2 of 3 (444 views)
Permalink
Re: Migration to LDAP with Postfix [In reply to]

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: uid=someuser[at]domain.nl,mailDomain=domain.nl,ou=MailDomains,dc=nf
g,dc=nl
objectClass: account
objectClass: dbmailUser
objectClass: top
uidNumber: 1234
gidNumber: 1010
mail: someuser[at]domain.nl
mailQuota: 10000000
mailHost: dbmail
uid: someuser[at]domain.nl


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
> DBmail[at]dbmail.org
> 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
DBmail[at]dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


gordan at bobich

May 22, 2009, 8:54 AM

Post #3 of 3 (448 views)
Permalink
Re: Migration to LDAP with Postfix [In reply to]

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 foo[at]bar.org, but also wants an alias baz[at]bar.org. Will both
foo[at]bar.org and baz[at]bar.org 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 <paul[at]nfg.nl> 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: uid=someuser[at]domain.nl,mailDomain=domain.nl,ou=MailDomains,dc=nf
> g,dc=nl
> objectClass: account
> objectClass: dbmailUser
> objectClass: top
> uidNumber: 1234
> gidNumber: 1010
> mail: someuser[at]domain.nl
> mailQuota: 10000000
> mailHost: dbmail
> uid: someuser[at]domain.nl
>
>
> 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
>> DBmail[at]dbmail.org
>> http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
>>
_______________________________________________
DBmail mailing list
DBmail[at]dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

DBMail users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.