Skip to content

Instantly share code, notes, and snippets.

@tobystokes
Last active May 25, 2017 09:56
Show Gist options
  • Save tobystokes/22824647af13d2808e65d0fd3997d9b7 to your computer and use it in GitHub Desktop.
Save tobystokes/22824647af13d2808e65d0fd3997d9b7 to your computer and use it in GitHub Desktop.
Generate self signed cert for local development, without Chrome SAN warnings
# replace [local.dev] with your domain
# You will still get ERR_CERT_COMMON_NAME_INVALID - but that can be solved by using the standard add to keychain and trust method
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout server.key \
-new \
-out server.crt \
-subj /CN=[local.dev] \
-reqexts SAN \
-extensions SAN \
-config <(cat /System/Library/OpenSSL/openssl.cnf \
<(printf '[SAN]\nsubjectAltName=DNS:[local.dev]')) \
-sha256 \
-days 3650
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment