#1857 temp store seed on RAM disc and nake sure its deleted (#1875)

This commit is contained in:
Christian Rotzoll 2020-12-18 22:25:53 +01:00 committed by GitHub
parent 7d761841fa
commit 4e986cad26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,7 @@ while [ ${chainIsReady} -eq 0 ]
do do
loopCount=$(($loopCount +1)) loopCount=$(($loopCount +1))
result=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 2>error.out) result=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 2>error.out)
error=`cat error.out` error=$(cat error.out)
rm error.out rm error.out
if [ ${#error} -gt 0 ]; then if [ ${#error} -gt 0 ]; then
if [ ${loopCount} -gt 33 ]; then if [ ${loopCount} -gt 33 ]; then
@ -183,10 +183,12 @@ if [ ${walletExists} -eq 0 ]; then
############################ ############################
# let user enter password c # let user enter password c
sudo shred -u /home/admin/.pass.tmp 2>/dev/null sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /home/admin/.pass.tmp sudo touch /var/cache/raspiblitz/.pass.tmp
passwordC=`sudo cat /home/admin/.pass.tmp` sudo chown admin:admin /var/cache/raspiblitz/.pass.tmp
sudo shred -u /home/admin/.pass.tmp 2>/dev/null sudo /home/admin/config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /var/cache/raspiblitz/.pass.tmp
passwordC=$(sudo cat /var/cache/raspiblitz/.pass.tmp)
sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
# make sure passwordC is set # make sure passwordC is set
if [ ${#passwordC} -eq 0 ]; then if [ ${#passwordC} -eq 0 ]; then
@ -197,9 +199,11 @@ if [ ${walletExists} -eq 0 ]; then
# generate wallet with seed and set passwordC # generate wallet with seed and set passwordC
clear clear
echo "Generating new Wallet ...." echo "Generating new Wallet ...."
python3 /home/admin/config.scripts/lnd.initwallet.py new ${passwordC} > /home/admin/.seed.tmp sudo touch /var/cache/raspiblitz/.seed.tmp
source /home/admin/.seed.tmp sudo chown admin:admin /var/cache/raspiblitz/.seed.tmp
sudo shred -u /home/admin/.pass.tmp 2>/dev/null python3 /home/admin/config.scripts/lnd.initwallet.py new ${passwordC} > /var/cache/raspiblitz/.seed.tmp
source /var/cache/raspiblitz/.seed.tmp
sudo shred -u /var/cache/raspiblitz/.seed.tmp 2>/dev/null
# in case of error - retry # in case of error - retry
if [ ${#err} -gt 0 ]; then if [ ${#err} -gt 0 ]; then
@ -299,10 +303,12 @@ or having a complete LND rescue-backup from your old node.
clear clear
# let user enter password c # let user enter password c
sudo shred -u /home/admin/.pass.tmp 2>/dev/null sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /home/admin/.pass.tmp sudo touch /var/cache/raspiblitz/.pass.tmp
passwordC=`sudo cat /home/admin/.pass.tmp` sudo chown admin:admin /var/cache/raspiblitz/.pass.tmp
sudo shred -u /home/admin/.pass.tmp 2>/dev/null sudo /home/admin/config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /var/cache/raspiblitz/.pass.tmp
passwordC=$(sudo cat /var/cache/raspiblitz/.pass.tmp)
sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
# get seed word list # get seed word list
if [ "${CHOICE}" == "SEED+SCB" ] || [ "${CHOICE}" == "ONLYSEED" ]; then if [ "${CHOICE}" == "SEED+SCB" ] || [ "${CHOICE}" == "ONLYSEED" ]; then
@ -311,9 +317,11 @@ or having a complete LND rescue-backup from your old node.
while [ ${wordsCorrect} -eq 0 ] while [ ${wordsCorrect} -eq 0 ]
do do
# dialog to enter # dialog to enter
dialog --backtitle "RaspiBlitz - LND Recover" --inputbox "Please enter/paste the SEED WORD LIST:\n(just the words, seperated by spaces, in correct order as numbered)" 9 78 2>/home/admin/.seed.tmp sudo touch /var/cache/raspiblitz/.seed.tmp
wordstring=$( cat /home/admin/.seed.tmp | sed 's/[^a-zA-Z0-9 ]//g' ) sudo chown admin:admin /var/cache/raspiblitz/.seed.tmp
shred -u /home/admin/.seed.tmp dialog --backtitle "RaspiBlitz - LND Recover" --inputbox "Please enter/paste the SEED WORD LIST:\n(just the words, seperated by spaces, in correct order as numbered)" 9 78 2>/var/cache/raspiblitz/.seed.tmp
wordstring=$( cat /var/cache/raspiblitz/.seed.tmp | sed 's/[^a-zA-Z0-9 ]//g' )
shred -u /var/cache/raspiblitz/.seed.tmp
echo "processing ... ${wordstring}" echo "processing ... ${wordstring}"
# check correct number of words # check correct number of words
@ -353,10 +361,12 @@ During wallet creation LND offers to set an extra password
to protect the seed words. Most users did not set this. to protect the seed words. Most users did not set this.
" 11 65 " 11 65
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
sudo shred -u /home/admin/.pass.tmp 2>/dev/null sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Enter extra Password D" /home/admin/.pass.tmp empty-allowed sudo touch /var/cache/raspiblitz/.pass.tmp
passwordD=`sudo cat /home/admin/.pass.tmp` sudo chown admin:admin /var/cache/raspiblitz/.pass.tmp
sudo shred -u /home/admin/.pass.tmp 2>/dev/null sudo /home/admin/config.scripts/blitz.setpassword.sh x "Enter extra Password D" /var/cache/raspiblitz/.pass.tmp empty-allowed
passwordD=$(sudo cat /var/cache/raspiblitz/.pass.tmp)
sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
fi fi
fi fi