Checking certificates for onion only versions

This commit is contained in:
Bob Mottram 2018-03-03 22:26:29 +00:00
parent 62e891c141
commit 5db74ee7df
1 changed files with 10 additions and 1 deletions

View File

@ -190,7 +190,7 @@ function check_certificates {
if [ "$2" ]; then if [ "$2" ]; then
USE_LETSENCRYPT="$2" USE_LETSENCRYPT="$2"
fi fi
if [[ $USE_LETSENCRYPT == 'no' ]]; then if [[ $USE_LETSENCRYPT == 'no' || "$ONION_ONLY" != 'no' ]]; then
if [ ! -f "/etc/ssl/private/${1}.key" ]; then if [ ! -f "/etc/ssl/private/${1}.key" ]; then
echo $"Private certificate for ${CHECK_HOSTNAME} was not created" echo $"Private certificate for ${CHECK_HOSTNAME} was not created"
exit 63959 exit 63959
@ -239,12 +239,21 @@ function cert_exists {
} }
function create_self_signed_cert { function create_self_signed_cert {
if [ ! "${SITE_DOMAIN_NAME}" ]; then
echo $'No site domain specified for self signed cert'
exit 4638565385
fi
"${PROJECT_NAME}-addcert" -h "${SITE_DOMAIN_NAME}" --dhkey "${DH_KEYLENGTH}" "${PROJECT_NAME}-addcert" -h "${SITE_DOMAIN_NAME}" --dhkey "${DH_KEYLENGTH}"
function_check check_certificates function_check check_certificates
check_certificates "${SITE_DOMAIN_NAME}" check_certificates "${SITE_DOMAIN_NAME}"
} }
function create_letsencrypt_cert { function create_letsencrypt_cert {
if [ ! "${SITE_DOMAIN_NAME}" ]; then
echo $'No site domain specified for letsencrypt cert'
exit 246824624
fi
if ! "${PROJECT_NAME}-addcert" -e "${SITE_DOMAIN_NAME}" -s "${LETSENCRYPT_SERVER}" --dhkey "${DH_KEYLENGTH}" --email "${MY_EMAIL_ADDRESS}"; then if ! "${PROJECT_NAME}-addcert" -e "${SITE_DOMAIN_NAME}" -s "${LETSENCRYPT_SERVER}" --dhkey "${DH_KEYLENGTH}" --email "${MY_EMAIL_ADDRESS}"; then
if [[ ${NO_SELF_SIGNED} == 'no' ]]; then if [[ ${NO_SELF_SIGNED} == 'no' ]]; then
echo $"Lets Encrypt failed for ${SITE_DOMAIN_NAME}, so try making a self-signed cert" echo $"Lets Encrypt failed for ${SITE_DOMAIN_NAME}, so try making a self-signed cert"