http:// qmail.jms1.net / courierpassd.shtml

Running courierpassd under daemontools

The courierpassd program is an add-on for courier-authlib which allows external programs (such as squirrelmail) to change the password for a mailbox. It's fairly simple- a program like inetd or tcpserver listens on a TCP port, and whenever somebody connects it runs the courierpassd program. The program asks the client for a username and the existing password, and if the existing password is valid it will allow the client to set a new password.

It was designed to run under inetd, which means it will also work with xinetd or tcpserver. In fact, qmailrocks has an entire page devoted to making it work under xinetd. This page will show how to make it work under daemontools.


Install the software

Before starting, you should visit the official courierpassd download site to make sure that you are installing the most recent version. As of the last time I updated this page, version 1.1.2 is current. Be careful- the page has the files for courierpassd, but it also has courierpasswd (not the extra "w" in there) which is a totally separate program.

# wget http://www.arda.homeunix.net/store/courierpassd-1.1.2.tar.gz
...
# tar xvzf courierpassd-1.1.2.tar.gz ...
# cd courierpassd-1.1.2
# ./configure
...
# make
...
# make install
...

By default, the program is installed as /usr/local/sbin/courierpassd. Take a second and make sure this file exists on your system. If not, examine the output from "make install" and see if you can find where it put the file. The "run" script on my site assumes that it is installed in this location, if yours is different then you will have to adjust the run script.


Set up the 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 courierpassd
# cd courierpassd
# wget http://qmail.jms1.net/scripts/service-courierpassd-run
...
# mv service-courierpassd-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/courierpassd /service/ (adjust the directory as needed)


Squirrelmail plug-in

Of course there's no reason to run the courierpassd service unless you have a program which makes use of it. I use it to support the Change Password plugin for SquirrelMail. And even though it's not strictly related to courierpassd, I suspect many people are reading this in order to use the same plug-in, so here's how I got it working.

My system is using SquirrelMail as installed by the standard RPM files with my distro (either WhiteBox or CentOS, both of which are clones of RedHat Enterprise.) My system stores everything relating to SquirrelMail in the /usr/share/squirrelmail directory, you may need to adjust the directory names for your own system.

The nice thing about SquirrelMail plugins is that they don't have to be "installed" as such- just expand the tarball into the right directory and that's it.

First visit the home page for the plugin and make sure you have the correct version for your SquirrelMail installation. As of the time I'm writing this page, version 2.7-1.4.x is the most recent (and the 1.4.x in the version number matches the 1.4.3 version of SquirrelMail on my system.)

# cd /usr/share/squirrelmail/plugins (adjust the directory as needed)
# wget http://www.squirrelmail.org/plugins/change_pass-2.7-1.4.x.tar.gz
...
# tar xvzf change_pass-2.7-1.4.x.tar.gz
# rm change_pass-2.7-1.4.x.tar.gz (or move the file somewhere else)
# cd change_pass
# chown -R 0:0 .
# chmod -R go=u-w .
# cd /usr/share/squirrelmail/config (adjust the directory as needed)
# ./conf.pl

Choose "Plugins", then choose "change_pass" from the "Available Plugins" list. You should see it move to the "Installed Plugins" list. Then choose "Save data" and then "Quit".