Browse Source

Optionally specify master password

Bob Mottram 8 years ago
parent
commit
ca7b84be97
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      src/freedombone-pass

+ 10
- 2
src/freedombone-pass View File

51
 TESTS=
51
 TESTS=
52
 EXPORT_FILENAME=
52
 EXPORT_FILENAME=
53
 
53
 
54
+MASTER_PASSWORD=''
55
+
54
 # If this file is present then don't store passwords
56
 # If this file is present then don't store passwords
55
 NO_PASSWORD_STORE_FILE=~/.nostore
57
 NO_PASSWORD_STORE_FILE=~/.nostore
56
 
58
 
224
             shift
226
             shift
225
             EXPORT_FILENAME="${1}"
227
             EXPORT_FILENAME="${1}"
226
             ;;
228
             ;;
229
+        --master)
230
+            shift
231
+            MASTER_PASSWORD="${1}"
232
+            ;;
227
         -p|--pass|--password|--passphrase)
233
         -p|--pass|--password|--passphrase)
228
             shift
234
             shift
229
             CURR_PASSWORD="${1}"
235
             CURR_PASSWORD="${1}"
244
 
250
 
245
 get_backup_key_id
251
 get_backup_key_id
246
 
252
 
247
-# Use the backups private key as a symmetric passphrase
248
-MASTER_PASSWORD=$(gpg -q --armor --export-secret-key $MY_BACKUP_KEY_ID | sed '/---/d' | sed '/Version/d' | sed '/^$/d')
253
+if [ ${#MASTER_PASSWORD} -eq 0 ]; then
254
+    # Use the backups private key as a symmetric passphrase
255
+    MASTER_PASSWORD=$(gpg -q --armor --export-secret-key $MY_BACKUP_KEY_ID | sed '/---/d' | sed '/Version/d' | sed '/^$/d')
256
+fi
249
 
257
 
250
 if [ $TESTS ]; then
258
 if [ $TESTS ]; then
251
     run_tests
259
     run_tests