Courier-IMAP

#

Copyright 1999-2003, Double Precision, Inc. This software is distributed under the terms of the GNU General Public License. See COPYING for additional information.

Courier-IMAP is a server that provides IMAP access to Maildirs. This IMAP server does NOT handle traditional mailbox files (`/var/spool/mail`, and derivatives), it was written for the specific purpose of providing IMAP access to Maildirs.

"Maildir" is a directory-based mail storage format originally introduced in the Qmail mail server, and adopted as an alternative mail storage format by both Exim and Postfix. Courier-IMAP is popular on Qmail/Exim/Postfix sites that are configured to use maildirs. The primary advantage of maildirs is that multiple applications can access the same Maildir simultaneously without requiring any kind of locking whatsoever. It is a faster and more efficient way to store mail. It works particularly well over NFS, which has a long history of locking-related woes.

This is the same IMAP server that's included in the Courier mail server, but configured as a standalone IMAP server that can be used with other mail servers - such as Qmail, Exim, or Postfix - that deliver to maildirs. If you already have Courier installed, you do not need to download this version. If you install this version, you must remove it if you later install the entire Courier server. It's possible to have both versions installed, but this will require a delicate juggling act that you'll have to learn on your own.

Courier-IMAP implements several extensions to the basic Maildir mail storage format in order to support some additional features, such as folders and "soft" quotas. This is done in a way that's backwards compatible with the standard Maildir users (although, of course, they will ignore the additional features). Other software that understands and uses the same Maildir extensions is SqWebMail, and maildrop.

## Features

- Extremely small footprint. On x86, Courier-IMAP's main daemon is a fraction of the size of the UW-IMAP server, and has a greatly reduced memory footprint.
- Abstract authentication modules. Authentication of login userid and password is wrapped up into a completely stand-alone module. Several modules are provided to authenticate using the traditional password/shadow files, via the PAM library, from a table on a MySQL server, from a table on a PostgreSQL server, or from an LDAP server (requires MySQL or OpenLDAP). You can also write your own custom userid/password validation program. A "custom" authentication module is included, which authenticates absolutely nothing. Add your own code to it in order to implement a site-specific authentication mechanism.
- Virtual mailboxes. The userdb authentication module uses either a GBDM or DB database to map arbitrary userids to maildirs. Perl scripts are included to manage this database. There's also an authentication module that implements the vpopmail virtual mailbox implementation.
- Ability to restrict the maximum number of IMAP logins, and the maximum number of logins from the same IP address. This will prevent denial-of-service attacks where the attacker attempts to overload the server with multiple login connections.
- Shared folders. With additional server-side setup, folders can be shared between groups of accounts.
- IMAP over SSL. If `OpenSSL` is installed, Courier-IMAP will, optionally, accept IMAP connections over SSL. The IMAP STARTTLS extension is also implemented.
- IPv6 support, if available.
- IMAP extensions that implement server-side sorting. This can be optionally disabled in environments that have limited resources.
- Courier-IMAP implements many popular IMAP protocol extensions that provide value-added functionality with most popular IMAP clients.
- Optional support for sorting and searching in non-English character sets. Non-English character set tables are optional, and will not take up any additional overhead unless they are specifically included. Download the source code to obtain a list of currently supported character sets.
- A compatible POP3 server is also included in the Courier-IMAP package, that uses the same authentication modules. The POP3 server can only access the INBOX, and cannot access any folders.

The overall design goal of Courier-IMAP is to provide IMAP services to maildirs with the least amount of resources. For this reason there are many parameters that can be tuned during initial configuration and at runtime. Unwanted components can be removed completely, and they will not take up any resources. Few sites need the ability to search messages in twenty different character sets, so there's no need to waste memory storing large character set mapping tables. Sites that need multilingual searching and sorting abilities can selectively choose which character set tables will be supported by the server, individually. If SSL support is needed, it is available. If not, the SSL wrapper does not have to be installed at all. If the server does not have the sufficient resources to sort large folders, the server-based IMAP sorting function can be turned off.

## Installing

Please read `INSTALL` before installing or upgrading Courier-IMAP.

## SMAP

Starting with Courier-IMAP 2.0, the server supports an experimental mail access protocol, dubbed "Simple Mail Access Protocol". SMAP is an experiment to provide enhanced mail processing beyond what's currently possible with IMAP. SMAP's purpose is to prototype and develop advanced mail access functionality that's not possible with IMAP. Specifically:

- SMAP requires approximately 25% less bandwidth than IMAP to download large MIME attachments through low-bandwidth links. SMAP servers unwrap base64-encoded MIME attachments and send the raw, binary content to the client, eliminating the 25% base64 penalty. A similar optimization is also defined by an unofficial IMAP extension, but it is also a fairly new extension, and does not have wide client/server support.
- SMAP allows a single transaction to save a new message in the "Sent" folder, and mail it to its designated recipients. IMAP clients need to transmit the message a second time, using SMTP, requiring twice as much bandwidth and time as SMAP to do the same thing.
- SMAP folder names use the full UTF-8 character set; unlike IMAP no restrictions are placed on which characters may be included in folder names.
- SMAP implements both the "mark/expunge" paradigm as IMAP, and a simpler "delete" process.
- An SMAP client does not need to download the entire index of folder's contents when reopening a previously seen folder. When reopening a folder, the client receives a much shorter list of changes to the folder's contents since the last time the client had the folder opened. This is done by the client and server saving an index of folder's contents. After reopening the folder the server only needs to send a list of changes between the saved folder index, and the current folder index.
- Additional internationalization features are included in the design (but not yet used by the Courier implementation

SMAP is disabled by default. Uncomment the `SMAP_CAPABILITY` setting in the `imapd` configuration file in order to enable SMAP. The Cone mail client supports SMAP.

## Download

Download Courier-IMAP from `http://www.courier-mta.org/download.php#imap`

## CVS Repository

The source code of the standalone Courier-IMAP version is also available from an anonymous CVS repository. See `http://courier.sourceforge.net/status.html` for more information.

## Mailing list

Subscribe to the courier-imap mailing list from `http://lists.sourceforge.net/mailman/listinfo/courier-imap`, or send a message to `<courier-imap-request``@lists.sourceforge.net>` and put "subscribe" in the subject line.

This mailing list does not accept mail from non-subscribers. You must subscribe to the list before sending any messages.

### RPM installation notes

It is possible to create binary RPM packages directly from the source code tarball. A source RPM is not required. RPM 3.0.3 or higher is required. IMPORTANT: even though building an RPM saves you the headaches of manually compiling the code, you should still read the INSTALL file as it contains many important details you need to know.

Just as the source cannot be compiled by root, the Courier-IMAP RPMs cannot be built as root either. However, by default, RPM is not configured to be used for building software as a non-root user. It will be necessary to make some minor changes to the RPM configuration to enable building as a non-root user. See the FAQ for more information.

To build a binary RPM package, enter:

    rpm -ta courier-imap-3.0.4.tar.bz2

or

    rpmbuild -ta courier-imap-3.0.4.tar.bz2   # For RPM 4.1 (Red Hat 8.0+)

This builds the following packages:

> - `courier-imap` - the base package.
> - `courier-imap-ldap` - subpackage that includes support for authenticating from an LDAP directory.
> - `courier-imap-mysql` - subpackage that includes support for authenticating from a MySQL database.
> - `courier-imap-pgsql` - subpackage that includes support for authenticating from a PostgreSQL database.

The INSTALL file in the Courier-IMAP package contains additional information about LDAP, PostgreSQL and MySQL authentication. If the build system does not have the required libraries (see INSTALL for a list of requirements), these subpackages will be empty.

NOTE: The binary RPM will not install if you use a PAM library and have another IMAP or a POP3 server installed. The binary RPM installs its own `/etc/pam.d/imap` and `/etc/pam.d/pop3` configuration files, which are likely to conflict with the PAM configuration file from another IMAP or POP3 server. If you previously installed another IMAP or a POP3 server without using RPM, Courier-IMAP will successfully install and immediately overwrite your existing `/etc/pam.d/imap` and `/etc/pam.d/pop3` files.

On systems that use `inetd` (such as Red Hat 6.2 or earlier), you will also have to manually delete the `imap` and `pop-3` entries from `/etc/inetd.conf` as well. Courier-IMAP listens for client connections by itself. It doesn't need `inetd`, and you need to tell `inetd` to release that port.

On systems that use `xinetd` (such as Red Hat 7.0 and later), any `xinetd` entries for `imap` and `pop3` ports must be disabled.

If the default options in the RPM build need to be changed, proceed as follows:

Copy `courier-imap-3.0.4.tar.gz` to your `%{_topdir}/SOURCES` directory, extract the file `courier-imap.spec`, then copy it to your `%{_topdir}/SPECS` directory. Make your custom changes to the `spec` file, then run "`rpm -bb courier-imap.spec`".

Also - if you are upgrading from the 0.14 or 0.15 RPMs, you may have to run the following command after upgrading from 0.14 or 0.15: `/sbin/chkconfig --add courier-imap`.

## Documentation

The following documentation is included in the Courier-IMAP distribution. It is presented here for your convenience.

- README: Installation and some general documentation
- FAQ: Frequently Asked Questions
- README.imap: Hints on configuring IMAP clients
- authlib: Documentation on the authentication library used by Courier-IMAP. You want to read this if you would like to write your own authentication modules.
- README.maildirquota: Enhancements by Courier-IMAP to the traditional Maildir format, and README.sharedfolders: How Courier-IMAP implements shared folders. These documents describe how Courier-IMAP implements various features that are not a part of the traditional maildir mailbox.
- BUGS: known bugs.

## Links

The book Postfix talks about configuring the Postfix mail server to deliver to Maildirs, for Courier-IMAP.

Step-by-step instructions w/ screenshots for getting Mozilla 1.2.1, Outlook 2000, and Outlook Express 6 to work with Courier-IMAP.

Courier-IMAP + Maildrop + QMail with Virtual Domains HOWTO - self explanatory.

Install and Test Qmail with POP, IMAP and WebMail - a step by step tutorial on setting up a turn-key mail server.

http://www.gallowglass.org - how to setup your own private CA and then generate signed SSL certs for POP and IMAP over SSL.

Qmail FreeBSD toaster - another step by step tutorial, this one is based on FreeBSD.

Qmail VMailMgr and Courier-IMAP HOWTO - extensive documentation on integrating Courier-IMAP with the Qmail mail server and the VMailMgr virtual domain manager.

A patch to use DRAC with Courier-IMAP is available at http://aelyn.hell-city.org/courier-imap-popd-drac.patch.

SecurityFocus's article titled "Clear Text Communication: Slaying the Beast Part II" talks about general issues concerning E-mail and security. Courier-IMAP is briefly mentioned in this article.

A patch that logs additional accounting information to syslog: ftp://ftp.aerasec.de/pub/linux/courier-imap/.

Sam Varshavchik `<mrsam@courier-mta.com>`