Building the IMAP Server

Building the IMAP Server

IMAP, or the Internet Message Access Protocol, provides a way for you to access your mail or Usenet newsgroups from a variety of computers. It works by storing the messages on a central server and allowing you to view copies of them. Then, when you delete a message locally, you can synchronize your mailboxes at your local workstation and the server. Also, you can have folders for your mail and full access to them, unlike with POP3.

First, having downloaded and verified the archive, you should unpack it:

$ tar -zxvf imap.tar.Z

Now, we're going to enter the newly formed directory and proceed to build the IMAP server. Because we're using Linux, the process is quite simple:

$ cd imap-2000
$ make slx
(make output omitted)

Installing the new IMAP server is also quite easy; we just drop it in place and it's almost ready to go:

# cd imapd
# cp imapd /usr/sbin/imapd

Now we have to tell the computer how to listen for imapd connections and how to handle them. First, we edit the inetd configuration file inetd.conf:

# vi /etc/inetd.conf

We will change the line that normally reads

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

to instead read

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

By removing the opening pound sign (#), it becomes a directive to inetd and not a comment.

Now we have to tell inetd to reread its configuration. We do this by sending the inetd process the HUP signal. First we get the process ID of the inetd process:

# ps -ax | grep inetd
 7699 ? S 0:00 inetd

Here, 7699 is the process ID of the inetd process. Your process ID will most certainly be different.

Now we tell inetd to reread the configuration file:

# kill -HUP 7699

Last, we will secure our inetd installation against unwanted connections. Unfortunately, a lot of hackers like to break in using the imapd service. However, we will limit connections to this server to only the local machine itself, which means that only our local Web server can connect to it. We do this using the TCP wrappers program already installed on our system. We edit two files, first the file that defines who cannot connect and then the file that lists the exceptions to that rule.

# vi /etc/hosts.deny

Then we add a line for the IMAP daemon:

imapd: ALL

Now we will edit the file that lists who is allowed to connect:

# vi /etc/hosts.allow

We then add at the end of the file the line

imapd: 127.0.0.1

That's it. The first piece of installation is done!

 



Multitool Linux. Practical Uses for Open Source Software
Multitool Linux: Practical Uses for Open Source Software
ISBN: 0201734206
EAN: 2147483647
Year: 2002
Pages: 257

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net