DevOps Cloud (ADM)
Cybersecurity
IT Operations Management
#!/bin/bash
#declare pw,pwver variable,username,password
#define user variables
username="ZCMADMINACCOUNT"
password="ZCMADMINPASSWORD"
#Create 10 character alphanumeric password
pw="$(cat /dev/urandom| tr -dc 'a-zA-Z0-9' | fold -w 10| head -n 1)"
#Replace the password in the exported bundle action
sed 's/user tempadmin.*changepw2.xml
#Remove bundle action containing old password
zman bra /bundles/security/password Launch 1 -U=$username -P=$password > /dev/null
#Add bundle action with new password to bundle
zman baa /bundles/security/password /bin/randompw/changepw2.xml -U=$username -P=$password > /dev/null
#Increment version of bundle and store new version number in variable for admin bundle
pwver="$(zman biv /bundles/security/password -U=$username -P=$password | cut -d "\"" -f6)"
zman biv "/bundles/Security/Restrict Local Admin" -U=$username -p=$password > /dev/null
#Append new version number and password to pw.txt file
echo $pwver" - "$pw >> pw.txt
#Remove old file install action from showtempadmin bundle
zman bra /bundles/security/showtempadmin Launch 1 -U=$username -P=$password > /dev/null
#Add file install action and import new pw.txt file to content-repo
zman baa /bundles/security/showtempadmin /bin/randompw/showtempadminaction.xml -a=showtempadminaction_ActionContentInfo.xml -U=$username -P=$password > /dev/null
#Reorder actions in bundle so file install is at position 1 and wordpad launch is at 2
zman broa /bundles/security/showtempadmin Launch 2 1 -U=$username -P=$password > /dev/=null
#Increment version so that new pw.txt is installed on next launch
zman biv /bundles/security/showtempadmin -U=$username -P=$password > /dev/null