Installing chkuser 2.0 QMail patch with FreeBSD ports
Tagged:  •    •    •  

chkuser is a patch for QMail 1.03 which checks if the recipient address is a valid user on the system. If not, it will block the mail right away. This is nice, because usually this is checked after scanning a mail for virusses and spam. Now this is checked beforehand, which saves you a lot of CPU cycles.

When you have QMail installed from FreeBSD ports, the patch cannot be installed right away. It requires some slight modifications, because FreeBSD installs VPopMail in /usr/local/vpopmail (the patch assumes /home/vpopmail). These are the steps to install the chkuser patch:

  1. Download the patch, extract it and put it in /usr/ports/mail/qmail/files
  2. Rename the patch, such that it will be picked up by the port:
    mv chkuser-x.x.x-release.patch patch-chkuser-x.x.x
  3. Patch this patch. From:
    VPOPMAIL_HOME=/home/vpopmail

    to:

    VPOPMAIL_HOME=/usr/local/vpopmail
  4. Patch the port's Makefile. After the bsd.port.pre.mk include, add the following line:
    CFLAGS+= -I/usr/local/vpopmail/include
  5. You should be able to run the installation now.

You may need to do some post installation steps to get things working, depending on how you (want to) run the SMTP server. The website of the chkuser patch is quite OK, so is the documentation.

In my case, I had to change the user and group for the tcpserver process. It should be run as 'vpopmail', such that qmail-smtpd has access to vpopmail's data.