Skip to content

Instantly share code, notes, and snippets.

@dillonhafer
Created May 7, 2018 19:51
Show Gist options
  • Save dillonhafer/3a63ed1e38292500ef354ed0c64f82f8 to your computer and use it in GitHub Desktop.
Save dillonhafer/3a63ed1e38292500ef354ed0c64f82f8 to your computer and use it in GitHub Desktop.
fqdn="test.dillonhafer.com"
# Ubuntu
# config_file="/usr/lib/ssl/openssl.cnf"
# macOS
# config_file="/System/Library/OpenSSL/openssl.cnf"
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout $fqdn.key \
-new \
-out $fqdn.crt \
-subj /CN=$fqdn \
-reqexts SAN \
-extensions SAN \
-config <(cat $config_file \
<(printf '[SAN]\nsubjectAltName=DNS:%s' $fqdn)) \
-sha256 \
-days 3650
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment