Skip to content

Instantly share code, notes, and snippets.

@didip
Last active December 10, 2015 20:38
Show Gist options
  • Save didip/4489837 to your computer and use it in GitHub Desktop.
Save didip/4489837 to your computer and use it in GitHub Desktop.
Script to download and add self-signed SSL cert exception to OS X keychain. Usage: ./add-self-signed-cert.sh www.example.com
#!/bin/sh
DOMAIN=$1;
echo -n | openssl s_client -connect $DOMAIN:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/$DOMAIN.cert && open /tmp/$DOMAIN.cert
# Notes:
# 1. After you ran this script, simple refresh your stubborn browser. i.e. Chrome.
# 2. When you are done, don't forget to delete /tmp/$DOMAIN.cert file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment