Aloha Beau,
nice piece of work. Nevertheless I have 1 small improvement:
Some users of Don's original script have experienced unscanned spam =
passing
thru, when the machine is extremely busy. I tracked down this issue. =
spamc
retries to connect spamd only 3 times and quits then with a Filter Error =
-5.
YOu can track this in the system logs and in XMail's logs as well.
The workaround is simple:
If spamc's output does not contain the SA x-header, it will be submitted
again after a certain delay. The delay is increasing with each retry, =
which
will give spamd more time to recover.
I also replaced the backticked call with IPC:Open2, which has less =
overhead.
Here is the modified part, which you can adapt for your script:
#-----------------------------------------------------------------
# MOD.start
#-----------------------------------------------------------------
# pass rest to spamc
#MOD my $checkedEmail=3D`spamc -f < $tmpFile`;
my $delay =3D 0;
my $checkedEmail;=09
do {
$checkedEmail =3D '';
print "*** spamc delayed: $delay sec.\n" if ($delay > 0) && ($DEBUG
=3D=3D 1);
sleep($delay);
open2(*SPAMC_R,*SPAMC_W,'spamc -f');
print SPAMC_W $tmpFile;
close(SPAMC_W);
my $bak =3D $/;
undef $/;
$checkedEmail =3D <SPAMC_R>;
close(SPAMC_R);
$/ =3D $bak;
$delay =3D $delay+5;
} while($checkedEmail !~ /X-Spam-Flag/gms );
#-----------------------------------------------------------------
# MOD.end
#-----------------------------------------------------------------
Further ideas are welcome ...
All the best,
Harald
> -----Urspr=FCngliche Nachricht-----
> Von: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Im Auftrag von Beau E. Cox
> Gesendet: Mittwoch, 26. Mai 2004 19:47
> An: [EMAIL PROTECTED]
> Cc: Dale Qualls
> Betreff: [xmail] [ANNOUNCE] bsa_filter.pl
>=20
>=20
> I am pleased to announce the first public release of
> 'bsa_filter.pl' - a SpamAssassin xmail filter written in perl.
> The script is a modification/upgrade of Don Drake's sa_filter.pl.
>=20
> Please be aware that this script is 'beta' and it should be carefully
> tested before being thrown into production.
>=20
> The script and documentation may be found at:
>=20
> http://xmail.beaucox.com
>=20
> Davide - can you put a link on your site pointing to my site with a
> description of something like:
>=20
> <a href=3D"http://xmail.beaucox.com/">bsa_filter.pl</a> - a=20
> perl SpamAssassin
> filter with configurable spam message forwarding and/or trashing.
>=20
> A snippet of the documentation:
>=20
> NAME
> bsa_filter.pl - an xmail SpamAssassin filter.
>=20
> DESCRIPTION
> bsa_filter.pl is an xmail mail server filter to process incoming
> messages through SpamAssassin. It is based on Don=20
> Drakes's script -
> sa_filter.pl, version 1.3. The following enhancements to=20
> his work were
> made:
>=20
> Rewritten using perl oo package/class
> This was mainly done to make intra-module=20
> communication easier.
>=20
> Configurable forwarding
> Spam messages may be forwarded to an administrative=20
> email account
> for review/blacklisting/whitelisting/etc. based on a=20
> settable spam
> score threshold.
>=20
> Configurable trashing
> Spam messages above a settable spam score may be=20
> summarily trashed.
>=20
> Enhanced log
> The spam log has been enhanced: additional fields=20
> have been added.
>=20
> PREREQUSITES
> The follwing modules should be installed:
>=20
> xmail
> A running xmail mail server. See the "CONFIGURATION"=20
> section below
> for changes that must be made to filter exit codes for older
> versions.
>=20
> Mail::SpamAssassin
> I have tested only with version 2.63; the filter=20
> should/may work
> with earlier versions that do not have major=20
> operational changes.
>=20
> Net::SMTP
> Found in perl module libnet; I use libnet 1.18.
>=20
> CONFIGURATION
> ....
>=20
> Aloha =3D> Beau;
>=20
> -
> To unsubscribe from this list: send the line "unsubscribe xmail" in
> the body of a message to [EMAIL PROTECTED]
> For general help: send the line "help" in the body of a message to
> [EMAIL PROTECTED]
>=20
-
To unsubscribe from this list: send the line "unsubscribe xmail" in
the body of a message to [EMAIL PROTECTED]
For general help: send the line "help" in the body of a message to
[EMAIL PROTECTED]