When using password policy on Zimbra like minimum password age and maximum password age, user will not get notification when their password expire. I want users get notification when their password come near to expired. I am looking for that feature and finally get the script who can do that. The script can be found from Wuxmedia github at this link : https://github.com/wuxmedia/Zimbra_passpoll/blob/master/passpoll.sh
I am using these script with some modification for adjust with my Zimbra environment
# Download script
cd /srv/ wget -c https://raw.githubusercontent.com/imanudin11/script/master/cek-expire-password-zimbra.sh chmod +x cek-expire-password-zimbra.sh bash cek-expire-password-zimbra.sh
Note : The script have policy 90 days password expired. Please change and adjust with your environment.
The following is example when users get password policy and come near to expired password
Good luck and hopefully useful 😉
Thanks you for sharing,
I’ve a doubt, how can I exec that script? (Correct way to do that).
Would be like this “./cek-expire-password-zimbra.sh &” to keep in background running, because when I run using sudo script run ok, but my terminal session get stuck and whether I use crtl+c to get out terminal session script also will be closed.
Thanks a lot!
You can use screen before execute the script
If your terminal get stuck, you can re-ssh and view background process by type screen -x
Thanks you for answering!
I’ve tried to do that unsuccessful, when I try to run this script, take too much longer, and I don’t know way the zimbra’s sevices begin to restart like a loop, just normalize when stop it, I’ve been testing with zimbra 8.7.0.
It is supposed to be ran as a cron job, early in the morning, when the server is not under ‘office hours’ load.
This script will give us the details for only internal ladap ?
How to get external ldap authuntication users password expiry using the script
If you have any attribute refer into password, you can refer into that attribute
hello iman thanks for sharing the scripts.i ran the scripts but it shows:
0 Started on: Tue Feb 13 12:59:57 +06 2018
Account: firstname.lastname@example.org reports; 4 days on Password policy
Account: email@example.com reports; 4 days on Password policy
Account: firstname.lastname@example.org reports; 4 days on Password policy
Account: email@example.com reports; 4 days on Password policy
Account: firstname.lastname@example.org reports; 4 days on Password policy
Account: email@example.com reports; 4 days on Password policy
Account: firstname.lastname@example.org reports; 4 days on Password policy
but no email sending towards the user.am i missing something
If you open the script, notifications will be sent before 7, 3 and 1 days from expiry.
we cant run the script. it gives errors;
[zimbra@mail ~]$chmod +x passwordexpire.sh
[zimbra@mail ~]$ bash passwordexpire.sh
passwordexpire.sh: line 5: $’\r’: command not found
0 Started on: Sat Feb 2 11:48:34 +03 2019
passwordexpire.sh: line 19: $’\r’: command not found
passwordexpire.sh: line 24: syntax error near unexpected token `$’do\r”
‘asswordexpire.sh: line 24: ` do
We have multiple domains, How can I change the line below to show the correct domain for the user who’s password expired?
You are being notified that your email password will expire in $DEADLINE days. Please change you email password via Webmail:
– Akses : https://mail.imanudin.com
You can create some script for every single domain
My server is currently checking passwords from many places,
How do I prevent the problem of checking a password?
I do not understand what do you say. Can you give me an example of password checking from many places that you mean?
ldap_sasl_bind(SIMPLE): Can’t contact LDAP server(-1)
I tried the above patch but i still has problem in the command that send the mail through the zimbra LMTP to the account that its password expired, the main issue is the folder path of the postifx/sendmail and the command, i tested outside the script and inside it same error
echo “Subject:TestSendMail”;echo “Hi” | $SENDMAIL -f email@example.com
-bash: -f: command not found
also ./script.bash: line 69: -f: command not found
Is the actual path is /opt/zimbra/common/sbin/ ?!!!
Anyone can help me in that
In the script, Sendmail will automatically found by this command:
If you want test, you can point Sendmail at /opt/zimbra/common/sbin/sendmail (8.7 and later) or /opt/zimbra/postfix/sbin/sendmail (8.6 and below)
Thanks for your above reply , i have zimbra version 8.8.15 and create the script in one of zimbra LDAP servers, then choose the below command in the script, but still gave me the below error:
SENDMAIL=$(ionice -c3 find /opt/zimbra/common/sbin -type f -iname sendmail)
line 108: -f: command not found
script line 108
108 echo “Subject: List of accounts with expired passwords” “$EXP_BODY” | $SENDMAIL -f “$FROM” “$ADMIN_RECIPIENT”
What is wrong that i did?
Hello Hend Khaled,
Do you use a multiserver? if yes, please put the script on MTA server
Hello thanks for this script is very usefully, I have a little question, Firstly i send mail no problem but i want to change sending mail to enconding to unicode and change FROM Name section and secondly if possible i want send html mail
Thx for reply
You can change sendmail to another program. You can try Swaks: http://www.jetmore.org/john/code/swaks/. I use swaks too
everything works well except the admin account doesn’t receive expired account information. any suggestion.