From 4ed2043183b90c5bf2d75cfd4f9d97534f104822 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Wed, 12 Dec 2018 18:21:01 +0100 Subject: [PATCH] updated recover dialog --- home.admin/00infoLCD.sh | 11 +++++++ home.admin/20recoverDialog.sh | 52 ++++++++++-------------------- home.admin/_bootstrap.provision.sh | 6 +--- 3 files changed, 29 insertions(+), 40 deletions(-) diff --git a/home.admin/00infoLCD.sh b/home.admin/00infoLCD.sh index 2f0dfb0..f6206be 100755 --- a/home.admin/00infoLCD.sh +++ b/home.admin/00infoLCD.sh @@ -134,6 +134,17 @@ while : sleep 3 continue fi + + # if freshly recovered + if [ "${state}" = "recovered" ]; then + l1="Login to set new passwords:\n" + l2="ssh admin@${localip}\n" + l3="Use password: raspiblitz\n" + boxwidth=$((${#localip} + 28)) + dialog --backtitle "RaspiBlitz (${state})" --infobox "$l1$l2$l3" 5 ${boxwidth} + sleep 3 + continue + fi # check if bitcoin is ready sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp diff --git a/home.admin/20recoverDialog.sh b/home.admin/20recoverDialog.sh index 12a5b97..d08eaf6 100755 --- a/home.admin/20recoverDialog.sh +++ b/home.admin/20recoverDialog.sh @@ -2,25 +2,24 @@ _temp="./download/dialog.$$" ## get basic info -source /home/admin/raspiblitz.info 2>/dev/null +source /mnt/hdd/raspiblitz.conf passwordValid=0 result="" while [ ${passwordValid} -eq 0 ] do # show password info dialog - dialog --backtitle "RaspiBlitz - Setup" --msgbox "RaspiBlitz uses 4 different passwords. -Referenced as password A, B, C and D. + dialog --backtitle "RaspiBlitz - Recover Setup" --msgbox "Your previous RaspiBlitz config was recovered. +You need to set a new Password A: A) Master User Password -B) Blockchain RPC Password -C) LND Wallet Password -D) LND Seed Password -Choose now 4 new passwords - all min 8 chars, +Passwords B, C & D stay as before. + +Follow Password Rules: Minimal of 8 chars, no spaces and only special characters - or . Write them down & store them in a safe place. -" 15 52 +" 14 52 # ask user for new password A dialog --backtitle "RaspiBlitz - Setup"\ @@ -47,38 +46,21 @@ Write them down & store them in a safe place. echo "admin:$result" | sudo chpasswd sleep 1 + # activate lnd & bitcoin service + echo "Enabling Services" + sudo systemctl daemon-reload + sudo systemctl enable lnd.service + sudo systemctl enable ${network}d.service + # sucess info dialog - dialog --backtitle "RaspiBlitz" --msgbox "OK - password changed to '$result'\nfor all users pi, admin, root & bitcoin" 6 52 - - # repeat until user input is nit length 0 - result="" - dialog --backtitle "RaspiBlitz - Setup"\ - --inputbox "Enter your RPC Password B:" 9 52 2>$_temp - result=$( cat $_temp ) - shred $_temp - - clearedResult=$(echo "${result}" | tr -dc '[:alnum:]-.' | tr -d ' ') - if [ ${#clearedResult} != ${#result} ] || [ ${#clearedResult} -eq 0 ]; then - clear - echo "FAIL - Password contained not allowed chars (see next screen)" - echo "Press ENTER to continue to start again" - read key - passwordValid=0 - else - - # set Blockchain RPC Password (for admin cli & template for user bitcoin) - sed -i "s/^rpcpassword=.*/rpcpassword=${result}/g" /home/admin/assets/${network}.conf - sed -i "s/^${network}d.rpcpass=.*/${network}d.rpcpass=${result}/g" /home/admin/assets/lnd.${network}.conf - - # success info dialog - dialog --backtitle "RaspiBlitz - SetUP" --msgbox "OK - RPC password changed to '$result'\n\nNow starting the Setup of your RaspiBlitz." 7 52 - clear - - fi + dialog --backtitle "RaspiBlitz" --msgbox "OK - new SSH passord A is '$result'\nFinal reboot is needed." 6 52 + sudo shutdown -r now fi done + + diff --git a/home.admin/_bootstrap.provision.sh b/home.admin/_bootstrap.provision.sh index dc25983..5134e62 100644 --- a/home.admin/_bootstrap.provision.sh +++ b/home.admin/_bootstrap.provision.sh @@ -64,16 +64,12 @@ sudo mkdir /home/admin/.lnd/data >> ${logFile} 2>&1 sudo cp -r /mnt/hdd/lnd/data/chain /home/admin/.lnd/data/chain >> ${logFile} 2>&1 sudo chown -R admin:admin /home/admin/.${network} >> ${logFile} 2>&1 sudo chown -R admin:admin /home/admin/.lnd >> ${logFile} 2>&1 -echo "Enabling Services" >> ${logFile} sudo cp /home/admin/assets/${network}d.service /etc/systemd/system/${network}d.service >> ${logFile} 2>&1 sudo chmod +x /etc/systemd/system/${network}d.service >> ${logFile} 2>&1 -sudo systemctl daemon-reload >> ${logFile} 2>&1 -sudo systemctl enable ${network}d.service >> ${logFile} 2>&1 sed -i "5s/.*/Wants=${network}d.service/" /home/admin/assets/lnd.service >> ${logFile} 2>&1 sed -i "6s/.*/After=${network}d.service/" /home/admin/assets/lnd.service >> ${logFile} 2>&1 sudo cp /home/admin/assets/lnd.service /etc/systemd/system/lnd.service >> ${logFile} 2>&1 sudo chmod +x /etc/systemd/system/lnd.service >> ${logFile} 2>&1 -sudo systemctl enable lnd >> ${logFile} 2>&1 # finish setup (SWAP, Benus, Firewall, Update, ..) sudo sed -i "s/^message=.*/message='Setup System ..'/g" ${infoFile} @@ -126,7 +122,7 @@ if [ "${rtlWebinterface}" = "on" ]; then echo "Provisioning RTL - run config script" >> ${logFile} sudo sed -i "s/^message=.*/message='Setup RTL (takes time)'/g" ${infoFile} sudo /home/admin/config.scripts/bonus.rtl.sh on >> ${logFile} 2>&1 -else +else echo "Provisioning RTL - keep default" >> ${logFile} fi