Skip to content

Instantly share code, notes, and snippets.

@daggerhart
Last active Sep 18, 2019
Embed
What would you like to do?
Simple script to generate a certificate used for local development on OSX
#!/bin/bash
read -p 'Domain: ' DOMAIN
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout "$DOMAIN".key \
-new \
-out $DOMAIN.crt \
-subj /CN="$DOMAIN" \
-reqexts SAN \
-extensions SAN \
-config <(cat /System/Library/OpenSSL/openssl.cnf \
<(printf "[SAN]\nsubjectAltName=DNS:$DOMAIN")) \
-sha256 \
-days 720
@daggerhart
Copy link
Author

daggerhart commented Feb 23, 2018

How to:

  1. ./_genCert.sh
  2. (type in your desired domain)
  3. Open finder and double click the new .crt file. It should open in Keychain.
  4. Double click the new certificate, expand "Trust", set to "Always Trust"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment