raspiblitz/home.admin/setup.scripts/dialogPasswords.sh

110 lines
3.4 KiB
Bash
Raw Normal View History

2021-05-03 14:00:01 +02:00
#!/bin/bash
# get basic system information
# these are the same set of infos the WebGUI dialog/controler has
source /home/admin/raspiblitz.info
# SETUPFILE
# this key/value file contains the state during the setup process
2021-05-03 15:24:54 +02:00
SETUPFILE="/var/cache/raspiblitz/temp/raspiblitz.setup"
2021-05-03 14:32:36 +02:00
source $SETUPFILE
2021-05-03 14:00:01 +02:00
####################################################
# INPUT PASSWORDS (based on flags from raspiblitz.setup)
# dynamic info string on what passwords need to be changed
2021-05-03 17:50:43 +02:00
# at the moment its always
passwordinfo="A"
echo "A"
2021-05-03 14:00:01 +02:00
if [ "${setPasswordB}" == "1" ]; then
passwordinfo = "${passwordinfo}, B"
2021-05-03 17:50:43 +02:00
echo "A1"
2021-05-03 14:00:01 +02:00
fi
2021-05-03 17:50:43 +02:00
echo "B"
2021-05-03 14:00:01 +02:00
if [ "${setPasswordC}" == "1" ]; then
passwordinfo = "${passwordinfo}, C"
2021-05-03 17:50:43 +02:00
echo "B1"
2021-05-03 14:00:01 +02:00
fi
2021-05-03 17:50:43 +02:00
echo "${passwordinfo}"
sleep 3
2021-05-03 14:00:01 +02:00
# if passwords are set in a migration situation, use different info text
if [ "${migrationOS}" == "" ]; then
2021-05-03 17:50:43 +02:00
# info text on normal setup
dialog --backtitle "RaspiBlitz - Setup" --msgbox "RaspiBlitz uses 3 different passwords.
2021-05-03 14:00:01 +02:00
Referenced as password A, B & C.
PASSWORD A) Main User Password (SSH & WebUI, sudo)
PASSWORD B) APP Password (Additional Apps & API)
PASSWORD C) Lightning Wallet Password for Unlock
You will need to set now Password: ${passwordinfo}
Follow Password Rule: Minimal of 8 chars,,
no spaces and only special characters - or .
Write them down & store them in a safe place.
" 16 54
else
2021-05-03 17:50:43 +02:00
# info text on migration setup
dialog --backtitle "RaspiBlitz - Migration Setup" --msgbox "You will need to set new passwords.
2021-05-03 14:00:01 +02:00
RaspiBlitz works with 3 different passwords:
PASSWORD A) Main User Password (SSH & WebUI, sudo)
PASSWORD B) APP Password (Additional Apps & API)
PASSWORD C) Lightning Wallet Password for Unlock
You will need to set now Password: ${passwordinfo}
(other passwords might stay like on your old node)
Follow Password Rules: Minimal of 8 chars,
no spaces and only special characters - or .
Write them down & store them in a safe place.
" 17 64
fi
# temp file for password results
2021-05-03 15:24:54 +02:00
_temp="/var/cache/raspiblitz/temp/.temp.tmp"
2021-05-03 14:00:01 +02:00
# PASSWORD A
if [ "${setPasswordA}" == "1" ]; then
clear
sudo /home/admin/config.scripts/blitz.setpassword.sh x "PASSWORD A - Main User Password" $_temp
password=$(sudo cat $_temp)
sudo rm $_temp
2021-05-03 17:50:43 +02:00
sudo sed -i '/^passwordA=/d' $SETUPFILE
2021-05-03 14:00:01 +02:00
echo "passwordA='${password}'" >> $SETUPFILE
2021-05-03 14:50:44 +02:00
dialog --backtitle "RaspiBlitz - Setup" --msgbox "\nThanks - Password A accepted.\n\nUse this password for future SSH or Web-Admin logins to your RaspiBlitz & for sudo commands." 11 35
2021-05-03 14:00:01 +02:00
fi
# PASSWORD B
if [ "${setPasswordB}" == "1" ]; then
clear
sudo /home/admin/config.scripts/blitz.setpassword.sh x "PASSWORD B - APP Password" $_temp
password=$(sudo cat $_temp)
sudo rm $_temp
2021-05-03 17:50:43 +02:00
sudo sed -i '/^passwordB=/d' $SETUPFILE
2021-05-03 14:00:01 +02:00
echo "passwordB='${password}'" >> $SETUPFILE
2021-05-03 14:50:44 +02:00
dialog --backtitle "RaspiBlitz - Setup" --msgbox "\nThanks - Password B accepted.\n\nUse this password as login for\nadditial Apps & API access." 10 34
2021-05-03 14:00:01 +02:00
fi
# PASSWORD C
if [ "${setPasswordC}" == "1" ]; then
clear
sudo /home/admin/config.scripts/blitz.setpassword.sh x "PASSWORD C - Lightning Wallet Password" $_temp
password=$(sudo cat $_temp)
sudo rm $_temp
2021-05-03 17:50:43 +02:00
sudo sed -i '/^passwordC=/d' $SETUPFILE
2021-05-03 14:00:01 +02:00
echo "passwordC='${password}'" >> $SETUPFILE
2021-05-03 14:50:44 +02:00
dialog --backtitle "RaspiBlitz - Setup" --msgbox "\nThanks - Password C accepted.\n\nAlways use this password to \nunlock your Lightning Wallet." 10 34
2021-05-03 14:00:01 +02:00
fi
# debug info
clear
echo "# data from dialogs stored in to be further processed:"
echo "${SETUPFILE}"
exit 0