<abstract>A comprehensive guide to installing, configuring, and running Cyrus Imap and Cyrus
Sasl
</abstract>
<toc>
<sect>About this HOWTO
<sect1>Copyrights and Trademarks
<p>(c) 2000 Aurora Skarra-Gallagher</p>
<p>This section was copied from the HOWTO-HOWTO:</p>
<p>This manual may be reproduced in whole or in part, without fee, subject to the following restrictions: </p>
<p><itemize>
<item>The copyright notice above and this permission notice must be preserved complete on all complete or partial copies
<item>Any translation or derived work must be approved by the author in writing before distribution.
<item>If you distribute this work in part, instructions for obtaining the complete version of this manual must be included, and a means for obtaining a complete version provided.
<item>Small portions may be reproduced as illustrations for reviews or quotes in other works without this permission notice if proper citation is given. Exceptions to these rules may be granted for academic purposes: Write to the author and ask. These restrictions are here to protect us as authors, not to restrict you as learners and educators. Any source code (aside from the SGML this document was written in) in this document is placed under the GNU General Public License, available via anonymous FTP from the GNU archive.
</itemize></p>
<sect1>Feedback
<p>Comments (especially corrections) can be sent to
<item>v1.2: SASL Config error fix, new postfix configuration, and database pruning (thanks, Jernej)
<item>v1.1: Fixed sendmail.mc configuration file error and added IMAP information to the introduction.
</itemize></p>
<sect1>Document Conventions
<p><itemize>
<item><em>Italics</em> signifies a directory
<item><tt>This font</tt> signifies instructions to be ran at the command line
</itemize></p>
<sect>Introduction to IMAP
<sect1>What is IMAP?
<p>This definition is from the <url url="http://www.computeruser.com/resources/dictionary/dictionary.html" name="ComputerUser.com High-Tech Dictionary">:</p>
<p>Internet Message Access Protocol. A protocol that allows a user to perform certain electronic mail functions on a remote server rather than on a local computer. Through IMAP the user can create, delete, or rename mailboxes; get new messages; delete messages; and perform search functions on mail. A separate protocol is required for sending mail. Also called Internet Mail Access Protocol.</p>
<sect1>IMAP vs. POP
<p>IMAP allows the user to read email from many different locations and accounts because email folders are stored on the server, locally, at the home or the office, for instance. Even saved and read messages are stored on the IMAP server. POP only stores new unread messages on the server, and the read and saved messages are stored locally. To force POP to not delete email once it has been read can create many copies of the same email, creating a waste of space and confusion. However, IMAP is usually more complicated to set up. If you only have one email account, POP is most likely your best choice. If you want to access more than one account, from different locations, IMAP will probably serve you most efficiently. </p>
<sect1>Cyrus IMAP vs. Washington IMAP
<p>Cyrus has its own mailbox database which is standalone and increases performance, whereas Washington uses the stanard UNIX mailbox format, which was designed for a smaller set of users. Washington is portable to more UNIX and non-UNIX systems than Cyrus. The main difference is that with Cyrus, you don't have to add new users to your linux box (i.e. in /etc/passwd) to add new mail users, and with Washington, you do.</p>
<p>This is the default method of authentication. It stores usernames and passwords in the SASL secrets file <em>sasldb</em>. In this HOWTO, I assume you are using the sasldb method of authentication.</p>
<sect1>LDAP
<p>The following definition came from the OpenLDAP website. Lightweight Directory Access Protocol (LDAP) is an open-standard protocol for accessing information services. The protocol runs over Internet transport protocols, such as TCP, and can be used to access stand-alone directory servers or X.500 directories. This method isn't discussed in this HOWTO, but here is a link to a page with patches and info:</p>
<item>Edit <em>/etc/sendmail.mc</em> with care not to add extra spaces and add the following lines(do not copy and paste directly from this text as the tabs won't be added correctly):
<verb> MAILER(local)
MAILER(cyrus)
define(`confLOCAL_MAILER',`cyrus')
LOCAL_RULE_0
R$=N $: $#local $: $1
R$=N < @ $=w . > $: $#local $: $1
Rbb + $+ < @ $=w . > $#cyrusbb $: $1</verb>
Use tabs to separate the data (i.e. R$=N has three tabs between it and $: $#local $: $1)
Then run:
<tt>m4 sendmail.mc > sendmail.cf</tt>
<item>Edit <em>/etc/group</em> and add the user daemon to the mail group.
</enum></p>
<sect1>If you use postfix instead of sendmail
<p>Postfix is a mail-deliver alternative to sendmail. Most linux installations use sendmail by default. If you use postfix, ignore configuration #3 from the last section and uncomment or add the following line in <em>/etc/postfix/master.cf</em></p>
<p><verb>cyrus unix - n n - - pipe flags=R user=cyrus argv=/usr/sbin/cyrdeliver -e -m ${extension} ${user}</verb></p>
<p>Also add or uncomment this line in <em>/etc/postfix/main.cf</em></p>
<p><tt>local_transport = cyrus</tt></p>
<sect> Cyrus IMAP Implementation
<sect1>Add the cyrus administrator
<p>Run the following command to set up a user for cyrus</p>
<p><tt>/usr/local/sbin/saslpasswd cyrus</tt></p>
<sect1>Testing Cyrus IMAP
<p><enum>
<item><tt>killall -HUP inetd</tt>
<item><tt>su cyrus</tt>
<item><tt>imtest -m login -p imap localhost</tt>
</enum></p>
<p>Enter your password. If you see something like: </p>
<p><verb> (L01 OK User logged in means you're in)</verb></p>
<p>Then the setup has been successful. Type </p>
<p><verb> . logout</verb></p>
<p>to log out. </p>
<sect1>Setting up users
<p>Still as the user cyrus, type the following commands. They will set up the
mailbox(es) for each user. Fill in the username where you see the (username).</p>
<p>Now as root, enter a password for each username</p>
<p><tt>saslpasswd (username)</tt></p>
<sect1>Delivery database pruning
<p>If you don't periodically prune the database of deliveries, you can fill up your file system. Adding a cron job which will run once a day is one way to do this. That involves going to <em>/etc/cron.daily</em> and creating a file named cyrus-imapd. Inside that file, put the following two lines of code:</p>
<p><verb>#!/bin/bash
su cyrus -s /bin/bash -c '/usr/cyrus/bin/deliver -E 3'</verb></p>
<p>Make this script executable by running: <tt>chmod 755 cyrus-imapd</tt></p>
<p>You should also create the deliverdb directory to store database files in: </p>
<p><tt>mkdir /var/imap/deliverdb</tt></p>
<sect1> Finishing up
<p>Reboot the machine to make sure that everything has been restarted under the new
configuration</p>
<sect>Troubleshooting
<p>If you encounter any errors, you can do the following to view error messages:</p>