Courier imap and vpopmail on Debian

Hi everyone. Sorry for the lack of updates, I’ve been fairly busy — I’m migrating all of my servers to a single, brand new Dell Poweredge 2900 server. I have a couple of great tutorials regarding Xen coming up soon, I’m sure at least someone will find them useful — I found the Xen documentation to be really scarce.

So, right now, I’m migrating my qmail, vpopmail, courier, clamav and friends set-up from Gentoo to Debian, on a new virtual machine. I followed the basic steps from here:

http://wiki.debian.iuculano.it/quick_howto

This gent was nice enough to provide the required qmail packages and patches. Only problem came when I tried to make courier work with vpopmail — turns out the official debian courier-imap packages don’t support vchkpw, which is the authentication mechanism for vpopmail. Fortunately, I managed to hack it in an almost clean way, that doesn’t involve building it yourself from tarball.

Read on for the jazz.

So, first of all, fetch the courier-authlib source. You should first make sure that your /etc/apt/sources.list file contains the “deb-src” lines for everything. apt-get update if necessary.

So, step one, create a folder to hold the sources and debian packages, and cd into it.

mkdir -p /usr/src/deb-source; cd  /usr/src/deb-source

Step two, fetch the sources.

apt-get source courier-authlib

Once that is done, you must install the tools and libraries courier might need to be built. This sounds scary, but is actually a breeze under Debian.

apt-get build-dep courier-authlib

This should bring in a few things like build-essential, if you don’t have a compiler on the machine yet.

Next, cd’ into the source folder, and into the debian package files.

cd courier-authlib-0.58/debian

Now you’re sitting where all the package specifications are configured, and the sweet thing is, you can hack them to your heart’s content. First of all, we need to edit the file named control.

vi control

Add the following at the end of the file to create a description for vchkpw.


Package: courier-authlib-vchkpw
Architecture: any
Depends: ${shlibs:Depends}, courier-authlib (>= ${RELUP})
Description: External authentication support for Vpopmail.
 This package contains vpopmail support for courier-authlib.

Next, we must create a list of files for the package.

echo "/usr/lib/courier-authlib/libauthvchkpw.so*" > courier-authlib-vchkpw.files

Failure to do this could lead to the following message during build:

/usr/src/deb-source/courier-authlib-0.58/debian/tmp/usr/lib/courier-authlib/libauthvchkpw.so.0.0.0 /usr/src/deb-source/courier-authlib-0.58/debian/tmp/usr/lib/courier-authlib/libauthvchkpw.so.0 /usr/src/deb-source/courier-authlib-0.58/debian/tmp/usr/lib/courier-authlib/libauthvchkpw.so File(s) found not belonging to any package, please contact maintainer make: *** [install] Error 1

Next step, altering the build parameters to include vpopmail support. That’s fairly easy. Just edit the file rules.


vi rules

Scroll down to the part where COMMON_CONFOPTS is defined, near line 35. Change the line where it says:

–without-authvchkpw \

so that it now reads:

–with-authvchkpw \

Once that is done, save the file, and you’re now ready to build the new and improved package:


# cd ..
# dpkg-buildpackage
And go fetch some coffee. The courier builds are always pretty nasty, and configure can take a while. During compilation, I spotted this with my hawk eyes:

Compiling authvchkpw.c
authvchkpw.c: In function 'callback_vchkpw':
authvchkpw.c:46: warning: value computed is not used
authvchkpw.c: In function 'auth_vchkpw_changepass':
authvchkpw.c:142: warning: passing argument 1 of 'parse_email' discards qualifiers from pointer target type
Compiling authvchkpwlib.c

This confirmed that support was indeed being included this time.

Once the build is done, simply install the required package.


# cd ..
# ls -lah *.deb
courier-authdaemon_0.58-4_amd64.deb     courier-authlib-pipe_0.58-4_amd64.deb
courier-authlib_0.58-4_amd64.deb        courier-authlib-postgresql_0.58-4_amd64.deb
courier-authlib-dev_0.58-4_amd64.deb    courier-authlib-userdb_0.58-4_amd64.deb
courier-authlib-ldap_0.58-4_amd64.deb   courier-authlib-vchkpw_0.58-4_amd64.deb
courier-authlib-mysql_0.58-4_amd64.deb
# dpkg -i courier-authlib-vchkpw_0.58-4_amd64.deb
Selecting previously deselected package courier-authlib-vchkpw.
(Reading database ...
27234 files and directories currently installed.)
Unpacking courier-authlib-vchkpw (from courier-authlib-vchkpw_0.58-4_amd64.deb) ...
Setting up courier-authlib-vchkpw (0.58-4) ...
#

And we're done.

Now all that is left is just to edit /etc/courier/authdaemonrc where it specifies the authentication modules to include our newly created one:

authmodulelist="authvchkpw"

And voilà. That wasn't so hard, was it?

I hope someone finds the following guide useful :)

15 Responses to “Courier imap and vpopmail on Debian”

  1. Daniel says:

    Thаnks a lot

  2. K says:

    Hey dude thanks I was in the same situation and your guide came in handy

    thanks alot for the tip

  3. Marco says:

    Hi!

    I tried to follow your tip on a rootserver with ServerAdmin24 installed, where a Debian upgrade (stable to etch) messed up with pop/imap.

    At dpkg-buildpackage I encountered an error:
    configure: error: /var/lib/vpopmail/etc/lib_deps does not exist – upgrade vpopmail to the current version or fix the permissions on this file

    vpopmail is the newest version available in debian stable (5.4.4-1).

    There is no directory lib_deps anywhere — where can I look for this, how may I solve this error?

  4. Nick says:

    Thanks so Much..
    This helps a lot, I will add this to my blog too.. :)
    seems so hard to find solutions on these particular
    “please contact maintainer” problem.

  5. Giz says:

    Great! Thanx so much for this! Not sure how you know so much about this but I am glad you do :)

  6. Pedro Roger says:

    Great!
    Thanks a lot ;D

  7. TeB says:

    man, you saved my life!

    thanks for the priceless solution :D

  8. JS says:

    My god, i once did this on my own but time was short and your post saved me!

  9. Marty says:

    Mate,

    You saved my day.

    Thanks a lot!

    Appreciate it stacks.

    Marty

  10. Brian says:

    Wow! Superb. I was pulling my hair out reading posts about how courier-authlib no longer supported vpopmail until I found your notes. Thanks so much.

    It’s a little scary if you are not familiar with building packages (I’m not), but it worked a treat for me using courier-authlib_0.60.1 on Ubuntu 8.04. I’m going to go back and find some of those negative posts on other lists and paste a link to these notes. Really appreciate your efforts.

  11. Paul says:

    This no longer appears to work for the latest version of courier-authlib (courier-authlib_0.61.0). :(

  12. mr_daemon says:

    @Paul:

    I just upgraded my server to the latest version, and used this page to do it, a few days ago.
    Can you specify what exactly doesn’t work? Because it worked just fine on my end.

  13. Peter Savov says:

    latest releas of courier-authlib which has vpopmail support i 0.57 which is rather old and cant be downloaded from Courier web site ….

  14. Niraj says:

    great to see this. can anyone let me know how to do this with 0.62.4 on CentOS 5.3

  15. Hopeful says:

    Out of frustration (and hours of debugging this) I’ve moved away from qmail / vpopmail / courier in favor of postfix & dovecot. Using this page http://workaround.org/articles/ispmail-etch/ I’ve managed to get my server back online in a few hours (without having to recompile sources).

    This is just an FYI or others having problems. I’ve been a happy qmail / courier user for almost 7 years… I guess it’s time to switch.

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">