Spam filtering and mailagent
Hi,
There are some sites that update a list of spammers addresses
quite regularily, and I use that to filter out all the junk that by
all reports is increasingly evident. I run two scripts weekly through
cron to grab the lists (the listing are given below).
I have mailagent then configured to look at the adresses in
that list and send an automated message to the sender asking to be
removed from the list (I could just delete the mail, I guess), with a
copy to the postmaster.
Haven't smelt spam in weeks. I guess I could invest in
sendmail configuration, but mailagent hacking is relatively easy.
manoj
ps: Yes, I do recieve spam, I just don't get to see it unless I want
to (well, may happen one of these days).
-------------------------------------------------------------------------
#! /usr/bin/perl
use strict;
use LWP::Simple;
my $AOL = "http://www.idot.aol.com/preferredmail/";
my $SPAMLIST = "$ENV{'HOME'}/etc/SPAM-aol";
chdir;
$_ = get $AOL or die "Cannot get $AOL\n";
s/^[\s\S]*<MULTICOL.*\n// or die "missing MULTICOL in $_ ";
s/<\/MULTICOL[\s\S]*// or die "missing /MULTICOL in $_ ";
open STDOUT, ">$SPAMLIST" or die "create $SPAMLIST: $!";
## be sure $1 is what you want in the annotation
print map "/^((.*[\@.])?\Q$_\E)\$/i\n", split /\n/;
exit 0;
__END__
-------------------------------------------------------------------------
#! /usr/bin/perl
use strict;
use LWP::Simple;
my $MINDSPRING = "http://www.atl.mindspring.com/cgi-bin/spamlist.pl";
my $SPAMLIST = "$ENV{'HOME'}/etc/SPAM-mindspring";
chdir;
$_ = get $MINDSPRING or die "Cannot get $MINDSPRING\n";
open STDOUT, ">$SPAMLIST" or die "create $SPAMLIST: $!";
## be sure $1 is what you want in the annotation
##print map "/^((.*[\@.])?\Q$_\E)\$/i\n", split /\n/;
s,^[\s\S]*?<pre>[^\n]*\n,, or
die "can't find block of hostnames";
s,</pre>[\s\S]*?<pre>[^\n]*\n,, or
die "can't find block of email addresses";
s,</pre>[\s\S]*$,,;
print map "/^(" . (/\@/ ? "" : "(.*[\@.])?") . "\Q$_\E)\$/i\n", split /\n/;
exit 0;
__END__
-------------------------------------------------------------------------
#excerpt from mailagent.rules
######################################################################
######################################################################
# #
# Now, take care of spammers. #
# #
######################################################################
######################################################################
# Not explicitely for me. Mail lost or bcc'ed.
!To !Cc: srivasta { REJECT LOST };
#This shall be greatly expanded
Relayed From Reply-To Message-Id: "SPAM" {
ANNOTATE -d X-Spam Smells like spam from %1;
REJECT SPAM };
Relayed From Reply-To Message-Id: "SPAM-aol" {
ANNOTATE -d X-Spam Smells like spam-aol from %1;
REJECT SPAM };
Relayed From Reply-To Message-Id: "SPAM-mindspring" {
ANNOTATE -d X-Spam Smells like spam-mindspring from %1;
REJECT SPAM };
X-[0-9]: /cyberpromo\.com/i {
ANNOTATE -d X-Spam Smells like spam from cyberpromo;
REJECT SPAM };
X-Mailer: /floodgate/i {
ANNOTATE -d X-Spam Smells like spam from floodgate;
REJECT SPAM };
Message-ID: /\<[^\@]*\>/, /\@.*\@/ {
ANNOTATE -d X-Spam Smells like a bogus message ID;
REJECT SPAM };
<LOST> Comments: /^Authenticated sender/i {
ANNOTATE -d X-Spam Smells like spam;
REJECT SPAM };
<!SPAM> Comments: /^Authenticated sender/i { REJECT MAY_SPAM };
<MAY_SPAM> Subject: /money/i { ANNOTATE -d X-Spam Money; REJECT SPAM };
<MAY_SPAM> X-Uidl: /^\w+$/i { REJECT SPAM };
<MAY_SPAM> Precedence: /^bulk/i { REJECT SPAM };
<MAY_SPAM> { REJECT INITIAL };
<SPAM> { VACATION off; MESSAGE ~/etc/spam;
SAVE spam.list };
#
# The rest is potentially personal mail
# By default, beep three times for mail ending up in my mailbox
#
{ BEEP 3; REJECT }
All: /./ { UNIQUE -a; SAVE important };
######################################################################
######################################################################
# #
# End of mailagent rules #
# #
######################################################################
######################################################################
----------------------------------------------------------------------
etc/spam contains:
----------------------------------------------------------------------
Subject: This is a recording... [Re: %R]
Organization: %o
Cc: postmaster@%A
Bcc: srivasta
Precedence: bulk
[This is a recording -- Last revision made on %T]
Dear %N:
I've received your message of %[Date], regarding
"%R".
[deleted]
--
It is inconceivable that a judicious observer from another solar
system would see in our species -- which has tended to be cruel,
destructive, wasteful, and irrational -- the crown and apex of cosmic
evolution. Viewing us as the culmination of *anything* is grotesque;
viewing us as a transitional species makes more sense -- and gives us
more hope. Betty McCollister, "Our Transitional Species", Free
Inquiry magazine, Vol. 8, No. 1
Manoj Srivastava <url:mailto:srivasta@acm.org>
Mobile, Alabama USA <url:http://www.datasync.com/%7Esrivasta/>
--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org .
Trouble? e-mail to templin@bucknell.edu .
Reply to: