Cyrus-imap question

Aleksandar Milivojevic amilivojevic at pbl.ca
Mon Dec 6 15:20:18 UTC 2004


Sasa Stupar wrote:
> I am running on FC3 with Sendmail and uw-imap/pop3. I want to change to
> cyrus-imap which comes with FC3 but when I do that then I can't see my
> messages in inbox anymore with imap access. If I change back to uw then
> I can see my inbox messages. POP3 is working fine. Is there anything
> that I need to configure so that I can see my inbox?

Well, I'm preatty much new to this Cyrus thing too.  But some advice anyhow.

You need to configure your MTA properly.  For sendmail, remove 
MAILER(procmail) from sendmail.mc, and add this three lines:

define(`confLOCAL_MAILER', `cyrusv2')
define(`CYRUSV2_MAILER_ARGS', `FILE /var/lib/imap/socket/lmtp')
MAILER(`cyrusv2')

The second line is needed since Sendmail RPM defaults to different 
location than Cyrus RPM package is configured for on Fedora.  Would be 
nice if it was consolidated between Sendmail and Cyrus RPMs to default 
to same location.

If you are using Postfix, check Cyrus documentation, there's an example 
on how to do it.

The reason for this is that uw-imap and Cyrus are using different mail 
box formats.  uw-imap uses "standard" Unix mbox 
(/var/spool/mail/username) for INBOX folder, and files in user's home 
directory for all other folders (one file per folder).  Hence you need 
to have real user accounts on the machine.

Cyrus on the other hand uses one file per message and stores everything 
(INBOX folder and all other folders that you have) in /var/spool/imap 
directory.  There's also database with email indexes.  This means that 
you don't have to create Unix accounts, user's can be authenticated 
using separate user's database that can be stored in file, or be remote 
one (for example LDAP), which is good from security point of view.  Of 
course, if you want to, you can still have Unix accounts and have Cyrus 
use those to authenticate users.

To convert your old email, there are some tools out there, that I never 
had much luck with.  Basically, it is not enough to simply split your 
existing mbox and save each message to separate numbered file.  You 
would need to rebuild Cyrus database too.  Plus you probably want to 
preserve message flags when converting (read, replied, deleted, and so on).

Another possiblity is to run uw-imapd on non-standard port from inetd 
(or xinted), and than to use your favorite mail client to simply copy 
mails from uw-imapd to Cyrus.

The one problem I had with this was that uw-imapd is much more liberal 
to garbage.  Cyrus is not.  uw-imapd will accept mall-formed mail 
(containing null characters, bare newlines, and all other sorts of RFC 
violations) and it will send it to your mail client as is 
(theoretically, some of that stuff can crash badly written mail client, 
cause it not to display message correctly, or even be abused by virus to 
trick mail client into doing things it is not supposed to do).  Cyrus 
will simply refuse such kind of email.

uw-imapd is really bad about that.  It is OK that it is liberal in what 
it accepts, but it is also way too liberal in what it sends out.  This 
is very bad for security.  Cyrus will never send garbage to the client 
(as uw-imapd will), but it is not liberal in what it accepts either.

At the end, I wrote small and simple Perl script (can't find where I put 
it anymore) that connects to both uw-imapd and Cyrus and copies all 
emails using IMAP protocol (using Mail::IMAPClient module), and while 
doing so it was also doing sanity checks and was fixing corrupted emails 
before feeding them to Cyrus (most of which appeared to be either spam, 
or automatically generated mail that was close to the definition of 
spam).  The script also read message flags from each mail, and copied 
them over to Cyrus.

That way I didn't had to worry about regenerating Cyrus database, I got 
clean storage (nothing in there that Cyrus would refuse to deal with), 
and all message flags were transferred too.

-- 
Aleksandar Milivojevic <amilivojevic at pbl.ca>    Pollard Banknote Limited
Systems Administrator                           1499 Buffalo Place
Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7




More information about the fedora-list mailing list