mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-11-18 18:07:45 +01:00
replace password entry in setup
This commit is contained in:
@@ -385,6 +385,8 @@ case $CHOICE in
|
|||||||
read key
|
read key
|
||||||
sudo shutdown -r now
|
sudo shutdown -r now
|
||||||
else
|
else
|
||||||
|
echo "Press ENTER to return to main menu .."
|
||||||
|
read key
|
||||||
./00mainMenu.sh
|
./00mainMenu.sh
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
_temp="./download/dialog.$$"
|
|
||||||
|
|
||||||
## get basic info
|
## get basic info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
passwordValid=0
|
# show password info dialog
|
||||||
result=""
|
dialog --backtitle "RaspiBlitz - Recover Setup" --msgbox "Your previous RaspiBlitz config was recovered.
|
||||||
while [ ${passwordValid} -eq 0 ]
|
|
||||||
do
|
|
||||||
# show password info dialog
|
|
||||||
dialog --backtitle "RaspiBlitz - Recover Setup" --msgbox "Your previous RaspiBlitz config was recovered.
|
|
||||||
|
|
||||||
You need to set a new Password A:
|
You need to set a new Password A:
|
||||||
A) Master User Password
|
A) Master User Password
|
||||||
@@ -21,67 +16,40 @@ no spaces and only special characters - or .
|
|||||||
Write them down & store them in a safe place.
|
Write them down & store them in a safe place.
|
||||||
" 14 52
|
" 14 52
|
||||||
|
|
||||||
# ask user for new password A
|
# call set password a script
|
||||||
dialog --backtitle "RaspiBlitz - Setup"\
|
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
||||||
--inputbox "Please enter your Master/Admin Password A:\n!!! This is new password to login per SSH !!!" 10 52 2>$_temp
|
|
||||||
|
|
||||||
# get user input
|
# sucess info dialog
|
||||||
result=$( cat $_temp )
|
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
|
||||||
shred $_temp
|
|
||||||
passwordValid=1
|
|
||||||
|
|
||||||
clearedResult=$(echo "${result}" | tr -dc '[:alnum:]-.' | tr -d ' ')
|
# activate lnd & bitcoin service
|
||||||
if [ ${#clearedResult} != ${#result} ] || [ ${#clearedResult} -eq 0 ]; then
|
echo "Enabling Services"
|
||||||
clear
|
sudo systemctl daemon-reload
|
||||||
echo "FAIL - Password contained not allowed chars (see next screen)"
|
sudo systemctl enable lnd.service
|
||||||
echo "Press ENTER to continue .."
|
sudo systemctl enable ${network}d.service
|
||||||
read key
|
if [ "${rtlWebinterface}" = "on" ]; then
|
||||||
passwordValid=0
|
sudo systemctl enable RTL
|
||||||
else
|
fi
|
||||||
|
|
||||||
# change user passwords and then change hostname
|
# remove flag that freshly recovered
|
||||||
echo "pi:$result" | sudo chpasswd
|
sudo rm /home/admin/raspiblitz.recover.info
|
||||||
echo "root:$result" | sudo chpasswd
|
|
||||||
echo "bitcoin:$result" | sudo chpasswd
|
|
||||||
echo "admin:$result" | sudo chpasswd
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
# activate lnd & bitcoin service
|
# when auto-unlock is activated then Password C is needed to be restored on SD card
|
||||||
echo "Enabling Services"
|
if [ "${autoUnlock}" = "on" ]; then
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable lnd.service
|
|
||||||
sudo systemctl enable ${network}d.service
|
|
||||||
if [ "${rtlWebinterface}" = "on" ]; then
|
|
||||||
sudo systemctl enable RTL
|
|
||||||
fi
|
|
||||||
|
|
||||||
# remove flag that freshly recovered
|
# reset auto-unlock feature
|
||||||
sudo rm /home/admin/raspiblitz.recover.info
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "You had the Auto-Unlock feature enabled.
|
||||||
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
In the next dialog you need to re-enter your
|
In the next dialog you need to re-enter your
|
||||||
ACTUAL/OLD Password C to re-activate the
|
ACTUAL/OLD Password C to re-activate the
|
||||||
Auto-Unlock feature. Enter a empty password
|
Auto-Unlock feature. Enter a empty password
|
||||||
to deactivate the Auto-Unlock feature.
|
to deactivate the Auto-Unlock feature.
|
||||||
" 10 52
|
" 10 52
|
||||||
sudo /home/admin/config.scripts/lnd.autounlock.sh on
|
sudo /home/admin/config.scripts/lnd.autounlock.sh on
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "FINAL REBOOT IS NEEDED." 6 52
|
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
dialog --backtitle "RaspiBlitz" --msgbox "OK - SSH password A set.\nFINAL REBOOT IS NEEDED." 6 52
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo shutdown -r now
|
||||||
@@ -4,6 +4,10 @@ _temp="./download/dialog.$$"
|
|||||||
## get basic info
|
## get basic info
|
||||||
source /home/admin/raspiblitz.info 2>/dev/null
|
source /home/admin/raspiblitz.info 2>/dev/null
|
||||||
|
|
||||||
|
###################
|
||||||
|
# ENTER NAME
|
||||||
|
###################
|
||||||
|
|
||||||
# welcome and ask for name of RaspiBlitz
|
# welcome and ask for name of RaspiBlitz
|
||||||
result=""
|
result=""
|
||||||
while [ ${#result} -eq 0 ]
|
while [ ${#result} -eq 0 ]
|
||||||
@@ -29,13 +33,12 @@ else
|
|||||||
sed -i "s/^hostname=.*/hostname=${result}/g" /home/admin/raspiblitz.info
|
sed -i "s/^hostname=.*/hostname=${result}/g" /home/admin/raspiblitz.info
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
###################
|
||||||
|
# ENTER PASSWORDS
|
||||||
|
###################
|
||||||
|
|
||||||
passwordValid=0
|
# show password info dialog
|
||||||
result=""
|
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --msgbox "RaspiBlitz uses 4 different passwords.
|
||||||
while [ ${passwordValid} -eq 0 ]
|
|
||||||
do
|
|
||||||
# show password info dialog
|
|
||||||
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --msgbox "RaspiBlitz uses 4 different passwords.
|
|
||||||
Referenced as password A, B, C and D.
|
Referenced as password A, B, C and D.
|
||||||
|
|
||||||
A) Master User Password
|
A) Master User Password
|
||||||
@@ -48,63 +51,15 @@ no spaces and only special characters - or .
|
|||||||
Write them down & store them in a safe place.
|
Write them down & store them in a safe place.
|
||||||
" 15 52
|
" 15 52
|
||||||
|
|
||||||
# ask user for new password A
|
# call set password a script
|
||||||
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})"\
|
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
||||||
--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
|
|
||||||
|
|
||||||
|
# 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
|
||||||
Reference in New Issue
Block a user