Add mail config dialogs

This commit is contained in:
thorstenspille 2023-10-02 18:11:32 +02:00
parent 834a870412
commit 800259bb43

View File

@ -376,7 +376,34 @@ harden_ssh(){
fi
}
ask_mail_config(){
mailconfig=0
smtpauth=0
if whiptail --title "MAIL DELIVERY" \
--backtitle "$PROG" \
--yes-button "MAIL CONFIG" \
--no-button "SKIP" \
--yesno "Do you want to configure postfix with a smarthost?" 9 76 ; then
mailconfig=1
senderaddress=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter your sender email address." 9 76 3>&1 1>&2 2>&3)
displayname=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter your sender display name." 9 76 3>&1 1>&2 2>&3)
recipientaddress=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter the email address to receive notifications." 9 76 3>&1 1>&2 2>&3)
smtphost=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter the servername of your smarthost." 9 76 3>&1 1>&2 2>&3)
smtpport=$(inputbox_int 'MAIL DELIVERY' 'Please enter the port of your smarthost' 7 25)
if whiptail --title "MAIL DELIVERY" \
--backtitle "$PROG" \
--yes-button "CONFIGURE AUTH" \
--no-button "SKIP" \
--yesno "Do you want to configure authentication against your smarthost?" 9 76 ; then
smtpauth=1
username=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter the username for authentication." 9 76 3>&1 1>&2 2>&3)
password=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --passwordbox "Please enter the passsword for authentication." 9 76 3>&1 1>&2 2>&3)
fi
fi
}
set_mail_delivery(){
if [ $mailconfig -gt 0 ]; then
cat << EOF > /etc/postfix/main.cf
myhostname=$(hostname -f)
smtpd_banner = \$myhostname ESMTP \$mail_name (Debian/GNU)
@ -430,6 +457,7 @@ EOF
systemctl restart postfix.service
pvesh set access/users/root@pam -email $recipientaddress
fi
}
create_swap_pool(){
@ -550,6 +578,9 @@ select_pve_repos
# subscription related actions
select_subscription
# mail delivery config
ask_mail_config
summary
echo "Proxmox postinstallation finished!"