Updates :
Yes, I know, there are lot of english mistakes in this text. If you would like to correct them, feel free to mail me or to post in the forum....
Some interesting rulesets for Spam Assassin have been written, and they are updated very often (see also SA webpage in French). So it became very interesting to have a which does it for you, and someone wrote the RulesDuJour utility. But this utility lacks a GPG support !! So I wrote mine, using an apt-get like syntax, which also has some more features (like handling uncompatible rulesets).
Rule-get is also aware of incompatibles rulesets, and rulesets which includes other rulesets (such as the SARE HTML ruleset, which exists as a big file or a file with all 4-in-1). With time, some rulesets became obsoletes. The latest version of rule-get should handle more or less cleverly the obsoletes rule it installed, by deleting them and installing replacement rulesets if they exist. Can RulesDuJour do that ? I don't think so.
Imagine you automatically download everyday some ruleset. You don't manually check what's in the ruleset. So what if some spammer manages to crack the server which hosts those webpages ? He might put there some rules which would allow all his spams to get through. But he might also write some rules in order to tag all your mails as spams (except his spams). So would be the best way to loose some mails. With GPG support, it would need also need the spammer to do a false signature (should be impossible) or to get the GPG key of the guy who wrote the rule with his passphrase (should be impossible also).
For the moment, the only signed rules are Robert Menschell ones at SARE and mines (French rules (GPG Signature) and airmax.cf (GPG Signature)).
If you want to install rule-get on a Debian (unstable) distribution, you just need to install those packages : spamassassin, libwww-perl, libconfig-inifiles-perl, gnupg
. Or as root, just type apt-get install spamassassin libwww-perl libconfig-inifiles-perl gnupg
. Sorry no Debian package for rule-get, but you just need to download one file (see after).
I don't know for other distributions and unixes, but feedback would be appreciated.
Just download the Perl script : rule-get, and (optionnal) it's GPG signature. Check the signature, and take a text editor to ensure it's not a worm and that there is no backdoor. If needed change the $real_path variable ; you might want to use /etc/mail/spamassasin or /var/amavisd/etc/mail/spamassassin with a chrooted amavisd. So the line :
my $real_path="/etc/spamassassin";Would become :
my $real_path= "/etc/mail/spamassassin";
Make it executable (chmod +x rule-get), and copy the rule-get to a directory in the $PATH like /usr/local/sbin (not needed, but it's preferable). Now you are ready for downloading the ini file, so just type (as root, did I say you must be root for using it ?):
rule-get get-rulesThis will
rule-get list
rule-get install RuleName1 RuleName2, etc...Where RuleName1, RuleName2, etc are the name of rulesets. ex :
rule-get install French rule-get install French BackHair Weeds2 ChickenPox AntiDrug
rule-get view installedOk, the new view option has also other usefull options :
rule-get show avail : shows availables (non-obsolete) rulesets rule-get show installed : shows installed rulesets rule-get show might_install : shows only rulesets which might be installed rule-get show uninstalled : shows uninstalled non-obsoletes rulesets rule-get show all : shows all rulesets rule-get show obsoletes : shows obsoletes rulesets
If you want to updates installed ruleset (by rule-get), juste type :
rule-get updateThis will recognize all installed rulesets, and install new version if they are available, and the GPG key matches.
You will probably find usefull to do this on a daily basis, so add something like this in your cron (edit by crontab -e) :
# Get latest SpamAssassin rules. 42 4 * * * /usr/local/bin/rule-get update
rule-get remove RuleName1 RuleName2, etc...(Where RuleName1, RuleName2, etc are the name of rulesets, like for the install command).
rule-get remove-all
rule-get get-rulesLike you did when you installed rule-get :-). Next time you will do an update, it might also obsolete some old rules, and possibly install new ones instead of the olds. If you don't want update to handle obsolete rulesets, use soft-update :
rule-get soft-updateIf you prefer to delete the obsolete instead of replacing them with new ones, do a
rule-get remove-obsoletesbefore the update.
Rulesets are stored in the rules.ini file, which is located in your $real_path directory. Please don't touch this file !! It will be erased the next time you will update the list of rulesets. Just add your new rulesets in your $HOME/.rules.ini file. But I would be pleased to add the new ruleset to the common rules.ini if you inform me that a new ruleset exist.
Too lazy to write this section, just look at the existing rules.ini files, it shouldn't be too difficult to understand. Ok, with newest improvements it should it is a little more difficult, but nothing difficult. With latest versions, saying a is uncompatible with will also mean b is uncompatible with a. Saying ruleset a includes ruleset b also means you can't install b if a is already installed.