Mac OS X Server 10.1.3 or later offers a Restricted SMTP Relay feature for Apple Mail Server. This document describes how to set it up.
Note: This document describes versions 10.1.3 and 10.1.4. The procedure is different for versions 10.2 and later.
Steps to set up Restricted SMTP Relay
Important:
Follow these steps to set up Restricted SMTP Relay:
This completes the steps to configure the Restrict SMTP Relay feature. If you need to modify the list of hosts, the procedure can be repeated.
What Restricted SMTP Relay does
Once relay lists have been created and enabled, the Mail Server loads them into a local cache for verification against all incoming SMTP connections. All connections are checked against this list for remote mail delivery regardless of the originating "mail from:" value. Any user who attempts to relay mail from a host not in the approved list will have the message rejected by the server. A user wishing to relay mail from a non-approved host may do so by authenticating via SMTP AUTH (see "Additional Information" below). If you want to assure that your local email users are authenticated when they send email, you can enable the SMTP Authentication ("SMTP AUTH") feature.
The Mail Server reads and processes the open_relay_addr settings in Directory Services when it starts up or after receiving a HUP signal, on the first SMTP session. The ".Server.log" file notes the IP addresses or ranges and the host and domain names added to the valid relay list. Host names that cannot be resolved or malformed address ranges are not added to the relay list. Such a complication would also be noted in the log.
Example values for the host list
A variety of notations can be used for each entry in the open_relay_addr_list. Valid examples include:
Advanced Administrators Only
When it starts up, Apple Mail Server creates attributes in local NetInfo that control the behavior of the Restricted SMTP Relay and SMTP AUTH features. You can edit these values in the Terminal with the niutil command.
1. To view default settings, execute this command as root:
niutil -read . /config/AppleMailServer
The resulting output:
name: AppleMailServer
smtp_plain_login_flag: 0
open_relay_addr_flag: 0
open_relay_addr_list: 17.221.41.168
The IP address is the address of the computer on which Apple Mail Server is running. You can enable the Restrict SMTP Relay feature with the following command:
niutil -createprop . /config/AppleMailServer open_relay_addr_flag 1
2. Deselect the checkbox for the "Deliver mail to local addresses only (no SMTP relay)" in the Configure Host Settings window in the Server Admin application (Figure 4). This cannot be achieved from the Terminal.
3. These NetInfo settings take effect when a HUP signal is received by the MailService process. To send the HUP signal:
kill -HUP `ps auxc | grep MailService | awk '{print $2}'`
Additional information
For additional information on this subject, see technical documents:
106760: "Mac OS X Server: How to Set up SMTP Authentication"
106761: "Mac OS X Server: About SMTP Authentication for Apple Mail Server"