Zimbra Notes
Contents
- 1 Configuration
- 2 Zimbra debugging
- 2.1 Check all users Trash folders for mails older than 40 days
- 2.2 Zimbra debugging in web browser
- 2.3 Zimbra debugging to logfile
- 2.4 comandline calendar queries
- 2.5 comandline adressbook queries
- 2.6 list all accounts
- 2.7 zimbra user query in mysql db
- 2.8 restore mailbox with prefix in username
- 2.9 find username from USER-UUID
- 2.10 get zimbraID of account
1 Configuration
1.1 Restrict Zimbra Senders to Distribution List
Recently I had some spam on internal distribution lists.
That was too bad, because it was a first class credit card fake :-)
So I searched and found a simple way to only allow domain sender address to send email to distribution lists.
That solved my problem.
Here is how I did it:
zmprov modifyConfig zimbraMilterServerEnabled TRUE zmmilterctl restart zmmilterctl status ZDOMAIN=mydomain.ch zmprov gadl $ZDOMAIN | while read dl_email do echo "---- deny all senders to $dl_email" zmprov grr dl $dl_email pub -sendToDistList echo "---- allow $ZDOMAIN senders to $dl_email" zmprov grr dl $dl_email dom $ZDOMAIN sendToDistList done zmmtactl reload
This is a good site to read more details:
1.2 Change Galsync Account
zmprov modifyDomain mydomain.ch zimbraGalAccountId 42ef46f3-bc1e-4795-8fca-42d8c3c597bd zmprov gd mybuehl.ch | egrep -i 'ldap|gal' zimbraGalAccountId: 42ef46f3-bc1e-4795-8fca-42d8c3c597bd #login to zimbra admin and tick "hide in GAL" on galsync account zmgsautil createAccount -a galsync@mydomain.ch -n InternalGAL --domain mydomain.ch -t zimbra -f _InternalGAL galsync@mydomain.ch 42ef46f3-bc1e-4795-8fca-42d8c3c597bd zmgsautil forceSync -a galsync@mydomain.ch -n InternalGAL # login to old galsync account (admin) and remove _InternalGAL folder from address book
1.3 get signatures of all users
- get all signatures
#!/bin/bash DIR=/opt/scripts/sig id | grep zimbra || (echo "ERROR: start it as user zimbra" ; pkill -9 $$) clear mkdir -p $DIR echo "Retrieve zimbra user name..." USERS=`zmprov sa -v zimbraMailDeliveryAddress="*@stiftung-buehl.ch" | grep zimbraMailAlias | sed 's/.*: //' | grep -e '^b....@' -e '^e....@' | cut -d'@' -f1 | sort -u` for ACCOUNT in $USERS do NAME=`echo $ACCOUNT` zmprov getSignatures $NAME > $DIR/$NAME.txt echo "Export signature for $NAME..." done echo "All signature has been export successfully"
- split all signatures
#!/bin/bash DIR=/opt/scripts/sig id | grep zimbra || (echo "ERROR: start it as user zimbra" ; pkill -9 $$) mkdir -p $DIR cd $DIR ls -1 *.txt | while read f do echo " --- $f ---" cat "$f" | while read line do if (echo "$line" | grep -q "^# name ") ; then true elif (echo "$line" | grep -q "^zimbraSignatureId: ") ; then true elif (echo "$line" | grep -q "^$") ; then true elif (echo "$line" | grep -q "^zimbraPrefMailSignatureHTML:") then echo "$line" | sed 's/zimbraPrefMailSignatureHTML://' > tmp.sig elif (echo "$line" | grep -q "^zimbraSignatureName: ") then sed -i '/^$/d' tmp.sig mv tmp.sig "$(echo $line | sed 's/zimbraSignatureName: //' )_$f.txt" echo tmp.sig "$(echo $line | sed 's/zimbraSignatureName: //' )_$f.txt" else echo "$line" >> tmp.sig fi done mv "$f" "$f.done" done
1.4 Zimbra Backup
- show backup config
zmschedulebackup -q zmschedulebackup -s crontab -l | grep backup
- set backup config
zmschedulebackup -R --mail-report d 1m "0 0 * * *" --mail-report i "0 1 * * 0-5" -a all --mail-report f "0 1 * * 6" crontab -l | grep backup
1.5 Change Webmail Font for all Users
zmprov mc default zimbraPrefHtmlEditorDefaultFontFamily "Sans Serif"
1.6 Change Password Changing URL
zmprov md mydomain.ch zimbraChangePasswordURL https://password.mydomain.ch
2 Zimbra debugging
2.1 Check all users Trash folders for mails older than 40 days
USERS=`zmprov -l gaa | sort` for ACCOUNT in $USERS do echo "------- $ACCOUNT -------" zmmailbox -z -m $ACCOUNT s -l50 -t message "in:trash before:$(date -d '-40 day' +%m/%d/%y)" done
2.2 Zimbra debugging in web browser
http://zimbra.domain.com/zimbra/?dev=1
2.3 Zimbra debugging to logfile
zmprov aal <username> zimbra.soap debug #mailbox.log zmprov ral <username> # stop logging
2.4 comandline calendar queries
zmmailbox -z -m <username> gf Calendar zmmailbox -z -m <username> gaps -5day +5day /Calendar zmmailbox -z -m <username> search -t appointment in:Calendar
2.5 comandline adressbook queries
zmmailbox -z -m <username> gact -f '/Öffentliche Adressbücher/Verteilerlisten'
2.6 list all accounts
zmprov -m -l gaa
2.7 zimbra user query in mysql db
su - zimbra mysql use zimbra select * from mailbox where account_id = "<USER-UUID>"\G
2.8 restore mailbox with prefix in username
zmrestore -a user@domain.com -ca -pre temp_
2.9 find username from USER-UUID
zmprov getAccount <USER-UUID> mail
2.10 get zimbraID of account
zmprov ga <username> zimbraId