Spamassassin rules update with sa-update

fwpeter

Verified User
Joined
Aug 18, 2006
Messages
108
Does anybody use sa-update to update Spamassassin rules on DirectAdmin?

I found upcoming howto. Is it safe to do this with DirectAdmin?

--------------------

SpamAssassin has a command line feature called sa-update. For it to function, you need several perl modules.
By default, the DirectAdmin install does not include LWP::UserAgent and Archive::Tar. These modules need to be installed before it will work.
Code:
   # cpan
   cpan> install LWP::UserAgent
Answer yes to all question asked. This will install the LWP::UserAgent module.
In some ocassions the installation fails on make test. To force the installation type the following command:
Code:
   cpan> force install LWP::UserAgent
After it finishes, type the following command to install Archive::Tar
Code:
   cpan> install Archive::Tar
When the installation is complete, exit by typing exit at the cpan command line. Then, type the following command to update SpamAssassin's checks. Note that this does not update the SpamAssassin code itself.
Code:
   # sa-update -D
If the command does not output any fatal errors and exits with code 0, the update has been completed. The feature would fit fine in a daily cronjob to update your SA checks.
There are three exit codes possible:
0 - updates were available and installed
1 - there were no fresh updates available
4 or higher - an error occured while downloading and extracting updates
Now restart SpamAssassin, this is only needed when the update exits with code 0.
Code:
   # killall spamd
   # /usr/bin/spamd -d -c -m 5
 
that would be also very usefull for me. Anyone tried that?
 
I have tried these, but it seems not to work :(

I am using FreeBSD and Debian. Both servers give error codes when I enter the last command (sa-update -D)

One server gives problems with zlib, but I have installed it with building Apache. The other server (Debian) sais something about error: gpg required but not found!.

Hope someone can help me. :eek:
 
Maybe you can try turning off gpg or install it.

I appreciate you give sa-update a try!
 
I did somthing similar to the above - first installed the required prerequisites using CPAN, then run SA-UPDATE.

Seemed to work OK (did update the SA 3.1.4 & 3.1.8 default rules) and hasn't caused any problems that I am aware of.

Not exactly an expert though!

PS: This was on CentOS 4.4
 
Followed the "how to"

but also bumped into the same error as Stofke: gpg required but not found.
Any ideas?

this is my output:
Code:
-bash-3.00# sa-update -D
[1716] dbg: logger: adding facilities: all
[1716] dbg: logger: logging level is DBG
[1716] dbg: generic: SpamAssassin version 3.2.0
[1716] dbg: config: score set 0 chosen.
[1716] dbg: dns: no ipv6
[1716] dbg: dns: is Net::DNS::Resolver available? yes
[1716] dbg: dns: Net::DNS version: 0.59
[1716] dbg: generic: sa-update version svn523403
[1716] dbg: generic: using update directory: /var/lib/spamassassin/3.002000
[1716] dbg: diag: perl platform: 5.008005 linux
[1716] dbg: diag: module installed: Digest::SHA1, version 2.11
[1716] dbg: diag: module installed: HTML::Parser, version 3.56
[1716] dbg: diag: module installed: Net::DNS, version 0.59
[1716] dbg: diag: module installed: MIME::Base64, version 3.01
[1716] dbg: diag: module installed: DB_File, version 1.815
[1716] dbg: diag: module installed: Net::SMTP, version 2.29
[1716] dbg: diag: module not installed: Mail::SPF ('require' failed)
[1716] dbg: diag: module installed: Mail::SPF::Query, version 1.998
[1716] dbg: diag: module not installed: IP::Country::Fast ('require' failed)
[1716] dbg: diag: module not installed: Razor2::Client::Agent ('require' failed)
[1716] dbg: diag: module not installed: Net::Ident ('require' failed)
[1716] dbg: diag: module not installed: IO::Socket::INET6 ('require' failed)
[1716] dbg: diag: module installed: IO::Socket::SSL, version 1.06
[1716] dbg: diag: module installed: Compress::Zlib, version 2.004
[1716] dbg: diag: module not installed: Time::HiRes ('require' failed)
[1716] dbg: diag: module not installed: Mail::DomainKeys ('require' failed)
[1716] dbg: diag: module not installed: Mail::DKIM ('require' failed)
[1716] dbg: diag: module not installed: DBI ('require' failed)
[1716] dbg: diag: module installed: Getopt::Long, version 2.34
[1716] dbg: diag: module installed: LWP::UserAgent, version 2.033
[1716] dbg: diag: module installed: HTTP::Date, version 1.47
[1716] dbg: diag: module installed: Archive::Tar, version 1.31
[1716] dbg: diag: module installed: IO::Zlib, version 1.05
[1716] dbg: diag: module not installed: Encode::Detect ('require' failed)
[1716] dbg: gpg: Searching for 'gpg'
[1716] dbg: util: current PATH is: /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
error: gpg required but not found!
 
Last edited:
Please install the Net::Ident per module and the gpg package from your linux distribution.
 
This howto comes from our website.

Anyway, this has only been tested on CentOS based servers, so yes, it could be that FreeBSD fails to install.

I'm not aware of the gpg bug. Is this on CentOS?
 
worked here too, i'm having lots and lots of mails comming through my server.. and not even sure if they should be there...

some header of a mail that did get through the spamfilter:
Code:
eturn-path: <[email protected]>
Envelope-to: [email protected]
Delivery-date: Thu, 15 May 2008 21:44:31 +0200
Received: from mail by breeze.be with spam-scanned (Exim 4.67)
	(envelope-from <[email protected]>)
	id 1JwjNG-0004MV-F9
	for [email protected]; Thu, 15 May 2008 21:44:26 +0200
X-Spam-Checker-Version: SpamAssassin 3.2.2 (2007-07-23) on server1.breeze.be
X-Spam-Level: 
X-Spam-Status: No, score=-77.8 required=5.0 tests=BAYES_99,
	DYN_RDNS_SHORT_HELO_HTML,HTML_MESSAGE,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_PBL,
	RCVD_IN_SORBS_DUL,RCVD_IN_XBL,RDNS_DYNAMIC,TVD_RCVD_IP,URIBL_AB_SURBL,
	URIBL_JP_SURBL,URIBL_OB_SURBL,URIBL_RHS_DOB,URIBL_SBL,URIBL_SC_SURBL,
	URIBL_WS_SURBL,USER_IN_WHITELIST autolearn=no version=3.2.2
Received: from 82.198.56.131.dyn.user.ono.com ([82.198.56.131] helo=familiar-8c95zn)
	by breeze.be with esmtp (Exim 4.67)
	(envelope-from <[email protected]>)
	id 1JwjNF-0004MK-1a
	for [email protected]; Thu, 15 May 2008 21:44:22 +0200
Received: from [82.198.56.131] by smtp-in.wanadoo.nl; Thu, 15 May 2008 20:46:24 +0100
From: "Russel Pittman" <[email protected]>
To: <[email protected]>
Subject: Der beste Preeeis im Web! Viiiaaaa .. - 0.88 EURO
Date: Thu, 15 May 2008 20:46:24 +0100
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0006_01C8B6CC.BD3C2C00"
X-Mailer: Microsoft Office Outlook, Build 11.0.5510
Thread-Index: Aca6QU0MW4JL842UYN5LFJL8B44VPT==
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
Message-ID: <01c8b6cc$bd3c2c00$8338c652@pointierkgs>

This is a multi-part message in MIME format.

how the hell can i set the score to a valid number (-77 is just not possible)
 
ok thanks for explaining that :)

One more question though ;)
how can i set the filter that mails from mailinglists cannot be return adresses?
(i get mail that have both from and to contain adresses that are a virtual adres for a mailinglist) for eg.
[email protected] (one of my many domains) is a forwarder to all the ppl that have a @breeze adress.)
and the from field contains [email protected] (which isn't possible as it is virtual, there isn't a login for that adress, so it's obviously spoofed)
 
Update the spamassassin successfully

I update the spamassassin successfully,
but the rules is put into
/var/lib/spamassassin/3.002004/updates_spamassassin_org

Can I just copy those rules to /usr/share/spamassassin which I think it is
Spamassassin's default rules path. Right?

Thank you.
 
I update the spamassassin successfully,
but the rules is put into
/var/lib/spamassassin/3.002004/updates_spamassassin_org

Can I just copy those rules to /usr/share/spamassassin which I think it is
Spamassassin's default rules path. Right?

Thank you.

When you run "sa-update" (and restart spamassassin) you don't need to copy the new files over the originals.
 
The other server (Debian) sais something about error: gpg required but not found!.

Hope someone can help me. :eek:

Bit late here, but for anyone searching the package you want to install is 'gnupg'

(apt-cache pkgnames | grep gpg failed for me on this one ;))
 
Additional to the first post a script like

#!/bin/sh
UPDATECMD="sa-update -D"
RESTARTCMD=`killall spamd; /usr/bin/spamd -d -c -m 5`

$UPDATECMD 2>/dev/null

if [ $? -eq 0 ]; then
echo "Updates where installed"
$RESTARTCMD
elif [ $? -eq 1 ]; then
echo "Already have the latest"
else
echo "Something went wrong"
fi

in the cron can be used to restart Spamd.
 
Found this old thread. Perhaps the use of sa-update is not clear for everyone, therefor quoting a little explanation from the sa website.

What is sa-update?

The goal of sa-update is to download new configuration files (rules, scores, etc,) so that SpamAssassin will use them to better catch spam and/or to avoid catching ham messages. The main reason to use sa-update is that the old method of disseminating rules, releasing a new version SpamAssassin, is a lengthy process that can take many months. Spam is rapidly changing, and new rules are often written in response. With sa-update, those rules can quickly (potentially within minutes) be distributed and the new spam caught.

Simply put, sa-update allows rules to be distributed as they are developed, while full SpamAssassin releases can focus on bug fixes and new features.

Using sa-update makes a lot of sense, since it will reduce the amount of spam received between version updates (and the last version 3.2.5 is already quite some months old!).

This howto works also fine on FreeBSD (we use it for nearly two years now), but if you have problems with GPG, try executing sa-update with:

Code:
sa-update -D --nogpg

Also a automatic script which can be used on FreeBSD:
Code:
======================================================================================

Script voor Update SpamAssassin: [sa_update.sh]

#!/bin/sh

# Author : Dillard Blom
# Purpose : Update spam-checking rules Spamassassin
#
# Usage : Adjust this script for your own use and insert this into your local crontab
#
# Command : /root/scripts/sa_update.sh (run from crontab)
#
# Created : 04-05-2007
# Updated :
#

/usr/local/bin/sa-update -D --nogpg

if [ $? -eq 0 ] ; then
# New rules are downloaded and installed, kill old SA and restart SA with new rules
kill -s KILL `ps waux | grep "/usr/bin/spamd" | awk '{print $2}'`
/usr/bin/spamd -d -c -m 5
exit 0
else
# Nothing new apparently, so do nothing for now.
exit 0
fi

======================================================================================

Create crontab entry ('crontab -u root -e'):

0 2 * * * /root/scripts/sa_update.sh
 
Server Update is not

PHP:
--2011-12-18 12:20:15--  (try: 6)  http://cpan.gazi.edu.tr/authors/01mailrc.txt.gz
Connecting to cpan.gazi.edu.tr|194.27.18.17|:80... failed: Connection timed out.
Retrying.
 
Back
Top