|
@@ -376,6 +376,7 @@ function regenerate_dh_keys {
|
376
|
376
|
}
|
377
|
377
|
|
378
|
378
|
function renew_startssl {
|
|
379
|
+ renew_domain=
|
379
|
380
|
data=$(tempfile 2>/dev/null)
|
380
|
381
|
trap "rm -f $data" 0 1 2 5 15
|
381
|
382
|
dialog --title "Renew a StartSSL certificate" \
|
|
@@ -385,11 +386,74 @@ function renew_startssl {
|
385
|
386
|
case $sel in
|
386
|
387
|
0)
|
387
|
388
|
renew_domain=$(<$data)
|
388
|
|
- if [[ $renew_domain == *"."* ]]; then
|
389
|
|
- freedombone-renew-cert -h $renew_domain -p startssl
|
390
|
|
- fi
|
391
|
389
|
;;
|
392
|
390
|
esac
|
|
391
|
+
|
|
392
|
+ if [ ! $renew_domain ]; then
|
|
393
|
+ return
|
|
394
|
+ fi
|
|
395
|
+
|
|
396
|
+ if [[ $renew_domain == "http"* ]]; then
|
|
397
|
+ dialog --title "Renew a StartSSL certificate" \
|
|
398
|
+ --msgbox "Don't include the https://" 6 40
|
|
399
|
+ return
|
|
400
|
+ fi
|
|
401
|
+
|
|
402
|
+ if [ ! -f /etc/ssl/certs/${renew_domain}.dhparam ]; then
|
|
403
|
+ dialog --title "Renew a StartSSL certificate" \
|
|
404
|
+ --msgbox "An existing certificate for $renew_domain was not found" 6 40
|
|
405
|
+ return
|
|
406
|
+ fi
|
|
407
|
+
|
|
408
|
+ if [[ $renew_domain != *"."* ]]; then
|
|
409
|
+ dialog --title "Renew a StartSSL certificate" \
|
|
410
|
+ --msgbox "Invalid domain name: $renew_domain" 6 40
|
|
411
|
+ return
|
|
412
|
+ fi
|
|
413
|
+
|
|
414
|
+ freedombone-renew-cert -h $renew_domain -p startssl
|
|
415
|
+
|
|
416
|
+ exit 0
|
|
417
|
+}
|
|
418
|
+
|
|
419
|
+function renew_letsencrypt {
|
|
420
|
+ renew_domain=
|
|
421
|
+ data=$(tempfile 2>/dev/null)
|
|
422
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
423
|
+ dialog --title "Renew a Let's Encrypt certificate" \
|
|
424
|
+ --backtitle "Freedombone Security Settings" \
|
|
425
|
+ --inputbox "Enter the domain name" 8 60 2>$data
|
|
426
|
+ sel=$?
|
|
427
|
+ case $sel in
|
|
428
|
+ 0)
|
|
429
|
+ renew_domain=$(<$data)
|
|
430
|
+ ;;
|
|
431
|
+ esac
|
|
432
|
+
|
|
433
|
+ if [ ! $renew_domain ]; then
|
|
434
|
+ return
|
|
435
|
+ fi
|
|
436
|
+
|
|
437
|
+ if [[ $renew_domain == "http"* ]]; then
|
|
438
|
+ dialog --title "Renew a Let's Encrypt certificate" \
|
|
439
|
+ --msgbox "Don't include the https://" 6 40
|
|
440
|
+ return
|
|
441
|
+ fi
|
|
442
|
+
|
|
443
|
+ if [ ! -f /etc/ssl/certs/${renew_domain}.dhparam ]; then
|
|
444
|
+ dialog --title "Renew a Let's Encrypt certificate" \
|
|
445
|
+ --msgbox "An existing certificate for $renew_domain was not found" 6 40
|
|
446
|
+ return
|
|
447
|
+ fi
|
|
448
|
+
|
|
449
|
+ if [[ $renew_domain != *"."* ]]; then
|
|
450
|
+ dialog --title "Renew a Let's Encrypt certificate" \
|
|
451
|
+ --msgbox "Invalid domain name: $renew_domain" 6 40
|
|
452
|
+ return
|
|
453
|
+ fi
|
|
454
|
+
|
|
455
|
+ freedombone-renew-cert -h $renew_domain -p letsencrypt
|
|
456
|
+
|
393
|
457
|
exit 0
|
394
|
458
|
}
|
395
|
459
|
|
|
@@ -401,6 +465,7 @@ function housekeeping {
|
401
|
465
|
options=(1 "Regenerate ssh host keys" off
|
402
|
466
|
2 "Regenerate Diffie-Hellman keys" off
|
403
|
467
|
3 "Renew a StartSSL certificate" off)
|
|
468
|
+ 4 "Renew Let's Encrypt certificate" off)
|
404
|
469
|
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
|
405
|
470
|
clear
|
406
|
471
|
for choice in $choices
|
|
@@ -415,6 +480,9 @@ function housekeeping {
|
415
|
480
|
3)
|
416
|
481
|
renew_startssl
|
417
|
482
|
;;
|
|
483
|
+ 4)
|
|
484
|
+ renew_letsencrypt
|
|
485
|
+ ;;
|
418
|
486
|
esac
|
419
|
487
|
done
|
420
|
488
|
}
|