Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add a self signed certificate to Chrome / Chromium on Linux
# you need to install the libnss3-tools package or equivalent
if [ $# -lt 2 ]; then
echo "Usage: $0 hostname port"
exit 1
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