|
@@ -636,6 +636,51 @@ function enable_monkeysphere {
|
636
|
636
|
exit 0
|
637
|
637
|
}
|
638
|
638
|
|
|
639
|
+function register_website {
|
|
640
|
+ domain="$1"
|
|
641
|
+
|
|
642
|
+ if [[ ${domain} == *".local" ]]; then
|
|
643
|
+ echo $"Can't register local domains"
|
|
644
|
+ return
|
|
645
|
+ fi
|
|
646
|
+
|
|
647
|
+ if [ ! -f /etc/ssl/private/${domain}.key ]; then
|
|
648
|
+ echo $"No SSL/TLS private key found for ${domain}"
|
|
649
|
+ return
|
|
650
|
+ fi
|
|
651
|
+
|
|
652
|
+ if [ ! -f /etc/nginx/sites-available/${domain} ]; then
|
|
653
|
+ echo $"No virtual host found for ${domain}"
|
|
654
|
+ return
|
|
655
|
+ fi
|
|
656
|
+
|
|
657
|
+ monkeysphere-host import-key /etc/ssl/private/${domain}.key https://${domain}
|
|
658
|
+ monkeysphere-host publish-key
|
|
659
|
+ echo "0"
|
|
660
|
+}
|
|
661
|
+
|
|
662
|
+function register_website_interactive {
|
|
663
|
+ data=$(tempfile 2>/dev/null)
|
|
664
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
665
|
+ dialog --title $"Register a website with monkeysphere" \
|
|
666
|
+ --backtitle $"Freedombone Security Settings" \
|
|
667
|
+ --inputbox $"Enter the website domain name (without https://)" 8 60 2>$data
|
|
668
|
+ sel=$?
|
|
669
|
+ case $sel in
|
|
670
|
+ 0)
|
|
671
|
+ domain=$(<$data)
|
|
672
|
+ register_website "$domain"
|
|
673
|
+ if [ ! "$?" = "0" ]; then
|
|
674
|
+ dialog --title $"Register a website with monkeysphere" \
|
|
675
|
+ --msgbox "$?" 6 40
|
|
676
|
+ else
|
|
677
|
+ dialog --title $"Register a website with monkeysphere" \
|
|
678
|
+ --msgbox $"$domain has been registered" 6 40
|
|
679
|
+ fi
|
|
680
|
+ ;;
|
|
681
|
+ esac
|
|
682
|
+}
|
|
683
|
+
|
639
|
684
|
function housekeeping {
|
640
|
685
|
cmd=(dialog --separate-output \
|
641
|
686
|
--backtitle "Freedombone Security Configuration" \
|
|
@@ -647,7 +692,8 @@ function housekeeping {
|
647
|
692
|
4 "Update cipersuite" off
|
648
|
693
|
5 "Create a new Let's Encrypt certificate" off
|
649
|
694
|
6 "Renew Let's Encrypt certificate" off
|
650
|
|
- 7 "Enable GPG based authentication (monkeysphere)" off)
|
|
695
|
+ 7 "Enable GPG based authentication (monkeysphere)" off
|
|
696
|
+ 8 "Register a website with monkeysphere" off)
|
651
|
697
|
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
|
652
|
698
|
clear
|
653
|
699
|
for choice in $choices
|
|
@@ -674,6 +720,9 @@ function housekeeping {
|
674
|
720
|
7)
|
675
|
721
|
enable_monkeysphere
|
676
|
722
|
;;
|
|
723
|
+ 8)
|
|
724
|
+ register_website
|
|
725
|
+ ;;
|
677
|
726
|
esac
|
678
|
727
|
done
|
679
|
728
|
}
|
|
@@ -862,25 +911,6 @@ function refresh_gpg_keys {
|
862
|
911
|
exit 0
|
863
|
912
|
}
|
864
|
913
|
|
865
|
|
-function register_website {
|
866
|
|
- domain="$1"
|
867
|
|
- if [[ ${domain} == *".local" ]]; then
|
868
|
|
- echo $"Can't register local domains"
|
869
|
|
- exit 82438
|
870
|
|
- fi
|
871
|
|
- if [ ! -f /etc/ssl/private/${domain}.key ]; then
|
872
|
|
- echo $"No SSL/TLS private key found for ${domain}"
|
873
|
|
- exit 62852
|
874
|
|
- fi
|
875
|
|
- if [ ! -f /etc/nginx/sites-available/${domain} ]; then
|
876
|
|
- echo $"No virtual host found for ${domain}"
|
877
|
|
- exit 25625
|
878
|
|
- fi
|
879
|
|
- monkeysphere-host import-key /etc/ssl/private/${domain}.key https://${domain}
|
880
|
|
- monkeysphere-host publish-key
|
881
|
|
- exit 0
|
882
|
|
-}
|
883
|
|
-
|
884
|
914
|
function show_help {
|
885
|
915
|
echo ''
|
886
|
916
|
echo "${PROJECT_NAME}-sec"
|