-
-
Save jmcabandara/140b70e203485d0f6eab390e2d8cf95a to your computer and use it in GitHub Desktop.
Revisions
-
alfredodeza created this gist
Jul 14, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ #!/bin/bash # Easily generate a 10 year SSL certificate and key for development. It # creates a configuration file for wild card domains, if no argument is passed # in will fallback to "node.a" as the domain to use. # # Upon completion, these files should now exist:: # # * openssl.cnf # * ssl.key # * ssl.crt # # If those files exist they will be overwritten set -e if [ ! -z $1 ] then domain=$1 else domain="node.a" fi template="[req] distinguished_name = req_distinguished_name x509_extensions = v3_req prompt = no [req_distinguished_name] CN = *.${domain} [v3_req] keyUsage = keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth subjectAltName = @alt_names [alt_names] DNS.1 = *.${domain}" echo "-> generating openssl.cnf configuration file" echo "$template" > openssl.cnf command="openssl req -new -newkey rsa:2048 -sha1 -days 3650 -nodes -x509 -keyout ssl.key -out ssl.crt -config openssl.cnf" echo "-> running: $command" openssl req -new -newkey rsa:2048 -sha1 -days 3650 -nodes -x509 -keyout ssl.key -out ssl.crt -config openssl.cnf echo "-> completed self signed certs"