home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


TCP/IP Network Administration

TCP/IP Network AdministrationSearch this book
Previous: 9.6 Managing Distributed Servers Chapter 9
Configuring Network Servers
Next: 9.8 Summary
 

9.7 Mail Servers

In this section we configure a system to act as a post office server. A post office server, or mailbox server, is a computer that holds mail for a client computer until the client is ready to download it for the mail reader. This service is essential to support mobile users and to support small systems that are frequently offline and thus not able to receive mail in real time. We look at two techniques for creating a mailbox server: Post Office Protocol (POP), which is the most popular protocol for this purpose, and Internet Message Access Protocol (IMAP), which is growing in popularity. We start with POP.

9.7.1 POP Server

A UNIX host turns into a POP mail server when it runs a POP daemon. Check your system's documentation to see if a POP daemon is included in the system software. If it isn't clear from the documentation, check the inetd.conf file, or try the simple telnet test from Chapter 4 . If the server responds to the telnet test, not only is the daemon available on your system, it is installed and ready to run.

% 
telnet localhost 110

Trying 127.0.0.1 ...
Connected to localhost.
Escape character is ']'.
+OK POP3 almond Server (Version 1.004) ready

quit

+OK POP3 almond Server (Version 1.001) shutdown
Connection closed by foreign host.

This example is from a Linux system, which comes with POP3 ready to run. The Solaris system, on the other hand, does not ship with POP2 or POP3. Don't worry if your system doesn't include this software. POP3 software is available from several sites on the Internet where it is stored in both the popper17.tar and the pop3d.tar files. I have used them both and they both work fine.

If you don't have POP3 on your system, download the source code. Extract it using the UNIX tar command. pop3d.tar creates a directory called pop3d under the current directory, but popper17.tar does not. If you decide to use popper, create a new directory before extracting it with tar . Edit the Makefile to configure it for your system and do a make to compile the POP3 daemon. If it compiles without errors, install the daemon in a system directory.

Most network daemons are started by the Internet daemon, inetd . POP3 is no exception. Start POP3 from inetd by placing the following in the inetd.conf file:

pop3   stream  tcp     nowait  root    /etc/pop3d              pop3d

This entry assumes you are using pop3d , that you placed the executable in the /etc directory, and that the port for this daemon is identified in the /etc/services file by the name pop3 . If these things aren't true, adjust the entry accordingly.

Make sure that POP3 is actually defined in /etc/services . If it isn't, add the following line to that file:

pop3         110/tcp              # Post Office Version 3

Once the lines are added to the services file and the inetd.conf file, send a SIGHUP to inetd to force it to read the new configuration, as in this example:

# 
ps -ef | grep inetd

  root  109  1  0   Jun 09 ?   0:01 /usr/sbin/inetd -s
# 
kill -HUP 109

Now that POP3 is installed, rerun the test using telnet localhost pop-3 . If the POP3 daemon answers, you're in business. All users who have a valid user account on the system are now able to download mail via POP3 or read the mail directly on the server.

9.7.2 IMAP Server

Internet Message Access Protocol (IMAP) is an alternative to POP. It provides the same basic service as POP and adds features to support mailbox synchronization. Mailbox synchronization is the ability to read mail on a client or directly on the server while keeping the mailboxes on both systems completely up-to-date. On an average POP server, the entire contents of the mailbox are moved to the client and either deleted from the server or retained as if never read. Deletion of individual messages on the client is not reflected on the server because all of the messages are treated as a single unit that is either deleted or retained after the initial transfer of data to the client. IMAP provides the ability to manipulate individual messages on either the client or the server and to have those changes reflected in the mailboxes of both systems.

IMAP is not a new protocol - it is about as old as POP3. Nor is IMAP completely standardized. There have been four distinct versions of IMAP: IMAP, IMAP2, IMAP3, and the current version IMAP4. New RFCs about IMAP are still being issued. There are currently more than 10. The fear that IMAP is still in flux and that it is difficult to implement has discouraged some vendors, so it is not as widely implemented as POP. This is changing, however. The growing importance of email as a means of communicating, even when people are out of the office, increases the need for a mailbox that can be read and maintained from anywhere. The number of IMAP implementations is rising. Sun sells one for Solaris, another comes with Slackware 96 Linux in the /usr/sbin/imapd file, and IMAP source code can be obtained via anonymous FTP from ftp.cac.washington.edu . We use the University of Washington source code to update IMAP on our Linux system for the examples in this section.

Download /mail/imap.tar.Z from ftp.cac.washington.edu as a binary image. Uncompress and untar the file. This creates a directory containing the source code and Makefile needed to build IMAP. [12] Read the Makefile carefully. It supports many versions of UNIX. If you find yours listed in the Makefile, use the three-character operating system type listed there. For our Linux system we entered:

[12] The name of the directory tells you the current release level of the software. At this writing it is imap-4.1.BETA.

# make lnx

If it compiles without error, as it does on our Linux system, it produces three daemons: ipop2d , ipop3d , and imapd . We are familiar with installing POP2 and POP3. The new one is imapd . Install it in /etc/services :

imap      143/tcp       # IMAP version 4

Also add it to /etc/inetd :

imap  stream  tcp  nowait  root  /usr/sbin/imapd  imapd

Now basic IMAP service is available to every user with an account on the server.

A nice feature of the University of Washington package is that it provides implementations of POP2 and POP3 as well as IMAP. This is important because most email clients run POP3. [13] The IMAP server can only be accessed by an IMAP client. Installing POP2 and POP3 along with IMAP gives you the chance to evaluate IMAP and to provide it for your adventurous users while still supporting the majority of users.

[13] The pine mail client supports IMAP.

POP and IMAP are mail access servers. There is a great deal more to configuring a complete email system, as we will see in the next chapter.