#!/bin/ksh
#CertsExtractScript.sh
VAH=`whoami`
#echo -n "Please enter VAH name:"
#read VAH
echo -n "Please enter storetype jks / pkcs12 :"
read stp
echo "============================================================================"
echo "Default Password should be \"changeme\""
echo "============================================================================"
echo -n "Please enter jks/pkcs12 password:"
stty -echo
read pass
stty echo
jkspath=/$VAH/profile/etc/appserver_trust.jks
echo -n "Absolute path of jks/pkcs12 is : $jkspath"
if [[ ! -e /$VAH/certs ]];
then
mkdir -m 777 /$VAH/certs
fi
echo -n "\nPlease wait signers are extracting from the jks"
/$VAH/was/java/bin/keytool -list -keystore $jkspath -storetype $stp -storepass $pass| awk -F"," '{print $1}' | grep -v "Certificate" | sed '/Keystore/d' | sed '/Your/d' | sed 's/,//g' | sed '/^$/d' > /$VAH/idiot
cat /dev/null > /$VAH/certs/CertsJython.txt
cat /$VAH/idiot | while read LINE
do
echo "AdminTask.extractSignerCertificate('[-keyStoreName NodeDefaultTrustStore -keyStoreScope (cell):node01:(node):node01 -certificateFilePath \"/$VAH/certs/$LINE.cer\" -base64Encoded true -certificateAlias \"$LINE\" ]')" | sed '/^$/d' >> /$VAH/certs/CertsJython.txt
done
/$VAH/profile/bin/wsadmin.sh -lang jython -host $VAH -f /$VAH/certs/CertsJython.txt
sleep 1
chmod 777 /$VAH/certs/*
rm -rf idiot
exit
#CertsExtractScript.sh
VAH=`whoami`
#echo -n "Please enter VAH name:"
#read VAH
echo -n "Please enter storetype jks / pkcs12 :"
read stp
echo "============================================================================"
echo "Default Password should be \"changeme\""
echo "============================================================================"
echo -n "Please enter jks/pkcs12 password:"
stty -echo
read pass
stty echo
jkspath=/$VAH/profile/etc/appserver_trust.jks
echo -n "Absolute path of jks/pkcs12 is : $jkspath"
if [[ ! -e /$VAH/certs ]];
then
mkdir -m 777 /$VAH/certs
fi
echo -n "\nPlease wait signers are extracting from the jks"
/$VAH/was/java/bin/keytool -list -keystore $jkspath -storetype $stp -storepass $pass| awk -F"," '{print $1}' | grep -v "Certificate" | sed '/Keystore/d' | sed '/Your/d' | sed 's/,//g' | sed '/^$/d' > /$VAH/idiot
cat /dev/null > /$VAH/certs/CertsJython.txt
cat /$VAH/idiot | while read LINE
do
echo "AdminTask.extractSignerCertificate('[-keyStoreName NodeDefaultTrustStore -keyStoreScope (cell):node01:(node):node01 -certificateFilePath \"/$VAH/certs/$LINE.cer\" -base64Encoded true -certificateAlias \"$LINE\" ]')" | sed '/^$/d' >> /$VAH/certs/CertsJython.txt
done
/$VAH/profile/bin/wsadmin.sh -lang jython -host $VAH -f /$VAH/certs/CertsJython.txt
sleep 1
chmod 777 /$VAH/certs/*
rm -rf idiot
exit
No comments:
Post a Comment