Forked from wolph/whitelist_ssl_certificates_chrome.sh
Created
July 17, 2016 07:25
-
-
Save baseboxorg/d1cc882f516f2480fa1ae765a4aaf20b to your computer and use it in GitHub Desktop.
Easily whitelisting SSL certificates in Chrome under OS X
This file contains hidden or 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