Skip to content

Instantly share code, notes, and snippets.

@stevelacey
Created October 4, 2016 05:53
Show Gist options
  • Save stevelacey/16cb4bd7479109a7be05ecd767209e5d to your computer and use it in GitHub Desktop.
Save stevelacey/16cb4bd7479109a7be05ecd767209e5d to your computer and use it in GitHub Desktop.
cat > openssl.cnf <<-EOF
[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
CN = *.${PWD##*/}.dev
[v3_req]
keyUsage = keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1 = *.${PWD##*/}.dev
DNS.2 = ${PWD##*/}.dev
EOF
openssl req \
-new \
-newkey rsa:2048 \
-sha1 \
-days 3650 \
-nodes \
-x509 \
-keyout $(brew --prefix)/etc/nginx/ssl/${PWD##*/}.key \
-out $(brew --prefix)/etc/nginx/ssl/${PWD##*/}.crt \
-config openssl.cnf
rm openssl.cnf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment