Linode Forum
https://forum.linode.com/

Postfix+LDAP not dropping to the right user
https://forum.linode.com/viewtopic.php?f=11&t=3893
Page 1 of 1

Author:  pratfall [ Fri Feb 13, 2009 2:12 pm ]
Post subject:  Postfix+LDAP not dropping to the right user

I'm working on moving my mail from Postfix + Cyrus with all my virtual users in Cyrus' sasl database to Postfix + Dovecot with all my virtual users in an LDAP database.

I have my test user in LDAP, test@foo.com, which has mailAlternateAddress'es test1@foo.com and test2@foo.com. test@foo.com's uid is "nottest".

In postfix's main.cf, I set

alias_maps = hash:/etc/aliases, ldap:/etc/postfix/ldap.cf

and in ldap.cf, I have:
server_host = ldapserver
search_base = dc=foo, dc=com
query_filter = (|(mail=%s)(mailAlternateAddress=%s))
result_attribute = uid

I'm expecting postfix to do a search like "(|(mail=test2@foo.com)(mailAlternateAddress=test2@foo.com))" (which I tested, and got my nottest uid), return the uid, and call dovecot's deliver with the uid "nottest" as the user. Instead, its calling deliver and delivering to the user part of the email address, e.g. test2, test1.

I tried a postmap -vq "test2@foo.com" ldap:/etc/postfix/ldap.cf, and it returned the UID I expected. So, there's nothing wrong with the LDAP config, it's gotta be something that happens between the lookup and the handoff to dovecot's deliver. Right now I suspect its my line in master.cf:

dovecot unix - n n - - pipe
flags=DRhu user=mail:mail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}


I think $user is the wrong variable to use, but I'm not sure how to tell Postfix to deliver to the LDAP UID, not dumbly deliver to test2.

Also, I noticed that Postfix isn't bouncing mails to addresses that don't exist. I emailed barf@foo.org, and Postfix just dropped off the mail to the non-existent mail user "barf".

Anyone know what I'm missing?

Thanks!

Author:  Vance [ Sat Feb 14, 2009 2:45 am ]
Post subject:  Re: Postfix+LDAP not dropping to the right user

I don't know LDAP so can't help with most of your question (although more than once I've scratched my head over why a Postfix change didn't take, only to realize that I forgot to run "newaliases" or restart Postfix, so you might try those), but on this one:

pratfall wrote:
Also, I noticed that Postfix isn't bouncing mails to addresses that don't exist. I emailed barf@foo.org, and Postfix just dropped off the mail to the non-existent mail user "barf".

Do you have local_recipient_maps set so it isn't empty?

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/