Proxmox postfix relayhost authentication error

I’ve grown to really appreciate the community version of the proxmox vitalization server, but because I’m too poor to afford the subscription version I tend to upgrade the entire server on a semi-annual basis. I do this by moving all the containers, or KVM images, to another proxmox server, then upgrade the now bare proxmox server using the updated proxmox install iso .  I then reconfigure the server to my specific needs using a bash script. One of the tasks in this script is to set up postfix’s relayhost config to allow my promox server to email via google’s smtp servers when something is wrong. It is usually pretty straight forward, but with proxmox version 4.0 (based on Debian Jessie) I got this error in /var/log/mail.log:

SASL authentication failed; cannot authenticate to server smtp.gmail.com no mechanism available

Since I had used the exact same setup/configs as my prior servers I knew something was up. A quick search of google produced the answer. I needed to run:

aptitude install libsasl2-modules

And then everything worked. Thank you HowToForge for the answer.

For those who are interested, here’s the relevant portion of my install script

#Add email forwarding
aptitude install -y libsasl2-modules #this fixed a SASL authentication failed; cannot authenticate to server smtp.gmail.com no mechanism available error
sed -i 's|relayhost =|relayhost = [smtp.gmail.com]:587|g' /etc/postfix/main.cf
sed -i 's|mynetworks = 127.0.0.0/8|mynetworks = 127.0.0.0/8, 10.X.X.X/24|g' /etc/postfix/main.cf
sed -i 's|inet_interfaces = loopback-only|inet_interfaces = all|g' /etc/postfix/main.cf
echo "smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_sasl_security_options =
mydomain= $DOMAIN
myhostname= $HOSTNAME.$DOMAIN
myorigin=$HOSTNAME.$DOMAIN" >> /etc/postfix/main.cf
#add password db for email google authentication
echo "[smtp.gmail.com]:587 me@gmail.com:"$GOOGLE_PW > /etc/postfix/sasl_passwd
chmod 400 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
#register aliases and restart postfix
echo "root:me@medengineers.com" >>/etc/aliases
newaliases
/etc/init.d/postfix restart

 

 

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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