Proxmox

Configure Proxmox 5.2 mail notifications using a relay mail account

Proxmox logo

Proxmox is a good solution for small  bussines, you will get an hypervisor with scheduled backups.
In some costumers we found problems receiving backup notifications, because isp network is blacklisted, proxmox server domain name is not well configured, trafict through port 25 is filtered and hundreds of small problems

In this cases the faster solution is configure Proxmox postfix server to relay all messages using a valid account. These are the steps

1.- Install required  packages


apt-get install libsasl2-modules mailutils

2.- Configure relay account


vi /etc/postfix/sasl_passwd

this file should content a record following  this template


[mailserver]:port username:password

for example


[mailserver.smallbutgoodcompany.com]:587 proxmoxrelay:2Z679gF*E!$GgL=a

3.- Create a hash from sasl_passwd file


postmap /etc/postfix/sasl_passwd

this command will a create a file called

/etc/postfix/sasl_passwd.db

4.- Secure your sasl_passwd files


chown root:root /etc/postfix/sasl_passwd*

chmod 0600 /etc/postfix/sasl_passwd*

5.- Configure postfix to use relay account


vi /etc/postfix/main.cf

attach these lines to your config file


relayhost = [mailserver.smallbutgoodcompany.com]:587
# enable SASL authentication
smtp_sasl_auth_enable = yes
# disallow methods that allow anonymous authentication.
smtp_sasl_security_options = noanonymous
# where to find sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# Enable STARTTLS encryption
smtp_use_tls = yes
# where to find CA certificates
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

and remove the line that puts

relayhost =

6.- Restart postfix


systemctl restart postfix

7.- Test your new configuration


mail -s "Test Subject" email@domain.com < /dev/null

 

References:

https://www.linode.com/docs/email/postfix/postfix-smtp-debian7/

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.