Skip to content

Instantly share code, notes, and snippets.

@felixhummel
Created April 11, 2013 11:58
Show Gist options
  • Save felixhummel/5362818 to your computer and use it in GitHub Desktop.
Save felixhummel/5362818 to your computer and use it in GitHub Desktop.
startssl class1 helper
#!/bin/bash
[[ -z $2 ]] && echo "Usage: $0 POSTMASTER_EMAIL FULL_DOMAIN_NAME" && exit 1
postmaster_email=$1
full_domain_name=$2
req_file=${full_domain_name}/req
key_file=${full_domain_name}/key
crt_file=${full_domain_name}/crt
chain=${full_domain_name}/chain
[[ -f $key_file ]] && echo "Keyfile exists: ${key_file}" && exit 1
mkdir ${full_domain_name}
KEY_LENGTH=2048
openssl req \
-new -newkey rsa:${KEY_LENGTH} -nodes \
-subj "/CN=${full_domain_name}/C=DE/E=${postmaster_email}" \
-keyout ${key_file} -out ${req_file}
echo '--------------[ REQUEST CONTENTS ]--------------'
cat ${req_file}
echo '------------------------------------------------'
echo "Paste in ${crt_file}"
echo "Then run:"
echo "cat ${crt_file} sub.class1.server.ca.pem ca.pem > ${chain}"
echo "And copy to server:"
echo "scp -r ${full_domain_name} SERVER:CERTS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment