Skip to content

Instantly share code, notes, and snippets.

@iversond
Last active May 3, 2024 15:20
Show Gist options
  • Save iversond/8278ec436955f62c236be127f4ef4ee8 to your computer and use it in GitHub Desktop.
Save iversond/8278ec436955f62c236be127f4ef4ee8 to your computer and use it in GitHub Desktop.
Script to prepare a pt_osk.config file and encrypt passwords
start_loc=$(pwd)
echo "Copy OSK zip file to /tmp"
cp OSK*.zip /tmp/
cd /tmp && unzip -o OSK*.zip > /dev/null 2>&1
echo "Extract JDK and OS archives to encrypt password"
cd archives
if [[ -f jdk/README.* ]]; then
mkdir -p jdk && tar xf --overwrite $(ls pt-jdk*) -C jdk > /dev/null 2>&1
else
mkdir -p jdk && tar xf $(ls pt-jdk*) -C jdk > /dev/null 2>&1
fi
if [[ -f os/README.* ]]; then
mkdir -p os && tar xf --overwrite pt-opensearch-2.3.0.tgz -C os > /dev/null 2>&1
else
mkdir -p os && tar xf pt-opensearch-2.3.0.tgz -C os > /dev/null 2>&1
fi
cp os/plugins/orcl-security-plugin/config/properties/psvault os/plugins/orcl-security-plugin/
echo "Encrypt passwords"
jdk/bin/java -Dpscipher.path=os/plugins/orcl-security-plugin \
-cp os/plugins/orcl-security-plugin/pscipher.jar \
com.peoplesoft.pt.opensearch.pscipher.PSESEncrypt \
osadmin \
Passw0rd# \
people \
peop1e \
pwds.txt
osadmin_encr=$(grep osadmin pwds.txt | cut -d':' -f2)
people_encr=$(grep people pwds.txt | cut -d':' -f2)
echo "Updating pt_osk.config with encrypted values"
cd $start_loc
cp pt_osk.config pt_osk.config.orig
sed -i "s|admin.password=|admin.password=${osadmin_encr}|g" "pt_osk.config"
sed -i "s|people.password=|people.password=${people_encr}|g" "pt_osk.config"
sed -i "s|OS_pwd = |OS_pwd = ${osadmin_encr}|g" "pt_osk.config"
sed -i "s|<mt-container-name>:8000/PSIGW/RESTListeningConnector/<NODE NAME>|mt.oraclevcn.com:8000/PSIGW/RESTListeningConnector/PSFT_EP|g" "pt_osk.config"
echo "Verify pt_osk.config Changes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment