Cybersecurity
DevOps Cloud (ADM)
IT Operations Cloud
You need to bulk change the password for all users in an entire GroupWise Post Office
Use the following script to change the GroupWise password for all users in an entire Post Office in a GroupWise system. The following script changes the GroupWise password, not the LDAP password of the affected user accounts.
#/bin/bash
read -p "Enter GroupWise Admin Service IP/Hostname: " IP
echo " "
read -p "Enter Groupwise Admin Service Port: " PORT
echo " "
read -p "Enter GroupWise System Administrator user name: " GWADMIN
echo " "
read -p "Enter GroupWise Administrator Password: " PWD
echo " "
read -p "Enter Post Office name: " PO
echo " "
read -p "Enter New Password: " NEWPWD
echo " "#-- build base url for admin service
BASEURL="https://$IP:$PORT/gwadmin-service"
# --- create json data for the new password
DATA="{\"userPassword\":{\"value\":\"$NEWPWD\"}}"
# --- build url to search for the user. the /list/user.csv will return the user data in csv format.
# --- attrs= returns only the users domain,po and gwid, so we can build the url to change the pwdSEARCHURL="$BASEURL/list/USER.csv?postoffice=$PO&attrs=domain,postoffice,name"
# --- use curl to search the admin service for the user,and gawk to build the proper user url
URLS=`curl -k --user $GWADMIN:$PWD $SEARCHURL |gawk --field-separator=, 'NR!=1 {print"'$BASEURL'/domains/"$1"/postoffices/"$2"/users/"$3"/clientoptions"}'`
# --- now use curl to change the pwd. note content-type cause we are using a json doc
#echo 'curl -k --user '$GWADMIN':'$ADMINPWD' -H "Content-Type:application/json" -X PUT '$url' --data '$DATA'' >> url.txt # for debuging only
curl -k --user $GWADMIN:$PWD -H "Content-Type:application/json" -X PUT $URLS --data $DATA
echo " "
echo "Passwords have been changed"
echo "Please be patient... "
echo "It may take a while for the change to propagate through your GroupWise systems"
echo " "
echo " "
Note: This script is provided as-is. Use it at your own risk. It is recommended that you test it first.