Browse Source

Checking certificates for onion only versions

Bob Mottram 7 years ago
parent
commit
5db74ee7df
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      src/freedombone-utils-web

+ 10
- 1
src/freedombone-utils-web View File

190
     if [ "$2" ]; then
190
     if [ "$2" ]; then
191
         USE_LETSENCRYPT="$2"
191
         USE_LETSENCRYPT="$2"
192
     fi
192
     fi
193
-    if [[ $USE_LETSENCRYPT == 'no' ]]; then
193
+    if [[ $USE_LETSENCRYPT == 'no' || "$ONION_ONLY" != 'no' ]]; then
194
         if [ ! -f "/etc/ssl/private/${1}.key" ]; then
194
         if [ ! -f "/etc/ssl/private/${1}.key" ]; then
195
             echo $"Private certificate for ${CHECK_HOSTNAME} was not created"
195
             echo $"Private certificate for ${CHECK_HOSTNAME} was not created"
196
             exit 63959
196
             exit 63959
239
 }
239
 }
240
 
240
 
241
 function create_self_signed_cert {
241
 function create_self_signed_cert {
242
+    if [ ! "${SITE_DOMAIN_NAME}" ]; then
243
+        echo $'No site domain specified for self signed cert'
244
+        exit 4638565385
245
+    fi
242
     "${PROJECT_NAME}-addcert" -h "${SITE_DOMAIN_NAME}" --dhkey "${DH_KEYLENGTH}"
246
     "${PROJECT_NAME}-addcert" -h "${SITE_DOMAIN_NAME}" --dhkey "${DH_KEYLENGTH}"
243
     function_check check_certificates
247
     function_check check_certificates
244
     check_certificates "${SITE_DOMAIN_NAME}"
248
     check_certificates "${SITE_DOMAIN_NAME}"
245
 }
249
 }
246
 
250
 
247
 function create_letsencrypt_cert {
251
 function create_letsencrypt_cert {
252
+    if [ ! "${SITE_DOMAIN_NAME}" ]; then
253
+        echo $'No site domain specified for letsencrypt cert'
254
+        exit 246824624
255
+    fi
256
+
248
     if ! "${PROJECT_NAME}-addcert" -e "${SITE_DOMAIN_NAME}" -s "${LETSENCRYPT_SERVER}" --dhkey "${DH_KEYLENGTH}" --email "${MY_EMAIL_ADDRESS}"; then
257
     if ! "${PROJECT_NAME}-addcert" -e "${SITE_DOMAIN_NAME}" -s "${LETSENCRYPT_SERVER}" --dhkey "${DH_KEYLENGTH}" --email "${MY_EMAIL_ADDRESS}"; then
249
         if [[ ${NO_SELF_SIGNED} == 'no' ]]; then
258
         if [[ ${NO_SELF_SIGNED} == 'no' ]]; then
250
             echo $"Lets Encrypt failed for ${SITE_DOMAIN_NAME}, so try making a self-signed cert"
259
             echo $"Lets Encrypt failed for ${SITE_DOMAIN_NAME}, so try making a self-signed cert"