Last active
August 25, 2020 19:21
-
-
Save wolph/f959c2beccdd0fae925c to your computer and use it in GitHub Desktop.
Easily whitelisting SSL certificates in Chrome under OS X
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
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This version includes SNI support :)