Thursday, November 12, 2009

Gotcha Of The Day: Getting Postfix and Google Apps to play nice

Here's the situation I was in: I had a Linux box running postfix sitting on domain foo.com. I wanted to setup Google Apps to handle mail for the domain, rather than the Postfix and the other standard Unix tools.

Once I changed the MX address for foo.com, the public's e-mail was routed correctly to Google Apps.

But, e-mail sent from the foo.com server itself was being handled locally, as postfix didn't bother checking the MX server and such.

I looked around, and found a variety of Google Apps + Postfix solutions, but none seemed to do quite what I wanted. It doesn't help that I'm not exactly sure I know what I want.

The solution I arrived at does have the value of being simple - though I'm not entirely confident about it. I went into my /etc/postfix/main.cf and changed:

 mydestination = $myhostname, localhost.$mydomain, localhost

To:

 mydestination = localhost

In other words, I told the postfix mail server that messages sent to bob@foo.com weren't his to handle.

The result is that messages are properly routed to Google Apps instead of being dealt with by the local postfix install.

My big concern, of course, is SPAM. The postfix server is sending outgoing mail, and I'm concerned that it's not MX handler that's doing it. I did get a bit of a warm and fuzzy feeling because I see messages sent by postfix had the headers:

Received-SPF: pass (google.com: domain of bob@foo.com designates x.y.z.k as permitted sender) client-ip=x.y.z.k;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of bob@foo.com designates x.y.z.k as permitted sender) smtp.mail=bob@foo.com

It looks like I'll be keeping a close eye on the mail log to ensure that mail's being routed just like I hope.

If you've got an opinion on this solution - good or bad - I'd sure love to hear it.

No comments:

Post a Comment