O/S: Debian Squeeze
Default MTA: exim4
For Debian machines, we configure exim4 to route email through Gmail's smtp server. This way, there is minimal change from the default system configuration, and we can forward any local mail to outside accounts via the traditional .forward files.
I found directions for this configuration on the Debian Wiki, here. They were pretty straightforward, and Debian Squeeze didn't need all the steps given.
Configure exim4
# dpkg-reconfigure exim4-config
- Choose mail sent by SMARTHOST; received via SMTP or fetchmail;
- Accept given hostname, if desired;
- Listen on loopback addresses (127.0.0.1, ::1);
- Don't accept mail for any other destinations (leave blank)
- Don't relay mail for other machines (leave blank)
- Machine handling outgoing mail for this host (smarthost): smtp.gmail.com::587
- Don't hide local mail name in outgoing mail
- Don't keep number of DNS-queries minimal
- Yes, split configuration into smaller files
# vi /etc/exim4/passwd.clientEnter the following line:*.google.com:yourAccountName@domain.com:yourReallySecurePas sword
# update-exim4.conf
If you haven't logged in to the Google Apps email account interactively, you'll probably need to do so before the account credentials will be accepted. I was watching the log file (# tail -f /var/log/exim4/mainlog) and saw the following:
2011-08-24 15:37:21 1QwKCP-0001yy-2O plain authenticator failed H=gmail-smtp-msa.l.google.com [74.125.159.109] 535-5.7.1 Username and Password not accepted. Learn more at535 5.7.1 http://mail.google.com/support/bin/answer.py?answer= e4sm1192393anb.1514257
Set up forwards
I configure our servers to forward all mail sent to local root on to a department status mailbox (which is then monitored by the tech on duty). For Linux/BSD systems, this is dead simple:
# echo "itstatus@mycompany.com" > /root/.forward
Conclusion
With a functional MTA configured, you can also integrate email notifications into shell scripts and cron jobs:
# Send SMS notification when system boots@reboot date | mail -s "`hostname` just booted" yourphonenumber@txt.att.net
For a simple notification system on a budget, this is hard to beat.
No comments:
Post a Comment