Cybersecurity
DevOps Cloud (ADM)
IT Operations Cloud
You need to bulk change the passwords for all members of a specific group in GroupWise.
Use the following script to change the GroupWise password for all members of a specific group in a GroupWise system. The following script changes the GroupWise password, not the LDAP password of the affected user accounts.
#/bin/bash
echo " "
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: " GWADMIN
echo " "
read -p "Enter GroupWise Administrator Password: " PWD
echo " "
read -p "Enter Group name: " GROUP
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/group_member.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/GROUP_MEMBER.csv?attrs=memberDomainName,memberPostOfficeName,memberName&filter=name eq '$GROUP'"
# --- 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 " "
echo "Please be patient"
echo "It may take a while for the change to propagate through your GroupWise system"
echo " "
echo " "
Note: This script is provided as-is. Use it at your own risk. It is recommended that you test it first.