Browse Source

replace password entry in setup

dev
rootzoll 6 years ago
parent
commit
099e4f3f62
  1. 2
      home.admin/00mainMenu.sh
  2. 84
      home.admin/20recoverDialog.sh
  3. 81
      home.admin/20setupDialog.sh

2
home.admin/00mainMenu.sh

@ -385,6 +385,8 @@ case $CHOICE in
read key
sudo shutdown -r now
else
echo "Press ENTER to return to main menu .."
read key
./00mainMenu.sh
fi
;;

84
home.admin/20recoverDialog.sh

@ -1,15 +1,10 @@
#!/bin/bash
_temp="./download/dialog.$$"
## get basic info
source /mnt/hdd/raspiblitz.conf
passwordValid=0
result=""
while [ ${passwordValid} -eq 0 ]
do
# show password info dialog
dialog --backtitle "RaspiBlitz - Recover Setup" --msgbox "Your previous RaspiBlitz config was recovered.
# show password info dialog
dialog --backtitle "RaspiBlitz - Recover Setup" --msgbox "Your previous RaspiBlitz config was recovered.
You need to set a new Password A:
A) Master User Password
@ -21,67 +16,40 @@ no spaces and only special characters - or .
Write them down & store them in a safe place.
" 14 52
# ask user for new password A
dialog --backtitle "RaspiBlitz - Setup"\
--inputbox "Please enter your Master/Admin Password A:\n!!! This is new password to login per SSH !!!" 10 52 2>$_temp
# call set password a script
sudo /home/admin/config.scripts/blitz.setpassword.sh a
# get user input
result=$( cat $_temp )
shred $_temp
passwordValid=1
# sucess info dialog
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
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 .."
read key
passwordValid=0
else
# activate lnd & bitcoin service
echo "Enabling Services"
sudo systemctl daemon-reload
sudo systemctl enable lnd.service
sudo systemctl enable ${network}d.service
if [ "${rtlWebinterface}" = "on" ]; then
sudo systemctl enable RTL
fi
# change user passwords and then change hostname
echo "pi:$result" | sudo chpasswd
echo "root:$result" | sudo chpasswd
echo "bitcoin:$result" | sudo chpasswd
echo "admin:$result" | sudo chpasswd
sleep 1
# remove flag that freshly recovered
sudo rm /home/admin/raspiblitz.recover.info
# activate lnd & bitcoin service
echo "Enabling Services"
sudo systemctl daemon-reload
sudo systemctl enable lnd.service
sudo systemctl enable ${network}d.service
if [ "${rtlWebinterface}" = "on" ]; then
sudo systemctl enable RTL
fi
# when auto-unlock is activated then Password C is needed to be restored on SD card
if [ "${autoUnlock}" = "on" ]; then
# remove flag that freshly recovered
sudo rm /home/admin/raspiblitz.recover.info
# when auto-unlock is activated then Password C is needed to be restored on SD card
if [ "${autoUnlock}" = "on" ]; then
# reset auto-unlock feature
dialog --backtitle "RaspiBlitz - Setup" --msgbox "You had the Auto-Unlock feature enabled.
# reset auto-unlock feature
dialog --backtitle "RaspiBlitz - Setup" --msgbox "You had the Auto-Unlock feature enabled.
In the next dialog you need to re-enter your
ACTUAL/OLD Password C to re-activate the
Auto-Unlock feature. Enter a empty password
to deactivate the Auto-Unlock feature.
" 10 52
sudo /home/admin/config.scripts/lnd.autounlock.sh on
dialog --backtitle "RaspiBlitz" --msgbox "FINAL REBOOT IS NEEDED." 6 52
else
dialog --backtitle "RaspiBlitz" --msgbox "New SSH password A is '$result'\nFINAL REBOOT IS NEEDED." 6 52
fi
sudo shutdown -r now
fi
done
sudo /home/admin/config.scripts/lnd.autounlock.sh on
dialog --backtitle "RaspiBlitz" --msgbox "FINAL REBOOT IS NEEDED." 6 52
else
dialog --backtitle "RaspiBlitz" --msgbox "OK - SSH password A set.\nFINAL REBOOT IS NEEDED." 6 52
fi
sudo shutdown -r now

81
home.admin/20setupDialog.sh

@ -4,6 +4,10 @@ _temp="./download/dialog.$$"
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
###################
# ENTER NAME
###################
# welcome and ask for name of RaspiBlitz
result=""
while [ ${#result} -eq 0 ]
@ -29,13 +33,12 @@ else
sed -i "s/^hostname=.*/hostname=${result}/g" /home/admin/raspiblitz.info
fi
###################
# ENTER PASSWORDS
###################
passwordValid=0
result=""
while [ ${passwordValid} -eq 0 ]
do
# show password info dialog
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --msgbox "RaspiBlitz uses 4 different passwords.
# show password info dialog
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --msgbox "RaspiBlitz uses 4 different passwords.
Referenced as password A, B, C and D.
A) Master User Password
@ -48,63 +51,15 @@ no spaces and only special characters - or .
Write them down & store them in a safe place.
" 15 52
# ask user for new password A
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})"\
--inputbox "Please enter your Master/Admin Password A:\n!!! This is new password to login per SSH !!!" 10 52 2>$_temp
# get user input
result=$( cat $_temp )
shred $_temp
passwordValid=1
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 .."
read key
passwordValid=0
else
# change user passwords and then change hostname
echo "pi:$result" | sudo chpasswd
echo "root:$result" | sudo chpasswd
echo "bitcoin:$result" | sudo chpasswd
echo "admin:$result" | sudo chpasswd
sleep 1
# 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 (${network}/${chain})"\
--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 (${network}/${chain})" --msgbox "OK - RPC password changed to '$result'\n\nNow starting the Setup of your RaspiBlitz." 7 52
clear
fi
fi
done
# call set password a script
sudo /home/admin/config.scripts/blitz.setpassword.sh a
# sucess info dialog
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
# call set password b script
sudo /home/admin/config.scripts/blitz.setpassword.sh b
# success info dialog
dialog --backtitle "RaspiBlitz" --msgbox "OK - RPC password changed \n\nNow starting the Setup of your RaspiBlitz." 7 52
clear
Loading…
Cancel
Save