From 5db74ee7dfe4d62b9d3eaa1e08ade99f067dfb2a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 3 Mar 2018 22:26:29 +0000 Subject: [PATCH] Checking certificates for onion only versions --- src/freedombone-utils-web | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/freedombone-utils-web b/src/freedombone-utils-web index 9d2c73cd..290feca9 100755 --- a/src/freedombone-utils-web +++ b/src/freedombone-utils-web @@ -190,7 +190,7 @@ function check_certificates { if [ "$2" ]; then USE_LETSENCRYPT="$2" fi - if [[ $USE_LETSENCRYPT == 'no' ]]; then + if [[ $USE_LETSENCRYPT == 'no' || "$ONION_ONLY" != 'no' ]]; then if [ ! -f "/etc/ssl/private/${1}.key" ]; then echo $"Private certificate for ${CHECK_HOSTNAME} was not created" exit 63959 @@ -239,12 +239,21 @@ function cert_exists { } 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}" function_check check_certificates check_certificates "${SITE_DOMAIN_NAME}" } 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 [[ ${NO_SELF_SIGNED} == 'no' ]]; then echo $"Lets Encrypt failed for ${SITE_DOMAIN_NAME}, so try making a self-signed cert"