mirror of
				https://github.com/bashclub/proxmox-zfs-postinstall.git
				synced 2025-11-04 08:32:28 +01:00 
			
		
		
		
	Add mail config dialogs
This commit is contained in:
		
							
								
								
									
										31
									
								
								postinstall
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								postinstall
									
									
									
									
									
								
							@@ -376,7 +376,34 @@ harden_ssh(){
 | 
				
			|||||||
    fi
 | 
					    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(){
 | 
					set_mail_delivery(){
 | 
				
			||||||
 | 
					    if [ $mailconfig -gt 0 ]; then
 | 
				
			||||||
        cat << EOF > /etc/postfix/main.cf
 | 
					        cat << EOF > /etc/postfix/main.cf
 | 
				
			||||||
myhostname=$(hostname -f)
 | 
					myhostname=$(hostname -f)
 | 
				
			||||||
smtpd_banner = \$myhostname ESMTP \$mail_name (Debian/GNU)
 | 
					smtpd_banner = \$myhostname ESMTP \$mail_name (Debian/GNU)
 | 
				
			||||||
@@ -430,6 +457,7 @@ EOF
 | 
				
			|||||||
        systemctl restart postfix.service
 | 
					        systemctl restart postfix.service
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pvesh set access/users/root@pam -email $recipientaddress
 | 
					        pvesh set access/users/root@pam -email $recipientaddress
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
create_swap_pool(){
 | 
					create_swap_pool(){
 | 
				
			||||||
@@ -550,6 +578,9 @@ select_pve_repos
 | 
				
			|||||||
# subscription related actions
 | 
					# subscription related actions
 | 
				
			||||||
select_subscription
 | 
					select_subscription
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# mail delivery config
 | 
				
			||||||
 | 
					ask_mail_config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
summary
 | 
					summary
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Proxmox postinstallation finished!"
 | 
					echo "Proxmox postinstallation finished!"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user