Print this pagePrint this page

Qmail

Hooking spamassassin into Qmail without using QMAILQUEUE patch is fairly easy and allows you to configure a system wide spamassassin scan which is essential if you have a server that runs virtual hosts and users (i.e. handles emails for non-Unix accounts),

cd /var/qmail/bin

Edit a new file called qmail-queue.sh and make its contents,

#!/bin/sh

PATH=/var/qmail/bin:$PATH

spamc | qmail-queue.original

Then do,

chmod 755 qmail-queue.sh
chgrp qmail qmail-queue.sh
mv qmail-queue qmail-queue.original

mv qmail-queue.sh qmail-queue



How does this work ? When qmail-smtpd starts up it runs qmail-queue (which is now your new shell script) and that then runs spamc (which is a client for spamd) and pipes its output to the original qmail-queue.The original qmail-queue then does its stuff but the email now should have extra spamassassin headers in it (assuming spamassassin was configured correctly).

How spamc works is that it takes stdin and launches the spamassassin daemon (the spamd processes). If spamc cannot run spamd then spamc fails gracefully and simply returns the original email unaffected. You must make sure that spamd runs at startup. To do this do you can do the usual, ps -efw | grep spamd type of command. On CENTOS you can do,

chkconfig --list

or alter that by

chkconfig --level 345 spamassassin on


Previous page: Technical Tips
Next page: Consultancy Services