Vpopmail and IMP Hacks

Nick Vargish
nav@bandersnatch.org

Abstract: A number of the support modules for horde/IMP don't work properly with a qmail+vpopmail configuration. The quota reporting relies on mechanisms that differ from vpopmail. The vacation and forwards modules need ftp access to a user's account, and those don't exist if you're serving mail for virtual domains under vpopmail.

Quota Display

You need to let the apache user run a couple of programs as root. Note that if you are very paranoid, you might need to find another way to do this. Add the following lines to /etc/sudoers, replacing "apache" with the owner of the httpd process (if not apache, it might be "nobody"). If you installed vpopmail to somewhere other than /var, you will need to change the path to the vuserinfo program:

apache  ALL=(root)  NOPASSWD: /usr/bin/du
apache  ALL=(root)  NOPASSWD: /var/vpopmail/bin/vuserinfo

Now you'll need to make a custom function for IMP to call to check the quota. Open your IMP configuration file, the location of which depends on where you have installed horde, but from there looks like horde/imp/config/conf.php. Add the show vpopmail quota functions to the file. Remember to change the path for vuserinfo if it's not in /var/vpopmail/bin.

Before closing the editing session, make sure that the quota display hook points at the new function:

$conf['hooks']['quota'] = 'show_vpop_quota';

Save the configuration file and end the editing session. Now, when users log in to IMP, they should see the percentage of their quota in use displayed in a box above the list of messages.

Forwarding E-Mail

I won't lie to you — this isn't going to be pretty. This hack, and the one that follows, requires that your vpopmail directories reside on the same system as the http server that's serving up IMP. NFS will probably work to mount the vpopmail directories on the http server, but hasn't been tested.

First step, grab the forwards module from the horde snapshot download location. Be sure to grab the RELENG version. Unpack it in your horde directory, and rename the resulting directory "forwards". Follow the directions in forwards/doc/INSTALL.

Edit forwards/config/conf.php and change the driver line to point to qmail:

$conf['server']['driver'] = 'qmail';

Grab a copy of the vpopimpforward script, and install it in the vpopmail binary directory:

wget http://nav.bandersnatch.org/clues/vpopimp/vpopimpforward.txt
mv vpopimpforward.txt /var/vpopmail/bin/vpopimpforward
chmod +x /var/vpopmail/bin/vpopimpforward
chown vpopmail.vchkpwd /var/vpopmail/bin/vpopimpforward

The script needs to be run as root, so you will need to allow the apache user to run it under su. Edit /etc/sudoers and add the following line (if your httpd process doesn't run as apache, you will need to change "apache" to the appropriate user):

apache  ALL=(root)  NOPASSWD: /var/vpopmail/bin/vpopimpforward

Make a backup of the qmail driver (who knows, you might need it some day), grab my hacked version, and install it as the qmail driver:

cd forwards/lib/Driver
mv qmail.php qmail.php.dist
wget http://nav.bandersnatch.org/clues/vpopimp/vpoplocal-forwards.txt
mv vpoplocal-forwards.txt qmail.php

Forthcoming...

Sorry, this page ends a bit abruptly. Time allowing, I will be adding some details on how to add support for enabling a "vacation" function along the lines of the forwards hack above.

Last modified: 2003-February-17