Преглед изворни кода

Security menu option to export passwords

Bob Mottram пре 8 година
родитељ
комит
3fb6d9d109
1 измењених фајлова са 52 додато и 18 уклоњено
  1. 52
    18
      src/freedombone-sec

+ 52
- 18
src/freedombone-sec Прегледај датотеку

@@ -69,6 +69,35 @@ LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
69 69
 
70 70
 MY_USERNAME=
71 71
 
72
+function any_key {
73
+    echo ' '
74
+    read -n1 -r -p $"Press any key to continue..." key
75
+}
76
+
77
+function export_passwords {
78
+    detect_usb_drive
79
+    data=$(tempfile 2>/dev/null)
80
+    trap "rm -f $data" 0 1 2 5 15
81
+    dialog --title $"Export passwords to USB drive $USB_DRIVE" \
82
+           --backtitle $"Freedombone Control Panel" \
83
+           --defaultno \
84
+           --yesno $"\nPlease confirm that you wish to export passwords to a LUKS formatted USB drive." 10 60
85
+    sel=$?
86
+    case $sel in
87
+        1) return;;
88
+        255) return;;
89
+    esac
90
+
91
+    dialog --title $"Export passwords" \
92
+           --msgbox $"\nEnsure that the USB drive is plugged in then press Enter and type in the drive's encryption password" 8 60
93
+
94
+    clear
95
+    backup_mount_drive ${USB_DRIVE}
96
+    ${PROJECT_NAME}-pass --export ${USB_MOUNT}/freedombone-passwords.xml
97
+    backup_unmount_drive ${USB_DRIVE}
98
+    any_key
99
+}
100
+
72 101
 function get_protocols_from_website {
73 102
     if [ ! -f $WEBSITES_DIRECTORY/$1 ]; then
74 103
         return
@@ -725,18 +754,19 @@ function menu_security_settings {
725 754
     trap "rm -f $data" 0 1 2 5 15
726 755
     dialog --backtitle $"Freedombone Control Panel" \
727 756
            --title $"Security Settings" \
728
-           --radiolist $"Choose an operation:" 18 76 18 \
757
+           --radiolist $"Choose an operation:" 19 76 19 \
729 758
            1 $"Show ssh host public key" off \
730 759
            2 $"Password storage" off \
731
-           3 $"Regenerate ssh host keys" off \
732
-           4 $"Regenerate Diffie-Hellman keys" off \
733
-           5 $"Update cipersuite" off \
734
-           6 $"Create a new Let's Encrypt certificate" off \
735
-           7 $"Renew Let's Encrypt certificate" off \
736
-           8 $"Enable GPG based authentication (monkeysphere)" off \
737
-           9 $"Register a website with monkeysphere" off \
738
-           10 $"Allow ssh login with passwords" off \
739
-           11 $"Go Back/Exit" on 2> $data
760
+           3 $"Export passwords" off \
761
+           4 $"Regenerate ssh host keys" off \
762
+           5 $"Regenerate Diffie-Hellman keys" off \
763
+           6 $"Update cipersuite" off \
764
+           7 $"Create a new Let's Encrypt certificate" off \
765
+           8 $"Renew Let's Encrypt certificate" off \
766
+           9 $"Enable GPG based authentication (monkeysphere)" off \
767
+           10 $"Register a website with monkeysphere" off \
768
+           11 $"Allow ssh login with passwords" off \
769
+           12 $"Go Back/Exit" on 2> $data
740 770
     sel=$?
741 771
     case $sel in
742 772
         1) exit 1;;
@@ -768,33 +798,37 @@ function menu_security_settings {
768 798
             exit 0
769 799
             ;;
770 800
         3)
771
-            regenerate_ssh_host_keys
801
+            export_passwords
802
+            exit 0
772 803
             ;;
773 804
         4)
774
-            regenerate_dh_keys
805
+            regenerate_ssh_host_keys
775 806
             ;;
776 807
         5)
808
+            regenerate_dh_keys
809
+            ;;
810
+        6)
777 811
             interactive_setup
778 812
             update_ciphersuite
779 813
             ;;
780
-        6)
814
+        7)
781 815
             create_letsencrypt
782 816
             ;;
783
-        7)
817
+        8)
784 818
             renew_letsencrypt
785 819
             ;;
786
-        8)
820
+        9)
787 821
             enable_monkeysphere
788 822
             ;;
789
-        9)
823
+        10)
790 824
             register_website
791 825
             ;;
792
-        10)
826
+        11)
793 827
             allow_ssh_passwords
794 828
             change_ssh_settings
795 829
             exit 0
796 830
             ;;
797
-        11)
831
+        12)
798 832
             exit 0
799 833
             ;;
800 834
     esac