You can also use this configuration as a mail gateway in front of Microsoft Exchange servers if you have concerns with putting Exchange's SMTP port "on the Internet."
Here's how to set it up:
- Buy an OpenBSD CD.
- Install OpenBSD 3.6.
- Install Clam AV 0.83.
- Install SpamAssassin 3.02.
- Configure SpamAssassin for site-wide use with SpamAssassin's spamd.
- Edit sendmail's access table, /etc/mail/access, and add "domain.name RELAY" for each domain you want to relay.
- Edit sendmail's mailertable, /etc/mail/mailertable, and add "domain.name esmtp:[ip.address]" for each domain you want to relay that is not local to your OpenBSD server.
- Create the database maps for access and mailertable:
sudo makemap hash /etc/mail/access < /etc/mail/access
sudo makemap hash /etc/mail/mailertable < /etc/mail/mailertable
- Add the following two lines to your /etc/rc.conf.local:
- Assuming this box is not a firewall (meaning that you're not contending with other rules), create a new /etc/pf.conf with the following in it:
table <spamd> persist
table <spamd-white> persist
rdr pass on !lo0 proto tcp from <spamd> to !lo0 port smtp -> lo0 port spamd
rdr pass on !lo0 proto tcp from !<spamd-white> to !lo0 port smtp -> lo0 port spamd
- Configure your DNS MX record to point to this server for the domains in /etc/mail/access.
- Reboot to test your startup scripts and make sure everything works.