Skip to content

Instantly share code, notes, and snippets.

@alexsasharegan
Created May 4, 2017 18:21
Show Gist options
  • Select an option

  • Save alexsasharegan/8535747c92fea60f72234b0f82c857dc to your computer and use it in GitHub Desktop.

Select an option

Save alexsasharegan/8535747c92fea60f72234b0f82c857dc to your computer and use it in GitHub Desktop.
Self sign an ssl certificate for development on localhost with Chrome >= 58
#!/usr/bin/env bash
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout ~/.localhost-ssl/<cert-name>.key \
-new \
-out ~/.localhost-ssl/<cert-name>.crt \
-subj /CN=<server-name> \
-reqexts SAN \
-extensions SAN \
-config <(cat /System/Library/OpenSSL/openssl.cnf \
<(printf '[SAN]\nsubjectAltName=DNS:<server-name>')) \
-sha256 \
-days 3650
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment