Update build.func

Mask passwords
Closes https://github.com/tteck/Proxmox/issues/3103
This commit is contained in:
tteckster 2024-05-31 16:00:33 -04:00 committed by GitHub
parent 37f42468ba
commit fc9dff220b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 4 deletions

View File

@ -232,16 +232,24 @@ advanced_settings() {
done done
while true; do while true; do
if PW1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD(leave blank for automatic login)" 3>&1 1>&2 2>&3); then if PW1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD (leave blank for automatic login)" 3>&1 1>&2 2>&3); then
if [[ ! -z "$PW1" ]]; then if [[ ! -z "$PW1" ]]; then
if [[ "$PW1" == *" "* ]]; then if [[ "$PW1" == *" "* ]]; then
whiptail --msgbox "Password cannot contain spaces. Please try again." 8 58 whiptail --msgbox "Password cannot contain spaces. Please try again." 8 58
elif [ ${#PW1} -lt 5 ]; then elif [ ${#PW1} -lt 5 ]; then
whiptail --msgbox "Password must be at least 5 characters long. Please try again." 8 58 whiptail --msgbox "Password must be at least 5 characters long. Please try again." 8 58
else else
PW="-password $PW1" if PW2=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "\nVerify Root Password" 9 58 --title "PASSWORD VERIFICATION" 3>&1 1>&2 2>&3); then
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" if [[ "$PW1" == "$PW2" ]]; then
break PW="-password $PW1"
echo -e "${DGN}Using Root Password: ${BGN}********${CL}"
break
else
whiptail --msgbox "Passwords do not match. Please try again." 8 58
fi
else
exit-script
fi
fi fi
else else
PW1="Automatic Login" PW1="Automatic Login"