Query Exchange with Postfix

Posted by Joshua Schmidlkofer Fri, 01 Sep 2006 23:23:00 GMT

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.

exchange_map.cf

bind_dn          = cn=Spamfilter User,cn=Users,dc=MySBS,dc=org
bind_pw          = kill$pam
scope            = sub
search_base      = dc=MySBS,dc=org
server_host      = ldaps://Server.MySBS.org:636
start_tls        = no
version          = 3
result_attribute = mail
query_filter     = (&(objectClass=user)(|(mail=%s)(proxyAddresses=SMTP:%s)))

test

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

main.cf

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

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

Postfix: Brewing Drinks With LDAP

Posted by Joshua Schmidlkofer Thu, 13 Apr 2006 20:43:00 GMT

We use CRM114, SpamAssassin and Postfix for most of our antispam solutions. We have somehow avoided using LDAP up to this point. Postfix 2.2 seems to have made a lot of relavent changesd regarding LDAP support, and now things are working smoothly and more clearly than ever.

Some don't recommend this, and they will want you to use all sorts of bastardized Perl or God help us, VBS to get entries from LDAP and ship them off to Linux.

Bollocks! I say, use LDAP queries directly, and manage load with proxymap.