Alternatives to sendmail

Alternatives to sendmail

Over the years, sendmail has grown to be enormously complex. Its complexity makes it challenging to configure if you want to set up something more than a simple mail server. Its size and complexity also add to its vulnerability. For optimal security, make sure you run the latest version of sendmail and always keep sendmail up-to-date. You might consider using one of the following alternatives.

Postfix

Postfix (postfix package) is an alternative MTA. Postfix attempts to be fast and easy to administer, while also being sendmail compatible enough to not upset sendmail users. Postfix has a good reputation for ease of use and security and is a drop-in replacement for sendmail. Documentation for Postfix can be found at www.postfix.org/docs.html.

Qmail

Qmail is a direct competitor of Postfix and has the same objectives. By default, Qmail stores email using the maildir format as opposed to the mbox format that other MTAs use (page 632). The Qmail Web site is www.qmail.org.

Chapter Summary

The sendmail daemon is an MTA (Mail Transfer Agent). When you send a message, sendmail works with other software to get it to the proper recipients. You can set up sendmail to relay email to an SMTP server that sends the email on to its ultimate destination or you can have sendmail send email directly to the SMTP servers for the domains receiving the email. By default, sendmail stores incoming messages in the mail spool directory, /var/spool/mail.

The file that controls many aspects of how sendmail works is sendmail.cf. If you edit sendmail.mc, when you restart sendmail, the sendmail init script generates sendmail.cf. The system administrator can use the /etc/aliases file and ordinary users can use ~/.forward files to reroute email to one or more local or remote addresses, to files, or as input to programs.

You can use a program such as SpamAssassin to grade and mark email as to the likelihood of it being spam. You can then decide what to do with the marked email: You can look at each piece of potential spam and decide where to put it, or you can have your MUA automatically put potential spam in a special mailbox for spam.

Other programs that can help with email include SquirrelMail, which provides Webmail services, and Mailman, which provides mailing list support.

Exercises

1.

By default, email addressed to system goes to root. How would you also save a copy in /var/logs/systemmail?

2.

How would Max store a copy of his email in ~/mbox and send a copy to max@bravo.com?

3.

If your firewall allowed only the machine with the IP address 192.168.1.1 to send email outside the network, how would you instruct your local copy of sendmail to use this server as a relay?

4.

What does dnl stand for in the m4 macro language? What are dnl commands used for?

5.

SpamAssassin is installed on your mail server, with the threshold set to an unusually low value of 3, resulting in a lot of false positives. What rule could you give to your mail client to allow it to identify spam with a score of 5 or higher?

6.

Describe the software and protocols used when Max sends an email to Sam on a remote Linux system.

Advanced Exercises

7.

Your company's current mail server runs on a commercial UNIX server, and you are planning to migrate it to Linux. After copying the configuration files across to the Linux system, you find that it does not work. What might you have forgotten to change?

8.

Assume you have a script that sends its output to standard output. How would you modify the script to send the output in an email to a user specified by the first argument on the command line? (You may assume that the data is stored in $RESULT.)

9.

Give a simple way of reading your email that does not involve the use of an MUA.

10.

If you accidentally delete the /etc/aliases file, how could you easily re-create it (assuming that you had not restarted sendmail)?