Wednesday 11 April 2012

Getting Mac OS X to use google apps as a mail proxy

First of all, I have a macbook air which mails me everytime it wakes up, it's status and it's current IP.

I had this originally use my firewall at home as a mail proxy, but obviously, when am *not* at home, this doesn't work.

So what I configured is how to use google's mail server to act as my SMTP server over SSL - great huh?

I would suggest you setup a sub domain e.g. sub.domain.com so that it was it's own set of credentials and security, and doesn't use your main account (which will have admi rights for the entire domain) e.g. I own bobcats.org, and the address phil@bobcats.org, so I'll setup root@sub.bobcats.org as the subdomain and email address for my mac's admin account.

So what do you need to do?

*/ Setup postfix
*/ setup google
*/ setup DNS
*/ setup site verification (web)
*/ setup site verification (mail)
*/ Profit

Setup postfix

You'll need to setup a Simple Authentication and Security Layer (SASL)

vi /etc/postfix/sasl_passwd

with the following:
smtp.gmail.com:587 your.name@gmail.com:your.password

Create a postfix lookup table for SASL:
postmap /etc/postfix/sasl_passwd

Configure postfix with:

vi /etc/postfix/main.cf

with the following:
# Minimum Postfix-specific configurations.
mydomain_fallback = localhost
mail_owner = _postfix
setgid_group = _postdrop
relayhost=smtp.gmail.com:587
# Enable SASL authentication in the Postfix SMTP client.
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options=

# Enable Transport Layer Security (TLS), i.e. SSL.
smtp_use_tls=yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom

Setup google


This will involve going into your dashboard - just google "google apps"
add your (sub) domain into the domain tab of settings.

Setup DNS

Point DNS to a webserver that you own 

Setup site verification (web)

This will involve placing a specially crafted text file (supplied by google) onto that site


Setup site verification (mail)

This will involve adding a TXT record for the above (sub)domain

Profit

No comments:

Post a Comment