Simpler master password
This commit is contained in:
parent
daafbef7a1
commit
9176ac12d7
|
@ -251,8 +251,14 @@ fi
|
||||||
get_backup_key_id
|
get_backup_key_id
|
||||||
|
|
||||||
if [ ${#MASTER_PASSWORD} -eq 0 ]; then
|
if [ ${#MASTER_PASSWORD} -eq 0 ]; then
|
||||||
# Use the backups private key as a symmetric passphrase
|
if [ ! -d /root/.passwords/root ]; then
|
||||||
MASTER_PASSWORD=$(gpg -q --armor --export-secret-key $MY_BACKUP_KEY_ID | sed '/---/d' | sed '/Version/d' | sed '/^$/d')
|
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
|
fi
|
||||||
|
|
||||||
if [ $TESTS ]; then
|
if [ $TESTS ]; then
|
||||||
|
@ -289,17 +295,6 @@ if [ ! $CURR_APP ]; then
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
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
|
if [ ${#CURR_PASSWORD} -eq 0 ]; then
|
||||||
# retrieve password
|
# retrieve password
|
||||||
if [ ! -f ~/.passwords/$CURR_USERNAME/$CURR_APP ]; then
|
if [ ! -f ~/.passwords/$CURR_USERNAME/$CURR_APP ]; then
|
||||||
|
|
Loading…
Reference in New Issue