Thursday, March 11, 2010

Setting up IMAP and SquirrelMail

I’ve always been a POP3 guy, but my circumstances are about to change – more of that in a later post.  But I’ve always known the advantages that IMAP bring to the party – keeping the message on a central server for multiple location access and archiving – and if I had to set up a new email system, I wanted to use IMAP.

SquirrelMail – the most popular Linux web email interface – runs exclusively IMAP, rather than POP3, so that would become a necessity anyway.

IMAP installation was trivial – yum install cyrus-imapd. That’s it. It adds the cyrus user, writes out a .conf file.  Just remember to set a password for cyrus.   Only gotcha I found was that the
/etc/logrotate.d/cyrus-imapd contains a /var/log/auth.log entry. If you already have one elsewhere, logrotate will fail with a duplicate file error.

Sendmail wasn’t much harder.

MAILER(local)dnl
MAILER(cyrus)dnl
define(`confLOCAL_MAILER',`cyrus')dnl
LOCAL_RULE_0
R$=N            $: $#local $: $1
R$=N < @ $=w . >        $: $#local $: $1
Rbb + $+ < @ $=w . >        $#cyrusbb $: $1

and remember that the separators before the $: above are tabs, not spaces.  Then


m4 sendmail.mc > sendmail.cf, and restart sendmail.

Start up /etc/init.d/cyrus-imapd and saslauthd, and make sure both are configured to come up when you reboot.

/etc/init.d/cyrus-imapd start
chkconfig cyrus-imapd on
/etc/init.d/saslauthd start

Next, set up a sasl password for cyrus and any users by issuing this command as root:

/usr/local/sbin/saslpasswd cyrus
/usr/local/sbin/saslpasswd tim

imtest tests your connection:

[root@kyushu init.d]# su cyrus
bash-3.2$ imtest -m login -p imap localhost
S: * OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS] kyushu.denmantire.com Cyrus IMAP4 v2.3.7-Invoca-RPM-2.3.7-7.el5_4.3 server ready
C: C01 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS ACL RIGHTS=kxte QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY SORT SORT=MODSEQ THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE CATENATE CONDSTORE IDLE LISTEXT LIST-SUBSCRIBED X-NETSCAPE URLAUTH
S: C01 OK Completed
Please enter your password:
C: L01 LOGIN cyrus {8}
S: + go ahead
C:
S: L01 OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID LOGINDISABLED ACL RIGHTS=kxte QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY SORT SORT=MODSEQ THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE CATENATE CONDSTORE IDLE LISTEXT LIST-SUBSCRIBED X-NETSCAPE URLAUTH] User logged in
Authenticated.
Security strength factor: 0
. logout
* BYE LOGOUT received
. OK Completed
Connection closed.

and set up your users:

bash-3.2$ cyradm localhost
IMAP Password:
localhost.localdomain> cm user.tim
quit


And that's it! I did a quick test by setting up an IMAP email account in Outlook - worked great. Next week, I'll set up SquirrelMail.

No comments:

Post a Comment