This page is now out of date and is no longer being updated. It’s left here for posterity, or until I can be bothered to take it down
I came across some problems with interpreting the documentation when setting up Courier IMAP. Essentially, all I do is have a few local users on my box who all receive local delivery (rather than having multiple virtual domains and the like).
Anyway, I though I’d just write down the process I went though in getting it all working, mainly as a reminder to myself!
Install Courier IMAP
Download, install as per the instructions athttp://www.inter7.com/courierimap.html
[New Note]: I recently updated my version of Courier IMAP in the vain hope it would sort out logging (i.e. when the log level is set to 0 it shouldn’t log much to syslog), it didn’t fix this, but I had lots of trouble compiling it. I had the latest version of openssl installed, but still had errors when running make complaining:
openssl/ssl.h: No such file or directory
openssl/err.h: No such file or directory
Eventually I figured out that Courier was looking in the wrong place for the openssl libraries. I fixed this by linking the real location to the path Courier was expecting:
ln -s /wherever-your-ssl-is/include/openssl /usr/include/openssl
Make local accounts as necessary
Make sure the local user exists!
Check Exim configuration
If you use Exim….. make sure you’re delivering to Maildir format (not MBOX) and that the group local delivery runs as is the same one as Courier IMAP. You should have a line similar to:
local_delivery:
driver = appendfile
directory = /home/${local_part}/Maildir
delivery_date_add
envelope_to_add
return_path_add
group = mail
mode = 0660
maildir_format
prefix = ""
Create Courier Accounts
cd /usr/lib/courier/sbin
./pw2userdb
copy the two lines such as the ones below into /etc/userdb
:
username uid=101|gid=100|home=/home/username|shell=/bin/bash|systempw=[string of chars]|gecos=,,,
101= username
run:
./userdb -f /etc/userdb "email@address.com" set home=/home/$person mail=/home/$person/Maildir uid=UUU gid=GGG
then run:
./userdbpw | ./userb -f /etc/userdb "email@address.com" set imappw
[and enter the password you want to use for the IMAP account when prompted]
finally:
./makeuserdb
It’s probably fairly obvious that this method isn’t hugely extensible and doesn’t lend itself very well to scripting hence is only useful when you have very few accounts and don’t change them that often. I’ve included some more details of running both local and virtual users in parallel in another section.