Skip to content

Instantly share code, notes, and snippets.

@danielhauck
Created July 10, 2015 08:10
Show Gist options
  • Select an option

  • Save danielhauck/5bf8dbcd29ffeb37a4bc to your computer and use it in GitHub Desktop.

Select an option

Save danielhauck/5bf8dbcd29ffeb37a4bc to your computer and use it in GitHub Desktop.

Revisions

  1. Daniel Hauck created this gist Jul 10, 2015.
    19 changes: 19 additions & 0 deletions crs_with_alt_names
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # gen key
    if ! [ -a ./${DOMAIN}.key ]; then
    PASSPHRASE=$(apg -m 255)
    echo ${PASSPHRASE} | openssl genrsa -des3 -out ${DOMAIN}.key -passout stdin 4096
    echo ${PASSPHRASE} | openssl rsa -in ${DOMAIN}.key -out ${DOMAIN}.key -passin stdin
    fi

    openssl req -new -key ${DOMAIN}.key -sha256 -nodes \
    -subj "/C=${COUNTRY}/ST=${STATE}/L=${CITY}/O=${ORGANIZATION}/OU=${OU}/CN=${DOMAIN_NAME}/emailAddress=${ADMIN_MAIL}/subjectAltName=DNS.1=m.${DOMAIN}" > ${DOMAIN}.csr

    if [ $? == 0 ]; then
    openssl req -in ${DOMAIN}.csr -text -noout | less
    echo "HELL YEAH, your csr is ready!"
    exit 0
    else
    echo "HELL NO, something went wrong!"
    exit 1
    fi