Last active
February 22, 2019 14:19
-
-
Save kenshin579/3654dd6eb78bda539efaf5db7eb03b91 to your computer and use it in GitHub Desktop.
Import ssh certificate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOSTS=( | |
app.zencoder.com | |
api.bcovlive.io | |
) | |
WORK_DIR=$HOME/Desktop | |
JAVA_HOME=$JAVA_HOME | |
echo "JAVA_HOME: $JAVA_HOME" | |
for HOST in "${HOSTS[@]}" | |
do | |
echo "importing $HOST" | |
echo "delete imported certificate...." | |
sudo keytool -delete -alias $WORK_DIR/$HOST -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit | |
echo "import new downloaded certificates..." | |
openssl s_client -servername $HOST -connect $HOST:443 </dev/null 2>/dev/null | openssl x509 -text -out $WORK_DIR/$HOST.crt | |
echo | |
printf "%s\n" yes | sudo keytool -importcert -file $WORK_DIR/$HOST.crt -alias $WORK_DIR/$HOST -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment