Skip to content

Instantly share code, notes, and snippets.

@cxhercules
Created September 20, 2017 06:47
Show Gist options
  • Save cxhercules/26d79895e18dbc8ad699dc60b751012d to your computer and use it in GitHub Desktop.
Save cxhercules/26d79895e18dbc8ad699dc60b751012d to your computer and use it in GitHub Desktop.
Create a Wildcard SubjectAltName Self-Signed Certificate
#!/usr/bin/env bash
# See: http://apetec.com/support/GenerateSAN-CSR.htm
# See: http://fbcs.co.uk/self-signed-multiple-domain-ssl-certificates/
# See: https://gist.github.com/scottvrosenthal/5691305
# Make a temp directory and go there
TMP_DIR=$(mktemp -d)
cd $TMP_DIR
echo $(pwd)
# Create an OpenSSL configuration file
cp /etc/ssl/openssl.cnf openssl.cnf
# EDIT The file
# See: http://fbcs.co.uk/self-signed-multiple-domain-ssl-certificates/
# Generate the private key
openssl genrsa 4096 > private.key
# Generate the certificate
openssl req -new -x509 -nodes -sha256 -days 3650 -key private.key -out wild-san.crt -config openssl.cnf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment