2018-12-05 00:07:58 +01:00
|
|
|
#!/bin/bash
|
2018-07-17 13:12:03 +02:00
|
|
|
_temp="./download/dialog.$$"
|
|
|
|
|
2018-12-06 14:36:02 +01:00
|
|
|
## get basic info
|
|
|
|
source /home/admin/raspiblitz.info 2>/dev/null
|
2018-07-29 01:33:54 +02:00
|
|
|
|
2018-11-28 12:42:52 +01:00
|
|
|
passwordValid=0
|
|
|
|
result=""
|
2018-11-28 12:47:15 +01:00
|
|
|
while [ ${passwordValid} -eq 0 ]
|
2018-11-28 12:42:52 +01:00
|
|
|
do
|
|
|
|
# show password info dialog
|
|
|
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "RaspiBlitz uses 4 different passwords.
|
2018-07-17 13:12:03 +02:00
|
|
|
Referenced as password A, B, C and D.
|
|
|
|
|
|
|
|
A) Master User Password
|
2018-07-29 01:33:54 +02:00
|
|
|
B) Blockchain RPC Password
|
2018-07-17 13:12:03 +02:00
|
|
|
C) LND Wallet Password
|
|
|
|
D) LND Seed Password
|
|
|
|
|
2018-11-27 21:11:53 +01:00
|
|
|
Choose now 4 new passwords - all min 8 chars,
|
|
|
|
no spaces and only special characters - or .
|
2018-07-17 13:12:03 +02:00
|
|
|
Write them down & store them in a safe place.
|
2018-11-28 12:42:52 +01:00
|
|
|
" 15 52
|
2018-07-17 13:12:03 +02:00
|
|
|
|
2018-11-28 12:42:52 +01:00
|
|
|
# ask user for new password A
|
|
|
|
dialog --backtitle "RaspiBlitz - Setup"\
|
2018-07-17 13:12:03 +02:00
|
|
|
--inputbox "Please enter your Master/Admin Password A:\n!!! This is new password to login per SSH !!!" 10 52 2>$_temp
|
|
|
|
|
2018-11-28 12:42:52 +01:00
|
|
|
# get user input
|
|
|
|
result=$( cat $_temp )
|
|
|
|
shred $_temp
|
|
|
|
passwordValid=1
|
|
|
|
|
2018-11-28 14:07:33 +01:00
|
|
|
clearedResult=$(echo "${result}" | tr -dc '[:alnum:]-.' | tr -d ' ')
|
2018-11-28 14:17:21 +01:00
|
|
|
if [ ${#clearedResult} != ${#result} ] || [ ${#clearedResult} -eq 0 ]; then
|
2018-11-28 12:42:52 +01:00
|
|
|
clear
|
2018-11-28 14:07:33 +01:00
|
|
|
echo "FAIL - Password contained not allowed chars (see next screen)"
|
2018-11-28 12:42:52 +01:00
|
|
|
echo "Press ENTER to continue .."
|
2018-11-28 12:51:16 +01:00
|
|
|
read key
|
2018-11-28 12:42:52 +01:00
|
|
|
passwordValid=0
|
2018-11-28 14:13:17 +01:00
|
|
|
else
|
|
|
|
|
2018-11-28 14:17:21 +01:00
|
|
|
# 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"\
|
|
|
|
--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
|
2018-11-28 14:13:17 +01:00
|
|
|
|
2018-11-28 14:17:21 +01:00
|
|
|
fi
|
|
|
|
|
2018-11-28 14:13:17 +01:00
|
|
|
fi
|
|
|
|
|
2018-07-17 13:12:03 +02:00
|
|
|
done
|
|
|
|
|
2018-07-29 01:33:54 +02:00
|
|
|
|
2018-11-28 14:13:17 +01:00
|
|
|
|