Getting Postfix to work on Ubuntu with Gmail
Here's what I want to do. I have an Ubuntu box (Edgy-Eft) at home, and I want to be able to send out email, and I want to use gmail as my relayhost. There are several sites online that explain bits of how to do this, and Mike Chirico's is particularly good. I used his tutorial as a starting point, but I noticed I had to do a few things differently to get it working on my own system, so I'm documenting the differences.
Differences
Disclaimer: Different about my setup is that I am using the Ubuntu packages, whereas Chirico's tutorial has you compile the packages yourself. There's nothing wrong with doing that, in fact, it's probably good for your soul, but I'd prefer to make use of the Ubuntu package manager as much as possible. Further, I'm not interested in using fetchmail, so I've done nothing with that.
Installing Postfix
The first thing I did was install postfix.
I told the configuration script that I was installing for an internet site. Happily, debian/ubuntu's postfix comes with TLS and SASL compiled in.# apt-get install postfix
Generate Your Certificates
In order to connect to gmail, you need a certificate. Here's what happened when I generated my certificate.Now generate a private key...# /usr/lib/ssl/misc/CA.pl -newca
And sign it...# openssl req -new -nodes -subj '/CN=prancingtarantula.net/O=Prancing Tarantula/C=US/ST=Illinois/L=Chicago/emailAddress=mattoxbeckman@gmail.com' -keyout FOO-key.pem -out FOO-req.pem -days 3650
Now I copied them to the /etc/postfix directory.# openssl ca -out FOO-cert.pem -infiles FOO-req.pem
One difference from the tutorial: when running postfix, you may get warnings like this one:# cp demoCA/cacert.pem FOO-key.pem FOO-cert.pem /etc/postfix
# chmod 644 /etc/postfix/FOO-cert.pem /etc/postfix/cacert.pem
# chmod 400 /etc/postfix/FOO-key.pem
Jan 4 17:21:59 calvin postfix/smtp[28881]: setting up TLS connection to smtp.gmail.comI've copied them in so people searching for them will find this. These warnings are because postfix doesn't know where to find the Thawte certificate that gmail used to sign its own certificate. Ubuntu includes it in its ssl package. You need to append it to the cacert.pem file you generated earlier.
Jan 4 17:21:59 calvin postfix/smtp[28881]: certificate verification failed for
smtp.gmail.com: num=20:unable to get local issuer certificate
Jan 4 17:21:59 calvin postfix/smtp[28881]: SSL_connect error to smtp.gmail.com: -1
cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem >> cacert.pem
Transport
To cause the mail to be routed, you need a transport file. Here's mine:Different from the tutorial is the specification of port 587. If you leave that off, postfix will attempt to connect to port 25, which is blocked by many ISPs now. If you get a timeout error in your log file, that's what's happening. The Gmail help pages say you should be able to use port 465 also, but that times out for me as well. You'll have to add another line if you expect to receive mail at your machine.# Contents of /etc/postfix/transport
#
# This sends mail to Gmail
* smtp:[smtp.gmail.com]:587
SASL
You now need to set the SASL passwords. My file looks like this one:Of course, replace password and the email address with something appropriate for your system. Again, note the 587... if you leave that off, you will get very confusing log messages like this one:# Contents of sasl_passwd
#
[smtp.gmail.com]:587 mattoxbeckman@gmail.com:password
Jan 4 18:20:30 calvin postfix/smtp[31770]: 49D438A6F: to=This will be very frustrating because you will see the passwords are there, but they just aren't being used. Be sure to hash the files:, orig_to= ,
relay=smtp.gmail.com[64.233.163.109]:587, delay=7661, delays=7660/0.1/0.19/0.03,
dsn=5.5.1, status=bounced (host smtp.gmail.com[64.233.163.109] said: 530 5.5.1
Authentication Required 16sm56842404nzo (in reply to MAIL FROM command))
# postmap sasl_passwd
# postmap transport
8 comentarios:
Hola gracias por el fantastico tutorial pero tengo un paso que no puedo seguir cuando hago
cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem >> cacert.pem
me dice que ese archivo no existe me he ido a la ruta y es cierto que no existe
Alguna ayuda?tENGO ubuntu 7.1
fijate con "apt-cache search ssl" si te aparece algo que te pueda estar faltando instalar, en este momento estoy el el trabajo y no tengo un Ubuntu instalado como para darte una mano.
Saludos.
I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!
Sorry for offtopic
I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!
Sorry for offtopic
Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!
Could not find a suitable section so I written here, how to become a moderator for your forum, that need for this?
[url=http://platinconne.freehostia.com/map.html]free movies download[/url] parampampam!
Publicar un comentario