Last active
August 29, 2015 13:58
-
-
Save brenttheisen/10233686 to your computer and use it in GitHub Desktop.
Script to generate a host key and CSR file when keying a SSL certificate.
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 | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: `basename $0` domain" | |
exit 85 | |
fi | |
DOMAIN=$1 | |
HOST_KEY="$DOMAIN".key | |
CSR="$DOMAIN".csr | |
PRIVATE_KEY="$DOMAIN".private.key | |
set -o verbose | |
set -e | |
openssl genrsa -des3 -out "$HOST_KEY" 2048 | |
openssl req -new -key "$HOST_KEY" -out "$CSR" | |
openssl rsa -in "$HOST_KEY" -out "$PRIVATE_KEY" | |
echo | |
echo "Now copy and paste this CSR to your CA..." | |
echo | |
cat "$CSR" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment