This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
internet:mail:zimbra:zimbra_password_policy [2019/06/07 09:42] gcooper |
internet:mail:zimbra:zimbra_password_policy [2022/03/30 08:55] (current) gcooper |
||
---|---|---|---|
Line 70: | Line 70: | ||
===== Expiring Passwords Notification ===== | ===== Expiring Passwords Notification ===== | ||
- | https:// | + | **Original**: |
< | < | ||
Line 81: | Line 81: | ||
</ | </ | ||
- | Modify at least: | + | Modify |
< | < | ||
FROM=" | FROM=" | ||
ADMIN_RECIPIENT=" | ADMIN_RECIPIENT=" | ||
+ | SENDMAIL=$(ionice -c3 find / | ||
</ | </ | ||
Line 98: | Line 99: | ||
< | < | ||
# Password Expiration Notifications | # Password Expiration Notifications | ||
- | 0 8 * * * / | + | 0 8 * * * / |
</ | </ | ||
+ | ==== Modified passpoll.sh ==== | ||
+ | |||
+ | This script has been **modified from the original** in several ways, including: | ||
+ | |||
+ | * **Number of user notifications** | ||
+ | * Four including final on last day | ||
+ | * **Content of user notifications** | ||
+ | * Instructions to change password | ||
+ | * Zimbra URL | ||
+ | * **Content of admin notifications** | ||
+ | * Include log | ||
+ | * **Daily expired password notifications** | ||
+ | |||
+ | < | ||
+ | #!/bin/bash | ||
+ | # TDH 2015-04-27 | ||
+ | # Messy script for zimbra password expiry email notification. | ||
+ | # Meant to be performed as daily cronjob run as zimbra user. | ||
+ | # redirect output to a file to get a 'log file' of sorts. | ||
+ | |||
+ | # Start in tmp folder to eliminate permissions warnings | ||
+ | cd /tmp | ||
+ | |||
+ | # Time taken of script; | ||
+ | echo " | ||
+ | |||
+ | # Set some vars: | ||
+ | # Notifications in days, then last warning. Don't use 1 as it's assumed. | ||
+ | FIRST=" | ||
+ | SECOND=" | ||
+ | LAST=" | ||
+ | # Sent from: | ||
+ | FROM=" | ||
+ | # Domain to check, e.g. ' | ||
+ | DOMAIN="" | ||
+ | # Recipient who should receive an email with all expired accounts | ||
+ | ADMIN_RECIPIENT=" | ||
+ | # URL for your Zimbra in message body | ||
+ | URL=" | ||
+ | |||
+ | # Sendmail executable | ||
+ | SENDMAIL=$(ionice -c3 find / | ||
+ | |||
+ | # Get all users - it should run once only. | ||
+ | USERS=$(ionice -c3 / | ||
+ | |||
+ | #Todays date, in seconds: | ||
+ | DATE=$(date +%s) | ||
+ | |||
+ | # Iterate through them in for loop: | ||
+ | for USER in $USERS | ||
+ | do | ||
+ | # When was the password set? | ||
+ | USERINFO=$(ionice -c3 / | ||
+ | PASS_SET_DATE=$(echo " | ||
+ | PASS_MAX_AGE=$(echo " | ||
+ | NAME=$(echo " | ||
+ | |||
+ | # Check if we have set the account to no-expire | ||
+ | if [[ " | ||
+ | then | ||
+ | continue | ||
+ | fi | ||
+ | |||
+ | # Make the date for expiry from now. | ||
+ | EXPIRES=$(date -d " | ||
+ | |||
+ | # Now, how many days until that? | ||
+ | DEADLINE=$(( (($DATE - $EXPIRES)) / -86400 )) | ||
+ | |||
+ | # Email to send to victims, ahem - users... | ||
+ | SUBJECT=" | ||
+ | BODY=" | ||
+ | Hi $NAME, | ||
+ | |||
+ | Your Zimbra e-mail account password will expire in $DEADLINE days, Please reset your password soon. | ||
+ | |||
+ | You can change your password in the Zimbra Web Client by clicking Preferences -> Change Password. | ||
+ | |||
+ | If you are seeing this message in any other mail client, click here to open the ZWC: | ||
+ | |||
+ | $URL | ||
+ | |||
+ | Thanks, | ||
+ | Your Zimbra Admin Team | ||
+ | |||
+ | " | ||
+ | # Send it off depending on days, adding verbose statements for the ' | ||
+ | # First warning | ||
+ | if [[ " | ||
+ | then | ||
+ | echo " | ||
+ | echo " | ||
+ | # Second | ||
+ | elif [[ " | ||
+ | then | ||
+ | echo " | ||
+ | echo " | ||
+ | # Third | ||
+ | elif [[ " | ||
+ | then | ||
+ | echo " | ||
+ | echo " | ||
+ | # Final | ||
+ | elif [[ " | ||
+ | then | ||
+ | echo " | ||
+ | echo "Last chance for: $USER - $DEADLINE days left" | ||
+ | |||
+ | # Check for Expired accounts, get last logon date add them to EXP_LIST2 | ||
+ | #elif [[ " | ||
+ | elif [[ " | ||
+ | then | ||
+ | LASTDATE=$(echo " | ||
+ | LOGON=$(date -d " | ||
+ | EXP_LIST=$(echo " | ||
+ | EXP_LIST2=" | ||
+ | |||
+ | else | ||
+ | # > /dev/null for less verbose logs and a list of users. | ||
+ | echo " | ||
+ | fi | ||
+ | |||
+ | # Finish for loop | ||
+ | done | ||
+ | |||
+ | echo "" | ||
+ | echo " | ||
+ | |||
+ | # Send off list using hardcoded email addresses. | ||
+ | |||
+ | EXP_BODY=" | ||
+ | Hello Admin team, | ||
+ | |||
+ | List of expired passwords and their last recorded login date: | ||
+ | |||
+ | $(echo -e " | ||
+ | |||
+ | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
+ | |||
+ | Log file: | ||
+ | |||
+ | $(cat / | ||
+ | |||
+ | " | ||
+ | echo " | ||
+ | # Expired accts, for the log: | ||
+ | echo -e " | ||
+ | |||
+ | echo " | ||
+ | echo " | ||
+ | </ |