IMAP: Difference between revisions
Line 26: | Line 26: | ||
=== Courier IMAP on Cygwin === |
=== Courier IMAP on Cygwin === |
||
There is no binary package for '''Cygwin'''. And building '''Courier IMAP''' on that platform is a true pain in the neck, if not something else. 2 packages must be built: '''courier-authlib''' and '''courier-imap'''. Some links I found on Internet: |
There is no binary package for '''Cygwin'''. And building '''Courier IMAP''' on that platform is a true pain in the neck, if not something else. 2 packages must be built: '''courier-authlib''' and '''courier-imap'''. Some links I found on Internet: |
||
* Building '''courier-authlib''' |
* Building '''courier-authlib''' |
||
Line 43: | Line 44: | ||
# ... ERRORS! |
# ... ERRORS! |
||
</source> |
</source> |
||
But... Thierry succeeded in compiling and installing '''Courier-IMAP''' and '''Courier-authlib''' on Cywing. He has detailed the complete procedure on [[http://wiki.yobi.be/wiki/Courier-Cygwin Yobi Wiki]]. Here the exact steps I applied myself |
|||
==== Cygwin Packages ==== |
|||
Install required Cygwin packages (run Cygwin's <tt>setup.exe</tt>): |
|||
* <tt>patch</tt>, <tt>tar</tt>, <tt>make</tt>, <tt>gcc</tt> |
|||
* <tt>crypt</tt> |
|||
* <tt>libgdbm-devel</tt> |
|||
* <tt>libtool</tt> |
|||
* <tt>inetutils</tt> |
|||
* <tt>cygrunsrv</tt> |
|||
==== Install courier-authlib ==== |
|||
untar '''courier-authlib''' |
|||
<source lang="bash"> |
|||
tar -xvjf courier-authlib-0.61.0.tar.bz2 |
|||
cd courier-authlib-0.61.0 |
|||
</source> |
|||
Apply [https://kiwi.noekeon.org/miki/upload/courier-authlib-0.61.0-cygwin.patch this patch]: |
|||
<source lang="bash"> |
|||
patch -Np1 <../courier-authlib-0.61.0-cygwin.patch |
|||
</source> |
|||
Configure (replace mailuser with an user name from /etc/passwd - I used my own username as suggested), build, check and install. |
|||
<source lang="bash"> |
|||
./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \ |
|||
--without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \ |
|||
--with-mailgroup=mkgroup-l-d |
|||
make |
|||
make check |
|||
make install |
|||
</source> |
|||
==== Install courier-imap ==== |
|||
'''Building and installing courier-imap''' |
|||
untar '''courier-imap''' |
|||
<source lang="bash"> |
|||
tar -xvjf courier-imap-4.4.1.tar.bz2 |
|||
cd courier-imap-4.4.1 |
|||
</source> |
|||
Apply [https://kiwi.noekeon.org/miki/upload/courier-imap-4.4.1-cygwin.patch this patch]: |
|||
<source lang="bash"> |
|||
patch -Np1 <../courier-imap-4.4.1-cygwin.patch |
|||
</source> |
|||
Configure, build, check and install. |
|||
<source lang="bash"> |
|||
./configure --disable-root-check --with-waitfunc=wait |
|||
make |
|||
make install |
|||
make install-configure |
|||
</source> |
|||
==== Configuration ==== |
|||
If not present yet, add <tt>/usr/local/bin</tt> and <tt>/usr/local/sbin</tt> to your path (ideally in <tt>/etc/bash.bashrc</tt>): |
|||
<source lang="bash"> |
|||
PATH=/usr/local/bin:/usr/local/sbin:$PATH |
|||
</source> |
|||
Create courier-authlib configuration file, |
|||
<source lang="bash"> |
|||
cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc |
|||
</source> |
|||
and edit its content as follows: |
|||
<pre> |
|||
# The number of daemon processes that are started. |
|||
daemons=3 |
|||
# DEBUG_LOGIN=2 - turn on debugging + log passwords too |
|||
DEBUG_LOGIN=2 |
|||
</pre> |
|||
Create user mailbox (replace username with user account name). Repeat for all users: |
|||
<source lang="bash"> |
|||
mkdir -p /home/username #if don't exist yet... |
|||
cd /home/username |
|||
for i in "" .Drafts .Sent .Trash .Templates; do /usr/lib/courier-imap/bin/maildirmake ~username/MailDir/$i; done |
|||
# Create also default Maildir for new users |
|||
for i in "" .Drafts .Sent .Trash .Templates; do /usr/lib/courier-imap/bin/maildirmake /etc/skel/MailDir/$i; done |
|||
</source> |
|||
Create user authentication database: |
|||
<source lang="bash"> |
|||
touch /usr/local/etc/authlib/userdb |
|||
chmod 700 /usr/local/etc/authlib/userdb |
|||
#Repeat for each username: |
|||
pw2userdb | grep "^username">>/usr/local/etc/authlib/userdb # Fill userdb from /etc/passwd user entry |
|||
userdb username set mail=~username/MailDir # Specify user MailDir location |
|||
userdbpw | userdb username set systempw # Set user account password |
|||
... |
|||
makeuserdb # Create binary database |
|||
</source> |
|||
Edit the file <tt>/usr/lib/courier-imap/etc/imapd</tt>: |
|||
<pre> |
|||
ADDRESS=127.0.0.1 #Typ. use 0 or 127.0.0.1 |
|||
... |
|||
IMAP_ULIMITD=2097152 #Set same value as returned by 'ulimit -v' or imapd.rc will complain |
|||
</pre> |
|||
==== Running ==== |
|||
Configure '''syslogd''' for capturing system message from '''courier-authlib''' |
|||
<source lang="bash"> |
|||
syslogd-config #if not configured yet |
|||
net start syslogd #if not started yet |
|||
</source> |
|||
Start authlib and imap daemon: |
|||
<source lang="bash"> |
|||
authdaemond start |
|||
/usr/lib/courier-imap/libexec/imapd.rc start |
|||
</source> |
|||
==== Testing ==== |
|||
Testing authlib: |
|||
<pre> |
|||
$ export PATH=$PATH:/usr/local/lib/bin #because authtest needs a library there (strace authtest |
|||
$ authtest username CCCCCC |
|||
Output must be similar to |
|||
<pre> |
|||
Authentication succeeded. |
|||
Authenticated: username (uid 1001, gid 10545) |
|||
Home Directory: /home/username |
|||
Maildir: /home/username/Maildir |
|||
Quota: (none) |
|||
Encrypted Password: XXXXXX |
|||
Cleartext Password: CCCCCC |
|||
Options: (none) |
|||
</pre> |
|||
Check everything is fine in <tt>/var/log/messages</tt> |
|||
Testing courier-imap: |
|||
<source lang="bash"> |
|||
$ telnet localhost 143 |
|||
</source> |
|||
Type the following commands |
|||
<pre> |
|||
001 LOGIN username password |
|||
002 EXAMINE INBOX |
|||
003 LOGOUT |
|||
</pre> |
|||
'''TO DO:''' |
|||
# Use SYSTEM instead of my user account for configure authlib |
|||
'''File location''': |
|||
/usr/local/bin |
|||
/usr/local/sbin |
|||
/usr/lib/courier-imap |
|||
/usr/local/etc/authlib |
|||
=== Configuration === |
=== Configuration === |
Revision as of 16:48, 6 November 2008
IMAP servers
There are basically three main IMAP server solutions:
- UW IMAP
- IMAP server developped by the University of Washington. Uses a proprietory mailbox format mbx, which is more or less a binary version of the usual mailbox format. A binary package exists on cygwin, but it regularly suffers from locking problems. A patch exists to use maildir format though, but patch seems outdated.
- Courier IMAP
- Courier-IMAP is a fast, scalable, enterprise IMAP server that uses Maildirs.
- Cyrus IMAP
- Developped by Carnegie Mellon. Also uses a private mailbox format.
Courier IMAP
References
- Courier IMAP homepage
- On openSUSE, check package documentation at /usr/share/doc/packages/courier-authlib and /usr/share/doc/packages/courier-imap.
- Manpages & package documentation:
- maildirmake(1)
- couriertcpd(1)
- imapd(8)
- userdb(8)
- makeuserdb(8)
- /usr/share/doc/courier-doc (on Ubuntu, with package courier-doc installed)
Courier IMAP on openSUSE
Binary package for Courier IMAP is available on openSUSE (package courier-authlib and courier-imap). However it conflicts with the default IMAP server, (UW IMAP), which must first be uninstalled.
Courier IMAP on Cygwin
There is no binary package for Cygwin. And building Courier IMAP on that platform is a true pain in the neck, if not something else. 2 packages must be built: courier-authlib and courier-imap. Some links I found on Internet:
- Building courier-authlib
- Building courier-imap
- There is a README.cygwin that provides some direction on how to build this package on Cygwin.
In summary, this is the furthest I went:
# First, installed these packages in Cygwin: gdbm, libgdbm-devel, minires-devel, libgdbm, libgdbm3, libtool
tar -xvjf courier-authlib-0.61.0.tar.bz2
cd courier-authlib-0.61.0
# Fix Makefile that builds makedatprog
sed -i 's/noinst_PROGRAMS = @makedatprog_target@/noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)/' makedat/Makefile.in
./configure --with-mailuser=SYSTEM --with-mailgroup=SYSTEM --with-db=gdbm
make
# ... ERRORS!
But... Thierry succeeded in compiling and installing Courier-IMAP and Courier-authlib on Cywing. He has detailed the complete procedure on [Yobi Wiki]. Here the exact steps I applied myself
Cygwin Packages
Install required Cygwin packages (run Cygwin's setup.exe):
- patch, tar, make, gcc
- crypt
- libgdbm-devel
- libtool
- inetutils
- cygrunsrv
Install courier-authlib
untar courier-authlib
tar -xvjf courier-authlib-0.61.0.tar.bz2
cd courier-authlib-0.61.0
Apply this patch:
patch -Np1 <../courier-authlib-0.61.0-cygwin.patch
Configure (replace mailuser with an user name from /etc/passwd - I used my own username as suggested), build, check and install.
./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \
--without-authshadow --without-authcustom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \
--with-mailgroup=mkgroup-l-d
make
make check
make install
Install courier-imap
Building and installing courier-imap
untar courier-imap
tar -xvjf courier-imap-4.4.1.tar.bz2
cd courier-imap-4.4.1
Apply this patch:
patch -Np1 <../courier-imap-4.4.1-cygwin.patch
Configure, build, check and install.
./configure --disable-root-check --with-waitfunc=wait
make
make install
make install-configure
Configuration
If not present yet, add /usr/local/bin and /usr/local/sbin to your path (ideally in /etc/bash.bashrc):
PATH=/usr/local/bin:/usr/local/sbin:$PATH
Create courier-authlib configuration file,
cp /usr/local/etc/authlib/authdaemonrc.dist /usr/local/etc/authlib/authdaemonrc
and edit its content as follows:
# The number of daemon processes that are started. daemons=3 # DEBUG_LOGIN=2 - turn on debugging + log passwords too DEBUG_LOGIN=2
Create user mailbox (replace username with user account name). Repeat for all users:
mkdir -p /home/username #if don't exist yet...
cd /home/username
for i in "" .Drafts .Sent .Trash .Templates; do /usr/lib/courier-imap/bin/maildirmake ~username/MailDir/$i; done
# Create also default Maildir for new users
for i in "" .Drafts .Sent .Trash .Templates; do /usr/lib/courier-imap/bin/maildirmake /etc/skel/MailDir/$i; done
Create user authentication database:
touch /usr/local/etc/authlib/userdb
chmod 700 /usr/local/etc/authlib/userdb
#Repeat for each username:
pw2userdb | grep "^username">>/usr/local/etc/authlib/userdb # Fill userdb from /etc/passwd user entry
userdb username set mail=~username/MailDir # Specify user MailDir location
userdbpw | userdb username set systempw # Set user account password
...
makeuserdb # Create binary database
Edit the file /usr/lib/courier-imap/etc/imapd:
ADDRESS=127.0.0.1 #Typ. use 0 or 127.0.0.1 ... IMAP_ULIMITD=2097152 #Set same value as returned by 'ulimit -v' or imapd.rc will complain
Running
Configure syslogd for capturing system message from courier-authlib
syslogd-config #if not configured yet
net start syslogd #if not started yet
Start authlib and imap daemon:
authdaemond start
/usr/lib/courier-imap/libexec/imapd.rc start
Testing
Testing authlib:
$ export PATH=$PATH:/usr/local/lib/bin #because authtest needs a library there (strace authtest $ authtest username CCCCCC Output must be similar to <pre> Authentication succeeded. Authenticated: username (uid 1001, gid 10545) Home Directory: /home/username Maildir: /home/username/Maildir Quota: (none) Encrypted Password: XXXXXX Cleartext Password: CCCCCC Options: (none)
Check everything is fine in /var/log/messages
Testing courier-imap:
$ telnet localhost 143
Type the following commands
001 LOGIN username password 002 EXAMINE INBOX 003 LOGOUT
TO DO:
- Use SYSTEM instead of my user account for configure authlib
File location: /usr/local/bin /usr/local/sbin /usr/lib/courier-imap /usr/local/etc/authlib
Configuration
- Configuration file:
- /etc/courier/