ソースを参照

Tidying key recovery from usb

Bob Mottram 8 年 前
コミット
763544efd7
共有3 個のファイルを変更した21 個の追加28 個の削除を含む
  1. 11
    28
      src/freedombone-config
  2. 4
    0
      src/freedombone-keydrive
  3. 6
    0
      src/freedombone-recoverkey

+ 11
- 28
src/freedombone-config ファイルの表示

@@ -955,8 +955,8 @@ function reconstruct_key {
955 955
 }
956 956
 
957 957
 function interactive_gpg_from_usb {
958
-    dialog --title $"Encryption keys" \
959
-           --msgbox $'Plug in a USB drive containing a copy of your full key or key fragment' 6 70
958
+    dialog --title $"Recover Encryption Keys" \
959
+           --msgbox $'Plug in a USB keydrive containing a copy of your full key or key fragment' 6 70
960 960
 
961 961
     HOME_DIR=/home/$MY_USERNAME
962 962
     GPG_LOADING="yes"
@@ -964,34 +964,17 @@ function interactive_gpg_from_usb {
964 964
     GPG_CTR=0
965 965
     while [[ $GPG_LOADING == "yes" ]]
966 966
     do
967
-        if [[ $INSTALLING_ON_BBB == "yes" ]]; then
968
-            GPG_USB_DRIVE='/dev/sda1'
969
-            if [ ! -b $GPG_USB_DRIVE ]; then
970
-                if (( GPG_CTR > 0 )); then
971
-                    reconstruct_key
972
-                    return 0
973
-                fi
974
-                dialog --title $"Encryption keys" --msgbox $'No USB drive found' 6 30
975
-                exit 739836
976
-            fi
977
-        else
978
-            GPG_USB_DRIVE='/dev/sdb1'
979
-            if [ ! -b $GPG_USB_DRIVE ]; then
980
-                GPG_USB_DRIVE='/dev/sdc1'
981
-                if [ ! -b $GPG_USB_DRIVE ]; then
982
-                    GPG_USB_DRIVE='/dev/sdd1'
983
-                    if [ ! -b $GPG_USB_DRIVE ]; then
984
-                        if (( GPG_CTR > 0 )); then
985
-                            reconstruct_key
986
-                            return 0
987
-                        fi
988
-                        dialog --title $"Encryption keys" --msgbox $'No USB drive found' 6 30
989
-                        exit 27852
990
-                    fi
991
-                fi
967
+        if [ ! -b $GPG_USB_DRIVE ]; then
968
+            if (( GPG_CTR > 0 )); then
969
+                reconstruct_key
970
+                return 0
992 971
             fi
972
+            dialog --title $"Recover Encryption Keys" --msgbox $'No USB drive found' 6 30
973
+            exit 739836
993 974
         fi
994 975
 
976
+        detect_usb_drive
977
+        GPG_USB_DRIVE=$USB_DRIVE
995 978
         GPG_USB_MOUNT='/mnt/usb'
996 979
         umount -f $GPG_USB_MOUNT
997 980
         if [ ! -d $GPG_USB_MOUNT ]; then
@@ -1013,7 +996,7 @@ function interactive_gpg_from_usb {
1013 996
                 reconstruct_key
1014 997
                 return 0
1015 998
             fi
1016
-            dialog --title $"Encryption keys" \
999
+            dialog --title $"Recover Encryption Keys" \
1017 1000
                    --msgbox $"There was a problem mounting the USB drive to $GPG_USB_MOUNT" 6 70
1018 1001
             rm -rf $GPG_USB_MOUNT
1019 1002
             exit 74393

+ 4
- 0
src/freedombone-keydrive ファイルの表示

@@ -135,6 +135,10 @@ if [[ $MASTER_DRIVE == "yes" || $MASTER_DRIVE == "y" || $MASTER_DRIVE == "1" ]];
135 135
       exit 73025
136 136
   fi
137 137
   cp -rf /home/$MY_USERNAME/.gnupg $USB_MOUNT
138
+  if [ -d /etc/letsencrypt ]; then
139
+      cp -rf /etc/letsencrypt $USB_MOUNT
140
+      echo $"LetsEncrypt keys copied to $USB_DRIVE"
141
+  fi
138 142
   if [ -d $USB_MOUNT/.gnupg ]; then
139 143
       echo $"GPG Keyring copied to $USB_DRIVE. You may now remove the drive."
140 144
   else

+ 6
- 0
src/freedombone-recoverkey ファイルの表示

@@ -223,6 +223,12 @@ function interactive_gpg_from_usb {
223 223
             if [ ! -d $HOME_DIR/.gnupg ]; then
224 224
                 mkdir $HOME_DIR/.gnupg
225 225
             fi
226
+            if [ -d $GPG_USB_MOUNT/letsencrypt ]; then
227
+                test -r $GPG_USB_MOUNT/letsencrypt
228
+                if [ $? -ne ]; then
229
+                   cp -rf $GPG_USB_MOUNT/letsencrypt /etc
230
+                fi
231
+            fi
226 232
             cp -r $GPG_USB_MOUNT/.gnupg/* $HOME_DIR/.gnupg
227 233
             GPG_LOADING="no"
228 234
             dialog --title $"Encryption keys" \