Skip to content

Instantly share code, notes, and snippets.

@robsonke
Created September 4, 2014 09:10
Show Gist options
  • Save robsonke/17ddeb8b6ec2a66aee17 to your computer and use it in GitHub Desktop.
Save robsonke/17ddeb8b6ec2a66aee17 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
#
# Usage: ./scriptName.sh www.google.com
#
ADDRESS=$1
echo Fetching ssl certificate for $ADDRESS
echo -n | openssl s_client -connect $ADDRESS:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > tmp/$ADDRESS.cert
# to be added
JVM_PATH=/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/security
sudo keytool -importcert -alias "$ADDRESS" -file tmp/$ADDRESS.cert -keystore $JVM_PATH/cacerts -storepass changeit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment