PVE 邮件通知
https://technotim.live/posts/proxmox-alerts/
Configuring Alerts
install dependencies
1
2
apt update
apt install -y libsasl2-modules mailutils
Configure app passwords on your Google account
https://myaccount.google.com/apppasswords
Configure postfix
1
echo "smtp.gmail.com your-email@gmail.com:YourAppPassword" > /etc/postfix/sasl_passwd
update permissions
1
chmod 600 /etc/postfix/sasl_passwd
hash the file
1
postmap hash:/etc/postfix/sasl_passwd
check to to be sure the db file was created
1
cat /etc/postfix/sasl_passwd.db
edit postfix config
1
nano /etc/postfix/main.cf
1
2
3
4
5
6
7
8
9
10
# google mail configuration
relayhost = smtp.gmail.com:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/Entrust_Root_Certification_Authority.pem
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_tls_session_cache
smtp_tls_session_cache_timeout = 3600s
reload postfix
1
postfix reload
send a test email
1
echo "This is a test message sent from postfix on my Proxmox Server" | mail -s "Test Email from Proxmox" your-email@gmail.com
fix from name in email
install dependency
1
2
apt update
apt install postfix-pcre
edit config
1
nano /etc/postfix/smtp_header_checks
add the following text
1
/^From:.*/ REPLACE From: pve1-alert <pve1-alert@something.com>
hash the file
1
postmap hash:/etc/postfix/smtp_header_checks
check the contents of the file
1
cat /etc/postfix/smtp_header_checks.db
add the module to our postfix config
1
nano /etc/postfix/main.cf
add to the end of the file
1
smtp_header_checks = pcre:/etc/postfix/smtp_header_checks
reload postfix service
1
postfix reload
评论
发表评论