I had a great idea to install Gitlab so that I could store my repository remotely on my network and have a semi human interface to it. I was dutifully following the guide and I saw that the requirement to install postfix for email transport. Not too hard I thought, well famous last words, it was a little bit of a nightmare because I wanted to relay through my dev gmail account so oh great interwebs what guides can you provide me.. I went through 5 of them, while they were ALMOST right they didn’t quite work.
I finally figured out that the guide don’t use the correct cert, anyway below is my final working setup. This was done on Debian/Wheezy.
Postfix Setup that works
# sudo apt-get update # apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules # vim /etc/postfix/main.cf -----[ /etc/postfix/main.cf ]----- relayhost = [smtp.gmail.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_CAfile = /etc/postfix/cacert.pem smtp_use_tls = yes ---------------------------------
Copy the correct certs over to the postfix directory
# cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | tee -a /etc/postfix/cacert.pem # vim /etc/postfix/sasl_passwd
Add your password to the sasl_passsd file.
Change the security on the file and Hash the password & restart postfix
# chmod 400 /etc/postfix/sasl/sasl_passwd # postmap /etc/postfix/sasl/sasl_passwd # service postfix restart
# echo "Test mail from postfix" | mail -s "Test Postfix" firstname.lastname@example.org
All should work.. if not go and Google shit.