Skip to content

Instantly share code, notes, and snippets.

@BigAB
Created October 31, 2017 17:06
Show Gist options
  • Save BigAB/2b35ecd3021277dc293cfc4ddc7da5a1 to your computer and use it in GitHub Desktop.
Save BigAB/2b35ecd3021277dc293cfc4ddc7da5a1 to your computer and use it in GitHub Desktop.
A set of really simple commands to enable https over localhost for Mac

From paulbrowne.xyz

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