I found this link from the postfix homepage, http://www.unixwiz.net/techtips/postfix-exchange-users.html
Some of the steps are specific to postfix, but if you can script you should be able to do pretty much anything with the ouptut unlike me who just thanks god there are people smart enough to do this stuff _and_ not mind publishing how they did it for folks like me :-) > -----Original Message----- > From: Ron Snyder [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 23, 2004 7:01 PM > To: Paul Hutchings; [EMAIL PROTECTED] > Subject: RE: Putting Spam Assasin between the internet and my mail > server > > > > I export a list from Exchange 5.5 every three hours, Exchange > > sucks in that > > it accepts the message then NDRs it, it doesn't do any > > validation during the > > smtp session. > > How do you export the list from exchange in an automated way? > Here's the > script that I wrote for my own use, but I'm always interested > in how other > folks are accomplishing the task: > *********************** > #!/bin/sh > > # MS Exchange 5.5 ldap server will fail to return good results if > # the query is too lengthy or returns too many results (about 1000 > # according to some web page I found). To get around that, do > # iterative wildcard queries, hopefully picking good beginning > # chars for the wildcard > for i in a b c d e f g h i j k l m n o p q r s t u v w x y z _ ; do > for j in a b c d e f g h i j k l m n o p q r s t u v w x y z _ ; do > #EXCHADM = the NT domain user with exchange admin rights > #EXCHADMDOMAIN = the NT domain that EXCHADM belongs to > #EXCHADMPW = password for the EXCHADM user > #EXCHSITE = the MS Exchange "site" > #EXCHORG = the MS Exchange Organization > # The user must have admin privileges, so that hidden mailboxes > # and hidden distribution lists can have their smtp > addresses include > # in the output. > > # We are only asking for the mail and otherMailbox values, but > # this script could certainly be modified to extract > other information > ldapsearch -x -D > "cn=$EXCHADM,dc=$EXCHADMDOMAIN,cn=admin" -w $EXCHADMPW > \ > -l 0 -b "cn=Recipients,ou=$EXCHSITE,o=$EXCHORG" -h cvo1 -P 3 \ > > "(&(rdn=$i$j*)(!(Extension-Attribute-1=NO_INET_EMAIL_INCOMING)))" \ > mail otherMailbox | grep -i -e mail: -e 'smtp\$' | \ > sed -e 's/^mail: //' -e 's/^otherMailbox: smtp\$//' | > tr 'A-Z' 'a-z' > done > done > ****************************** > > Notes: > #1) The Extension-Attribute-1=NO_INET_EMAIL_INCOMING is my own (test) > convention-- we have accounts that need to receive smtp email > from internal > processes but doesn't need to receive mail from the internet. > Setting Custom > Attribute #1 to NO_INET_EMAIL_INCOMING allows us to filter > those mailboxes > out. > #2) If you have multiple Exchange Sites in your organization, > you'll need to > do the same query above for each site. I suppose I could've > just put it into > a loop and iterate over each site. > #3) Specifying cn=admin in the -D parameter is required only > if you want to > include smtp addresses for hidden mailboxes, too. If you > don't specify > cn=admin then you'll only get smtp addresses for those > mailboxes that are > not hidden from the address book. > > > The output of this script is a list of valid smtp addresses > that you may > have to futz around with to make it work for your own mail filtering > machine. I have a different script that takes the output of > this one and > creates my sendmail access file. > > -ron >