Mac OS X Unleashed

Mac OS X Unleashed

By John Ray and William C. Ray

Activating Sendmail

Assuming that you've decided to go ahead and create a mail server, the first step is to turn on the server application itself. Mac OS X includes the Sendmail software, but it is not activated when the system first boots.

To automate Sendmail startup, open the file /etc/hostconfig in your favorite text editor. Edit the line that reads MAILSERVER=-NO- to MAILSERVER=-YES-:

##
# /etc/hostconfig
##
# This file is maintained by the system control panels
##

# Network configuration
HOSTNAME=Primal
ROUTER=-AUTOMATIC-

# Services
AFPSERVER=-YES-
APPLETALK=en0
AUTHSERVER=-NO-
AUTOCONFIG=-YES-
AUTODISKMOUNT=-REMOVABLE-
AUTOMOUNT=-YES-
CONFIGSERVER=-NO-
IPFORWARDING=-NO-
MAILSERVER=-YES-
MANAGEMENTSERVER=-NO-
NETBOOTSERVER=-NO-
NISDOMAIN=-NO-
...

Next, you must adjust the Sendmail configuration so that it doesn't detect a security error. By default, Sendmail detects any group-writable directories that contain its configuration files and fails to start if it finds even one. Because of the user and group structure in Mac OS X, if you were to change the permissions on the Sendmail configuration directories, you'd lose other administrative features. If you fail to complete this step, Sendmail will start at boot time, but will immediately quit, saving errors such as this to the /var/spool/mail.log file:

Jun 23 04:30:36 Primal sendmail[501]: NOQUEUE: SYSERR(root): /etc/mail/sendmail.cf: line

      ccc.gif
    81: fileclass: cannot open /etc/mail/local-host-names: Group writable directory
Jun 23 04:30:37 Primal sendmail[502]: NOQUEUE: SYSERR(root): /etc/mail/sendmail.cf: line

      ccc.gif
    81: fileclass: cannot open /etc/mail/local-host-names: Group writable directory

To fix the problem, open the /etc/mail/sendmail.cf and look for the line

#O DontBlameSendmail=safe

Change the line to read

O DontBlameSendmail=GroupWritableDirPathSafe

This adds the option DontBlameSendmail with flag GroupWritableDirPat h Safe. This instructs Sendmail to define group-writable directories as being safe.

You can now restart your Mac OS X computer. The Sendmail e-mail server will start. You can verify that the server is running and responding by using telnet to connect to port 25 (SMTP):

[primal:/etc/mail] root# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.ag.ohio-state.edu.
Escape character is '^]'.
220 primal.ag.ohio-state.edu ESMTP Sendmail 8.10.2/8.10.2; Mon, 25 Jun 2001 21:08:27 -0400

      ccc.gif
    (EDT)

If your connection fails, verify that you do have a DNS-registered hostname for your computer and check for error messages in the /var/log/mail.log file. The Sendmail messages are quite verbose and a great deal of help with debugging a faulty installation.

Try sending yourself a test message from a remote computer. Be sure to specify the destination as the hostname and username used on your Mac OS X machine. Incoming messages are stored in /var/spool/ <username> . Use the command-line mail utility to read the contents of your mailbox:

[primal:/etc/mail] root# mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/mail/jray": 1 message 1 new
>N  1 jray@poisontooth.com  Mon Jun 25 21:11  20/838   "Testing"

Congratulations. Your Mac OS X computer is now running an enterprise-class SMTP server.

Share ThisShare This

Informit Network