Created
June 24, 2023 02:59
-
-
Save LuisCardenasSolis/9e1570ef9fefeabc72bd29ac0268e087 to your computer and use it in GitHub Desktop.
Zimbra Milter : Export distribution lists permissions and owner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ZMPROV="/opt/zimbra/bin/zmprov" | |
LISTS=$($ZMPROV gadl) | |
for list in $LISTS; do | |
MILTER=$($ZMPROV gdl $list | grep zimbraACE:) | |
if [ -n "$MILTER" ];then | |
while read line; do | |
#grantee-type : usr, grp, egp, all, dom, edom, gst, key, pub, email | |
TYPE=$(echo $line | awk -F" " '{print $3}') | |
SENDER=$(echo $line | awk -F" " '{print $2}') | |
ACTION=$(echo $line | awk -F" " '{print $4}') | |
if [ $TYPE == "usr" ]; then | |
SENDER=$($ZMPROV -l ga $SENDER name | grep "# name " | sed "s/# name //") | |
elif [ $TYPE == "grp" ]; then | |
SENDER=$($ZMPROV gdl $SENDER name | grep "# distributionList " | awk -F" " '{print $3}') | |
elif [ $TYPE == "dom" ]; then | |
SENDER=$($ZMPROV gd $SENDER name | grep "# name " | sed "s/# name //") | |
elif [[ $TYPE == "all" || $TYPE == "pub" ]]; then | |
SENDER="" | |
fi | |
echo "grr dl $list $TYPE $SENDER $ACTION" | |
done <<< "$MILTER" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment