only show seedwords if present on ENCRYPT

This commit is contained in:
openoms
2021-08-31 14:54:33 +01:00
parent a66821eeba
commit 2586f46ea7

View File

@@ -188,12 +188,11 @@ if [ "$1" = "new" ] || [ "$1" = "new-force" ] || [ "$1" = "seed" ] || [ "$1" = "
sudo chown bitcoin:bitcoin /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
sudo chmod 600 /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
echo "
# this file was placed by cln.hsmtool.sh
# contains the seed words from which the hsm_secret in the same directory was generated
# This file was placed by cln.hsmtool.sh .
# Contains the seed words from which the hsm_secret in the same directory was generated
seedwords='${seedwords}'
seedwords6x4='${seedwords6x4}'
# will be removed safely when the hsm_secret is encrypted
# the words cannot be generated from the hsm_secret (one way function)
# Will be removed safely when the hsm_secret is encrypted.
" | sudo -u bitcoin tee /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
# pass to 'hsmtool generatehsm hsm_secret'
@@ -260,6 +259,7 @@ elif [ "$1" = "lock" ]; then
exit 0
elif [ "$1" = "encrypt" ]; then
if [ -f /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info ];then
# show the words one last time
source <(sudo -u bitcoin cat /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info)
ack=0
@@ -273,11 +273,15 @@ elif [ "$1" = "encrypt" ]; then
done
# delete seedwords.info
sudo -u bitcoin shred /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info
deletedWhen=" "
else
deletedWhen="not available any more"
fi
echo "
# this file is placed by cln.hsmtool.sh
# the seed words from which the hsm_secret in the same directory was generated
# were deleted when the hsm_secret was encrypted
# the words cannot be generated from the hsm_secret (one way function)
# This file is placed by cln.hsmtool.sh .
# The seed words from which the hsm_secret in the same directory was generated
# were $deletedWhen.
# The words cannot be generated from the hsm_secret (one way function).
# If you don't have the words the hsm_secret can be still backed up in hex:
# https://lightning.readthedocs.io/BACKUP.html#hsm-secret
" | sudo -u bitcoin tee /home/bitcoin/.lightning/${CLNETWORK}/seedwords.info