Skip to content

Instantly share code, notes, and snippets.

@tcelestino
Last active November 2, 2017 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcelestino/2ac063c1cec96f22502c6186f70c322b to your computer and use it in GitHub Desktop.
Save tcelestino/2ac063c1cec96f22502c6186f70c322b to your computer and use it in GitHub Desktop.
3 steps to create a ssl certificate on macOS from localhost
cd; mkdir .ssl
openssl req -newkey rsa:2048 -x509 -nodes -keyout .ssl/localhost.key -new -out .ssl/localhost.crt -subj /CN=localhost -reqexts SAN -extensions SAN -config <(cat /System/Library/OpenSSL/openssl.cnf <(printf '[SAN]\nsubjectAltName=DNS:localhost')) -sha256 -days 3650
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain .ssl/localhost.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment