Hello,

You will find bellow parts of my script that create a virtual alias map from on 
premise AD. You’ll have to work on transforming the output yourself 
(/usr/local/bin/get_exchg_aliases.awk in my script).
And you’ll have to tune AD_FILTRE to suit your needs.

EXCHG_OUTPUT="${TRAVAIL}/exchange.ldap"
EXCHG_ALIASES="${TRAVAIL}/exchange.virtual_alias"
AD_BINDNAME="************"
AD_BINDPW="************"
AD_BASE="OU=************,DC=************,DC=************,DC=***"
AD_FILTRE="(|(samaccountType=268435457)(samaccountType=805306368))"
AD_SEARCH="proxyaddresses"
AD_HOST="ldaps://************.************.***"

../..

/usr/local/bin/ldapsearch -v -xLLL -D ${AD_BINDNAME} -w ${AD_BINDPW} -b 
${AD_BASE} -H ${AD_HOST} ${AD_FILTRE} ${AD_SEARCH} > ${EXCHG_OUTPUT}
OUT=$?
if [ $OUT != 0 ]; then
 echo >&2 "Error: Get Aliases from AD failed (${OUT}) - (${SCRIPT_NAME})"
 exit $OTHER_ERR
fi

mv ${EXCHG_ALIASES} ${EXCHG_ALIASES}.old
/usr/local/bin/get_exchg_aliases.awk ${EXCHG_OUTPUT} | sort > ${EXCHG_ALIASES}
But really if you can use a direct bind and query your Azure AD like Wietse and 
Victor recommend, it’s probably best.

patpro

October 26, 2023 11:58 PM, "Joey J via Postfix-users" 
<postfix-users@postfix.org 
(mailto:postfix-users@postfix.org?to=%22Joey%20J%20via%20Postfix-users%22%20<postfix-users@postfix.org>)>
 wrote:
Hello All,

I'm trying to see if someone has a good app to connect to an exchange or O365 
server either via LDAP or AD to grab all of the legitimate email accounts, 
forwarding accounts and Groups in order to build a transport_recipients file 
this way reject all invalid email prior to forwarding it to any destination.

Im thinking there would be something open source out there, just not able to 
find it.

-- Thanks!
Joey
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to