Instantly share code, notes, and snippets.

Embed
What would you like to do?
Easily whitelisting SSL certificates in Chrome under OS X
#!/usr/bin/env bash -e
HOST=$(echo "$1" | sed -E -e 's/https?:\/\///' -e 's/\/.*//')
if [[ "$HOST" =~ .*\..* ]]; then
echo "Adding certificate for $HOST"
echo -n | openssl s_client -connect $HOST:443 -servername $HOST \
| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
| tee "/tmp/$HOST.cert"
sudo security add-trusted-cert -d -r trustRoot \
-k "/Library/Keychains/System.keychain" "/tmp/$HOST.cert"
rm -v "/tmp/$HOST.cert"
else
echo "Usage: $0 www.site.name"
echo "http:// and such will be stripped automatically"
fi
@WoLpH

This comment has been minimized.

Owner

WoLpH commented May 2, 2015

This version includes SNI support :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment