Sfoglia il codice sorgente

Checking certificates for onion only versions

Bob Mottram 7 anni fa
parent
commit
5db74ee7df
1 ha cambiato i file con 10 aggiunte e 1 eliminazioni
  1. 10
    1
      src/freedombone-utils-web

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

@@ -190,7 +190,7 @@ function check_certificates {
190 190
     if [ "$2" ]; then
191 191
         USE_LETSENCRYPT="$2"
192 192
     fi
193
-    if [[ $USE_LETSENCRYPT == 'no' ]]; then
193
+    if [[ $USE_LETSENCRYPT == 'no' || "$ONION_ONLY" != 'no' ]]; then
194 194
         if [ ! -f "/etc/ssl/private/${1}.key" ]; then
195 195
             echo $"Private certificate for ${CHECK_HOSTNAME} was not created"
196 196
             exit 63959
@@ -239,12 +239,21 @@ function cert_exists {
239 239
 }
240 240
 
241 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 246
     "${PROJECT_NAME}-addcert" -h "${SITE_DOMAIN_NAME}" --dhkey "${DH_KEYLENGTH}"
243 247
     function_check check_certificates
244 248
     check_certificates "${SITE_DOMAIN_NAME}"
245 249
 }
246 250
 
247 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 257
     if ! "${PROJECT_NAME}-addcert" -e "${SITE_DOMAIN_NAME}" -s "${LETSENCRYPT_SERVER}" --dhkey "${DH_KEYLENGTH}" --email "${MY_EMAIL_ADDRESS}"; then
249 258
         if [[ ${NO_SELF_SIGNED} == 'no' ]]; then
250 259
             echo $"Lets Encrypt failed for ${SITE_DOMAIN_NAME}, so try making a self-signed cert"