Last active
October 28, 2015 23:19
-
-
Save xcsrz/b59f1d0c1c9675f3aa89 to your computer and use it in GitHub Desktop.
This script creates the .key and .csr files using the bare minimum information. It's only argument is the domain name to be secured. Prepend "*." for wildcard domain certificates. Customize the DEFAULT_ORGNAME and DEFAULT_ORGCOUNTRY setting variables at the top before use. Environment variable overrides are ORGNAME and ORGCOUNTRY.
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 characters
#!/bin/bash | |
DEFAULT_ORGNAME="xcsrz" | |
DEFAULT_ORGCOUNTRY="US" | |
if [ -t $1 ]; then | |
echo "you must provide a domain name (don't forget the asterisk if it's for a wildcard certificate" | |
echo "" | |
echo "Usage:" | |
echo " ${0} DOMAIN" | |
echo "" | |
exit 1 | |
fi | |
: ${ORGNAME:=$DEFAULT_ORGNAME} | |
: ${ORGCOUNTRY:=$DEFAULT_ORGCOUNTRY} | |
filename=${1/\*/wildcard} | |
openssl req -nodes -newkey rsa:4096 -sha256 -keyout ${filename}.key -out ${filename}.csr -subj "/C=${ORGCOUNTRY}/O=${ORGNAME}/CN=${1}" | |
# openssl genrsa -out "${filename}.key" 4096 | |
# openssl req -nodes -out "${filename}.csr" -key "${filename}.key" -new -sha256 | |
echo "######################################################" | |
echo "#### Certificate Request Info (for verification): ####" | |
echo "#### ####" | |
echo "" | |
openssl req -in "${filename}.csr" -noout -text | |
echo "######################################################" | |
echo "" | |
echo "Make sure the above looks right before submitting to a Certificate Authority." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment