Bladeren bron

If pem certs are not available

Bob Mottram 8 jaren geleden
bovenliggende
commit
c0009d1be9
1 gewijzigde bestanden met toevoegingen van 20 en 8 verwijderingen
  1. 20
    8
      src/freedombone-app-xmpp

+ 20
- 8
src/freedombone-app-xmpp Bestand weergeven

@@ -327,7 +327,11 @@ function xmpp_create_config {
327 327
     echo 'https_ports = { 5281 }' >> /etc/prosody/prosody.cfg.lua
328 328
     echo 'https_interfaces = { "*" }' >> /etc/prosody/prosody.cfg.lua
329 329
     echo 'https_ssl = {' >> /etc/prosody/prosody.cfg.lua
330
-    echo "    certificate = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.pem\";" >> /etc/prosody/prosody.cfg.lua
330
+    if [ -f /etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.pem ]; then
331
+        echo "    certificate = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.pem\";" >> /etc/prosody/prosody.cfg.lua
332
+    else
333
+        echo "    certificate = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.crt\";" >> /etc/prosody/prosody.cfg.lua
334
+    fi
331 335
     echo "    key = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.key\";" >> /etc/prosody/prosody.cfg.lua
332 336
     echo "    curve = $XMPP_ECC_CURVE;" >> /etc/prosody/prosody.cfg.lua
333 337
     echo "    ciphers = $XMPP_CIPHERS;" >> /etc/prosody/prosody.cfg.lua
@@ -337,7 +341,11 @@ function xmpp_create_config {
337 341
     echo '' >> /etc/prosody/prosody.cfg.lua
338 342
     echo 'ssl = {' >> /etc/prosody/prosody.cfg.lua
339 343
     echo "    key = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.key\";" >> /etc/prosody/prosody.cfg.lua
340
-    echo "    certificate = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.pem\";" >> /etc/prosody/prosody.cfg.lua
344
+    if [ -f /etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.pem ]; then
345
+        echo "    certificate = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.pem\";" >> /etc/prosody/prosody.cfg.lua
346
+    else
347
+        echo "    certificate = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.crt\";" >> /etc/prosody/prosody.cfg.lua
348
+    fi
341 349
     echo "    curve = $XMPP_ECC_CURVE;" >> /etc/prosody/prosody.cfg.lua
342 350
     echo '    depth = "1";' >> /etc/prosody/prosody.cfg.lua
343 351
     echo "    ciphers = $XMPP_CIPHERS;" >> /etc/prosody/prosody.cfg.lua
@@ -361,12 +369,16 @@ function xmpp_create_config {
361 369
     echo "VirtualHost \"${DEFAULT_DOMAIN_NAME}\"" >> /etc/prosody/prosody.cfg.lua
362 370
     echo '    ssl = {' >> /etc/prosody/prosody.cfg.lua
363 371
     echo "        key = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.key\";" >> /etc/prosody/prosody.cfg.lua
364
-    echo "        certificate = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.pem\";" >> /etc/prosody/prosody.cfg.lua
365
-    echo "    curve = $XMPP_ECC_CURVE;" >> /etc/prosody/prosody.cfg.lua
366
-    echo '    depth = "1";' >> /etc/prosody/prosody.cfg.lua
367
-    echo "    ciphers = $XMPP_CIPHERS;" >> /etc/prosody/prosody.cfg.lua
368
-    echo '    options = {"no_sslv2", "no_sslv3" };' >> /etc/prosody/prosody.cfg.lua
369
-    echo "    dhparam = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.dhparam\";" >> /etc/prosody/prosody.cfg.lua
372
+    if [ -f /etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.pem ]; then
373
+        echo "        certificate = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.pem\";" >> /etc/prosody/prosody.cfg.lua
374
+    else
375
+        echo "        certificate = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.crt\";" >> /etc/prosody/prosody.cfg.lua
376
+    fi
377
+    echo "        curve = $XMPP_ECC_CURVE;" >> /etc/prosody/prosody.cfg.lua
378
+    echo '        depth = "1";' >> /etc/prosody/prosody.cfg.lua
379
+    echo "        ciphers = $XMPP_CIPHERS;" >> /etc/prosody/prosody.cfg.lua
380
+    echo '        options = {"no_sslv2", "no_sslv3" };' >> /etc/prosody/prosody.cfg.lua
381
+    echo "        dhparam = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.dhparam\";" >> /etc/prosody/prosody.cfg.lua
370 382
     echo '    }' >> /etc/prosody/prosody.cfg.lua
371 383
     echo '' >> /etc/prosody/prosody.cfg.lua
372 384
     echo 'Include "conf.d/*.cfg.lua"' >> /etc/prosody/prosody.cfg.lua