Mac OS X Server 10.2: How to Prevent Open SMTP Relay ("spam" Forwarding)

Mac OS X Server 10.2 Mail Service can be configured to prevent open SMTP relay while still allowing local users to send mail. This document explains how.
Note: If you are using Mac OS X Server 10.1.3-10.1.5, stop here and see technical document 106762, "Mac OS X Server 10.1: How to Set up Restricted SMTP Relay for Apple Mail Server".


Getting started

If you are using Mac OS X Server version 10.2 to 10.2.3, you should update to version 10.2.4 or later. Important changes have been made to the way the Mail Service handles mail. All instructions in this document assume Mac OS X Server 10.2.4 or later. By default, the Mail Service is configured not to allow open relay and not to send email to the Internet outside of your domain. It will, however, accept mail for all local users from any sender. You may follow the steps below to expand email sending capability while still preventing open relay.

Phase I: Outgoing Mail

Now the Mail Service will allow the server to send mail to the Internet. It will also allow anyone who first authenticates using the CRAM-MD5 protocol to send mail to the Internet. It will still accept mail for local users from any sender.

Phase II: Restricting Outgoing Mail by IP Address or Range

If you would like to allow your users to be able to send mail to the Internet without authenticating, follow these steps.

Now the Mail Service will allow anyone connecting from an allowed IP address to send mail to the Internet. It will also allow anyone who first authenticates using the CRAM-MD5 protocol to send mail to the Internet. It will accept mail for local users from any sender.

Phase III: Outgoing Mail From Any Authenticated User

If you would like to allow users who are NOT in the list of allowed IP address to send mail to the Internet if they authenticate using ANY method, follow these steps.

Now the Mail Service will allow anyone connecting from an allowed IP address to send mail to the Internet. It will also allow anyone who first authenticates by any method to send mail to the Internet. It will accept mail for local users from any sender.

Notes:

Warning: PLAIN and LOGIN transmit the username and password in "plain text" format and pose a security risk. If possible, clients should be encouraged to use CRAM-MD5 instead.
Published Date: Oct 11, 2016