Simpler master password

This commit is contained in:
Bob Mottram 2016-12-04 10:23:24 +00:00
parent daafbef7a1
commit 9176ac12d7
1 changed files with 8 additions and 13 deletions

View File

@ -251,8 +251,14 @@ fi
get_backup_key_id
if [ ${#MASTER_PASSWORD} -eq 0 ]; then
# Use the backups private key as a symmetric passphrase
MASTER_PASSWORD=$(gpg -q --armor --export-secret-key $MY_BACKUP_KEY_ID | sed '/---/d' | sed '/Version/d' | sed '/^$/d')
if [ ! -d /root/.passwords/root ]; then
mkdir -p /root/.passwords/root
fi
if [ ! -f /root/.passwords/root/master ]; then
echo "$(openssl rand -base64 32 | cut -c1-30)" > /root/.passwords/root/master
chmod 700 /root/.passwords/root/master
fi
MASTER_PASSWORD=$(cat /root/.passwords/root/master)
fi
if [ $TESTS ]; then
@ -289,17 +295,6 @@ if [ ! $CURR_APP ]; then
exit 3
fi
if [[ "$CURR_USERNAME" == "root" ]]; then
if [ ! -d /root/.passwords/root ]; then
mkdir -p /root/.passwords/root
fi
if [ ! -f /root/.passwords/root/master ]; then
echo "$(openssl rand -base64 32 | cut -c1-30)" > /root/.passwords/root/master
chmod 700 /root/.passwords/root/master
fi
MASTER_PASSWORD=$(cat /root/.passwords/root/master)
fi
if [ ${#CURR_PASSWORD} -eq 0 ]; then
# retrieve password
if [ ! -f ~/.passwords/$CURR_USERNAME/$CURR_APP ]; then