(02/04/2002), Bug fix :
I just add a little bug fix for some OS which remove the +x on qmail-queue (the qmail-scanner is not concerned) (01/11/2003), Qmail-scanner :
I had a new way of calling spamassassin client using qmail-scanner. (23/07/2003), Preferences :
Matthew Francis sent me a quite good howto explaining how to get user preferences for spamassassin. It is available here. (08/06/2003), Localisation :
If you want to change the language of the spam report (ie why the email has been tagged as a spam), just change the locales to your language (dpkg-reconfigure locales under debian) and install gettext (apt-get install gettext) and you will have the appropriate version (french for example)... (11/03/2005), Update :
After almost two years without updates, my other howto about qmail is much more complet and uptodate, I clean this one :
- first method deprecated
- new version of spamassassin 3.0.X
- use of netqmail instead of qmail
- new version of qmail-scanner with the q-s-st patch (activation of Spamassassin just for a domain)
Thank to Scott Kinkade for his cash donation. I really do appreciate.
If you want more informations about the intallation of qmail, I wrote a long howto about.
I wrote this howto because there is a lack of documentation about qmail with spamassassin.
This howto has been designed for qmail with vpopmail but it should work without a lot of modifications with something else than vpopmail.
Spamassassin is a very powerfull program which checks if the receveid email is a spam or not. The analys is based on a list of mark. If the sum of all the mark exceed a specified amount (for example 5), the email will be tagged (****SPAM**** in the topic).
With this, it is very easy to create a rule which will move all emails into a specific directory (i.e. trash:)
If you want to link Qmail with spamassassin, it is quite easy.
First, install spamassassin and install razor and pyzor if you want to use it.
Under debian :
apt-get install spamassassin You should use the "debian unstable or testing" version of spamassassin which, most of the time, will find more spam.
Under other system (Redhat, Suse, Solaris ...) :
The latest version of spamassassin today is the version 3.0.2. The installation is almost the same, only a few directives changed.
tar -zxvf Mail-SpamAssassin-2.55.tar.gz
cp spamd/debian-rc-script.sh /etc/init.d/spamassassin You can replace debian by redhat, solaris, netbsd, suse ...
chmod +x /etc/init.d/spamassassin
Then, edit /etc/spamassassin/local.cf Version 2.5X :
use_pyzor 1 (Only if you have installed pyzor)
use_razor2 (Only if you have installed razor2)
Version 3 :
#Number of points to tag the spam
# Add the result in the header
# change the subject
# dns checks (warning : increase the process length)
# Don't skip the relay black list
# Remote verification
# Never from the previous results
# use the bayes filter
# Where spamassassin must store these informations :
# Where he stores the auto white list results :
If you want to have detailled information about spamassassin processing, add the line in the local.cf file : timelog_path /var/log/spamassassin, run the daemon with the -D option (so, specify it in the /etc/default/spamassassin file under debian), create the directory with appropriate rights (should be vpopmail). In the directory, you will have for each email a file which sum up the spamassassin process (it is a debug option !).
I use these rules. Feel free to change ! Documentation about this is available here : perldoc Mail::SpamAssassin::Conf
In /etc/default/spamassassin (if this file does not exist, create it)
Change ENABLED to 1, then add these options :
- "-m 10 -v --auto-whitelist" for the version 2.5X.
- "-v -m 10 -u vpopmail --nouser-config" for the version 3
With that stuff, you can launch spamd which is bascilly a spamassassin deamon (provide great performances).
-m 10 => 10 childs
-v => vpopmail config
--auto-whitelist => Use auto whitelist (friend list)
Instead of spamassassin, you have to use spamc in order to test email.
There are some options "-c -u vpopmail" which enabled the creation of preferences for a domain or a user but it does not work very well for me.
Next, the modification of qmail in order to check emails.
Basically, there are two kind of configuration for qmail :
- the fastest/easiest way is to change the qmail-queue in order to "introduce" the spamasssin check.Deprecated
- the cleanest way is to use qmail-scanner.
Changing the qmail-queue program
cp /var/qmail/bin/qmail-queue /var/qmail/bin/qmail-queue.orig
chown qmailq:qmail qmail-queue
chown qmailq:qmail qmail-queue.orig
chmod u+s qmail-queue.orig
chmod o+r,+x qmail-queue.orig qmail-queue Not fundamental but sometime it is necessary (depends the system)
chmod 777 /home/vpopmail/.spamassassin
And then, install qmail-scanner with qmail-scanner-st .
qmail-scanner-st is a patched version a qmail-scanner which enabled great features like auto delete/reject/quarantine spam over a specified score but also to select which scanners will be used for a domain and even for a user, then, it is possible to configure the spamassassin / antivirus just for one domain/user.
After the installation, if you want to change your preferences, you have to edit the /var/qmail/bin/qmail-scanner-queue.pl file. In this file, you can also add option for the spamassassin client.
If you want to enable/disable some scanners, edit the /var/spool/qmailscan/scanners_per_domain.txt
To rehash the scanner per domain file : /var/qmail/bin/qmail-scanner-queue.pl -p
To rehash the quarantine attachement file : /var/qmail/bin/qmail-scanner-queue.pl -g
# sa = spamassassin
# ps = perl scanner
This should be enough to use SpamAssassin on the whole system.
I have to try to find how it can be linked with vpopmail in order to create preference for a specific domain or a specific user. (if someone knows : firstname.lastname@example.org)