http:// qmail.jms1.net / courier-authlib.shtml

Running courier-authlib under daemontools

The courier-authlib package is a set of programs which handle authenticating login requests from the IMAP and POP3 services which comes with the courier-imap package. The API (the mechanism by which the IMAP and POP3 servers send their requests, and gather the results) is documented in the README_authlib.html file which comes with the courier-authlib package.

The courier-authlib package revolves around a program called authdaemond. When it starts, it reads a configuration file (usually /etc/authlib/authdaemonrc) and then loads a set of dynamic modules to support the specific authentication types you need to support on your server. These modules are usually found in the /usr/lib/courier-authlib directory.

One of the most common mistakes that people make when setting up the courier-authlib package is forgetting to configure the system to start authdaemond when the system boots- especially people who are following the directions on qmailrocks, because the site doesn't tell the user to do this and 95% of the people who use the directions don't read the documentation that comes with the source code at all.

My own preference is to run as many of my system's services as possible under daemontools- not that I have anything against init scripts, but too many different systems do different things- at least daemontools works the same no matter what system you're running on.


Install the software

Before starting, you should visit the official courier-authlib home page and make sure that you are installing the most recent version.

You should install the courier-authlib package using the directions found in the INSTALL file within the source code package. You should also configure your /etc/authlib/authdaemonrc file (specifically the authmodulelist= line... for a typical system using vpopmail to manage all of your mailboxes, this line should contain only authmodulelist="authvchkpw".)

All file and directory names on this page are from my own server, which was installed using the How to build courier-imap RPMs without FAM page.


Set up the daemontools service

Next we need to set up the daemontools directory structure for the service. I use /var/service as the physical location for my service directories, you can use whatever you like except that it cannot be /service itself. The examples below will assume you are using /var/service like I did- if you are using something different, adjust the paths where appropriate.

# cd /var/service (adjust the directory as needed)
# mkdir -m 1755 courier-authlib
# cd courier-authlib
# wget http://qmail.jms1.net/scripts/service-courier-authlib-run
...
# mv service-courier-authlib-run run
# chmod 755 run
# mkdir -m 755 log
# cd log
# wget http://qmail.jms1.net/scripts/service-any-log-run
...
# mv service-any-log-run run
# chmod 755 run

The last step, of course, is to start the service running.

# ln -s /var/service/courier-authlib /service/ (adjust the directory as needed)