Last active
February 14, 2016 11:47
-
-
Save EmmanuelKasper/e5b522ad360deb00ae89 to your computer and use it in GitHub Desktop.
Add a self signed certificate to Chrome / Chromium on Linux
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
#!/bin/sh | |
# you need to install the libnss3-tools package or equivalent | |
if [ $# -lt 2 ]; then | |
echo "Usage: $0 hostname port" | |
exit 1 | |
fi | |
hostname=$1 | |
port=$2 | |
echo -n | openssl s_client -connect $hostname:$port| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/$hostname-$port.pem | |
# -A for adding, -t for setting the server as a "trusted peer" | |
certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n $hostname -i /tmp/$hostname-$port.pem | |
# list the current content of the nss db | |
certutil -d sql:$HOME/.pki/nssdb -L |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment