Setting up an IMAP server that can do IMAP4rev1
Hurry warning: this document was written in a hurry. It's development documentation, so don't expect a very high quality of it.
No time for this?
I have set up a few test IMAP servers. Check out this page for more information on that.
You can also use one of the available Virtual Machines for testing Tinymail
About
If you need a LEMONADE IMAP4 server, scroll down boy.
If you want to test tinymail's IMAP client capabilities on a IMAP4rev1 capable IMAP service, then Cyrus is a possible IMAP server that is free software and available on most distributions.
Its configuration is usually the same on all distributions. I recommend using saslauthd in shadow mode for authentication. That way you can use your users on the Linux host as authentication.
The apt-get line assumes Ubuntu Dapper or Edgy (I tried this on a Edgy system). It's quite possible that the exact same line also works on other Debian-likes. Feel free to add how you do the same using other distributions if you feel left-alone by me because I don't mention your favorite uber-cool distribution here.
Installing and configuring Cyrus
apt-get install cyrus21-imapd cyrus21-common cyrus21-admin cyrus21-clients sasl2-bin
passwd cyrus
# Feel free to do these with your favorite editor
cat /etc/imapd.conf | sed s/sasl_pwcheck_method.*/sasl_pwcheck_method:\ saslauthd/g | \
sed s/.*sasl_mech_list.*/sasl_mech_list:\ PLAIN/g | sed s/.*admins.*/admins:\ cyrus \
> /tmp/a.tmp ; mv /tmp/a.tmp /etc/imapd.conf
cat /etc/default/saslauthd | sed s/.*START.*/START=yes/g | \
sed s/.*MECHANISMS.*/MECHANISMS=\"shadow\"/g > /tmp/a.tmp; \
mv tmp/a.tmp /etc/default/saslauthd
/etc/init.d/saslauthd restart
/etc/init.d/cyrus21 restart
adduser tinymailtest
cyradm --user cyrus localhost
localhost> cm user.tinymailtest
localhost> quit
Configuring tinymail for this account
su - tinymailtest gconftool-2 -s /apps/tinymail/cache_dir -t string .tinymail gconftool-2 -s /apps/tinymail/accounts/count -t int 1 gconftool-2 -s /apps/tinymail/accounts/0/name -t string "My local cyrus IMAP4rev1" gconftool-2 -s /apps/tinymail/accounts/0/proto -t string imap gconftool-2 -s /apps/tinymail/accounts/0/type -t string store gconftool-2 -s /apps/tinymail/accounts/0/user -t string tinymailtest gconftool-2 -s /apps/tinymail/accounts/0/hostname -t string localhost
Configuring tinymail for the unit test account (this account is hosted on a Courier IMAP)
su - tinymailtest gconftool-2 -s /apps/tinymail/accounts/count -t int 2 gconftool-2 -s /apps/tinymail/accounts/1/name -t string "My remote Courier IMAP" gconftool-2 -s /apps/tinymail/accounts/1/proto -t string imap gconftool-2 -s /apps/tinymail/accounts/1/type -t string store gconftool-2 -s /apps/tinymail/accounts/1/user -t string tinymailunittest gconftool-2 -s /apps/tinymail/accounts/1/hostname -t string mail.tinymail.org
The password of that one is, by the way, unittest
Installing an IMAP server with IDLE and CONDSTORE capabilities (LEMONADE)
Installing it
- Get the "Latest testing release" of Cyrus IMAP here
Creating users
Bla bla bla. You know the drill!
useradd cyrus passwd cyrus useradd tinymailtest passwd tinymailtest
Compiling and installing (Debian testing & Ubuntu)
You can also try this pre-compiled version.
apt-get install gnome-devel libssl-dev libdb4.4-dev libdb4.4 libsasl2-dev
cd cyrus-imapd-2.3.8
LDFLAGS=-ldb ./configure --prefix=/opt/cyrus \
--with-cyrus-prefix=/opt/cyrus \
--enable-idled
make && make install
Putting the Perl stuff in the INC of Perl
ln -s /opt/cyrus/lib/perl/5.8.8/auto/ /etc/perl/ ln -s /opt/cyrus/lib/perl/5.8.8/Cyrus/ /etc/perl/ ln -s /opt/cyrus/lib/perl/5.8.8/perllocal.pod /etc/perl/
The usual installation
Creating some directories, alright?
mkdir -p /var/imap/proc /var/imap/socket \
/var/imap/db /var/spool/imap
chown cyrus /var/imap /var/imap/proc \
/var/imap/socket /var/imap/db \
/var/spool/imap
imapd.conf
It has to look like this. If you want the STARTTLS capability, you must also create a server.pem file. It didn't work for me though. The documentation says that it should work then. Great. No testing with TLS for me then.
cat /etc/imapd.conf partition-default: /var/spool/imap admins: cyrus sasl_pwcheck_method: saslauthd sasl_mech_list: PLAIN tls_cert_file: /var/imap/server.pem tls_key_file: /var/imap/server.pem
Time to start the server
/opt/cyrus/bin/idled & /opt/cyrus/bin/master
Time to create the mailbox
cd /opt/cyrus/bin ./cyradm --user cyrus localhost cm user.tinymailtest mboxconfig user.tinymailtest condstore true
Testing
Note that the real server doesn't add the \n's to the CAPABILITY line, I did that to get the PRE tag of this web page more nice.
You must see the CONDSTORE and IDLE capabilties and you must (and this is important) see the HIGHESTMODSEQ answer when you do your T01 SELECT %F (CONDSTORE).
root@lort:/var/imap# telnet localhost 143 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. * OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID] lort Cyrus IMAP4 v2.3.8 server ready A01 LOGIN tinymailtest YOURPASSWORD A01 OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID LOGINDISABLED ACL RIGHTS=kxte QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND B INARY SORT SORT=MODSEQ THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE CATENATE CONDSTORE IDLE] User logged in A01 SELECT INBOX (CONDSTORE) * FLAGS (\Answered \Flagged \Draft \Deleted \Seen Junk $Label1 $Label2 $Label3 $Label4 $Label5) * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen Junk $Label1 $Label2 $Label3 $Label4 $Label5 \*)] * 625 EXISTS * 0 RECENT * OK [UNSEEN 1] * OK [UIDVALIDITY 1169764848] * OK [UIDNEXT 626] * OK [HIGHESTMODSEQ 1] A01 OK [READ-WRITE] Completed
