Document version: 0.1; created 2004-02-04.
This document describes how to patch SpamAssassin to work with Courier virtual domains. The problem is that SA does not recognize the homedirs of the virtual users and therefore, sadly, does not read the bayes database and user_prefs files for virtual users. The patch used here overrides the homedir retrieving function in SA. If you followed the documentation linked below, you may have noticed that sa-learn puts the bayes db into the right place, but spamc/spamd look in the wrong place. Hence, we will patch spamd with the AuthCourier patch by Alan Milligan. This document does not cover patching spamassassin, so you either are stuck to use spamc/spamd (which is in most cases the better approach anyway) or you have to patch spamassassin yourself (in which case I would be interested in your story to include it here ;-).
You should have the basic setup of Courier and SpamAssassin done. Maybe the following documents are helpful: Virtual Mail Hosting with the Courier Mail Suite and Bayesian filtering with SpamAssassin, courier-imap and maildrop.
Make sure authdaemon is active as authentication service or courier. The patch relies on that.
andaka:/etc/courier# grep -re '^AUTHMODULES' * esmtpd:AUTHMODULES="authdaemon" esmtpd:AUTHMODULES_WEBADMIN="authdaemon" imapd:AUTHMODULES="authdaemon" imapd:AUTHMODULES_ORIG="authdaemon" pop3d:AUTHMODULES="authdaemon" pop3d:AUTHMODULES_ORIG="authdaemon"
Every AUTHMODULES line in these files should contain the authdaemon, which should be configured to use the correct authentication module.
Go to the perl library directory, and there into Mail/Spamassassin. On a Debian system, it is in /usr/share/perl5/Mail/SpamAssassin/. Save the AuthCourier.pm (many thanks to Alan Milligan for the patch) there:
andaka:~# cd /usr/share/perl5/Mail/SpamAssassin/ andaka:/usr/share/perl5/Mail/SpamAssassin# wget http://da.andaka.org/dl/AuthCourier.pm
Now you need to put one tiny little line into spamd, maybe found in /usr/sbin/ or /usr/local/sbin. Keep looking for a block of use-statements that import a bunch of SpamAssassin modules. They should look like this (lines 33-35 in SpamAssassin version 2.61):
use Mail::SpamAssassin; use Mail::SpamAssassin::NoMailAudit; use Mail::SpamAssassin::NetSet;
Immediately after that block, insert one line:
You're set, now restart spamd by running e.g. /etc/init.d/spamassassin restart.