Query Exchange with Postfix

Posted by Joshua Schmidlkofer 01/09/2006 at 16h23

This is a simple, but cool, recipe for querying Exchange from Postfix. This is used with a Windows 2003 Small Business Server, running (s)Exchange 2003.

We don't often use this, because of the obvious problem of being unable to receive mail when Exchange crashes or must be rebooted. It is nice though, and a straight forward solution.

exchangemap.cf

binddn          = cn=Spamfilter User,cn=Users,dc=MySBS,dc=org
bindpw          = kill$pam
scope            = sub
searchbase      = dc=MySBS,dc=org
serverhost      = ldaps://Server.MySBS.org:636
starttls        = no
version          = 3
resultattribute = mail
queryfilter     = (&(objectClass=user)(|(mail=%s)(proxyAddresses=SMTP:%s)))

test

firewall postfix #  postmap -q kelly@MySBS.org ldap:/etc/postfix/exchangemap.cf
kelly@MySBS.org
firewall postfix #  postmap -q fakeuser@MySBS.org ldap:/etc/postfix/exchangemap.cf
firewall postfix #  postmap -q joshua@imrnet.com ldap:/etc/postfix/exchange_map.cf

main.cf

.....
relayrecipientmaps  =  ldap:/etc/postfix/exchange_map.cf
.....

So, Kelly exists, but fakeuser, and Joshua are (mysteriously) absent.