Skip to content

Instantly share code, notes, and snippets.

@RichAyotte
Created May 9, 2017 22:31
Show Gist options
  • Save RichAyotte/7cc6951042b5130813bd79fb00f8388e to your computer and use it in GitHub Desktop.
Save RichAyotte/7cc6951042b5130813bd79fb00f8388e to your computer and use it in GitHub Desktop.
Self signed cert on Linux for Chrome 58+
#!/bin/sh
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout server.pem \
-new \
-out server.pem \
-subj /CN=localhost \
-reqexts SAN \
-extensions SAN \
-config <(cat /etc/ssl/openssl.cnf \
<(printf '[SAN]\nsubjectAltName=DNS:localhost')) \
-sha256 \
-days 3650
# Once installed, follow the in https://superuser.com/questions/1201552/not-a-certification-authority-while-importing-self-signed-certificate
# echo QUIT | openssl s_client -connect $DOMAIN_TO_FETCH_FROM:443 | sed -ne '/BEGIN CERT/,/END CERT/p' > my-cert
# certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n my-cert -i my-cert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment