[leafnode-list] filtering spam articles using the "from" field

Laurence ljln at hbbs.org
Sat May 1 18:09:47 CEST 2004


Ray Abbitt wrote:
>
> It's actually fairly easy, but you may want to reconsider just a bit.
> I believe you will find that a lot of legitimate posts in your spool
> from users @xx.shawcable.net since shaw is one of the bigger cable
> connectivity providers in Canada.

I agree!  Maybe a filter or two on one of the 'Posting-Host' type headers
would be better.

> The following filter will work:
>
> pattern = ^From:.*shawcable.net
> action = kill

When did that change?  I thought the syntax for that was just a single line
in /etc/leafnode/filters:

^From:.*shawcable.net

(From http://leafnode.sourceforge.net/doc_en/applyfilter.8.html )

I knocked up a couple of small shell scripts to help with filters:

This one tests the effect of a possible filter before enabling it for real:

--- grepng ---
echo $*
for ff in `ls /var/spool/news/interesting.groups/` ;
 do echo $ff;
 ngname=`echo $ff | sed {s/\\\./\\\//g}` ;
 for mm in `ls /var/spool/news/$ngname/` ;
   do grep -q "$*" /var/spool/news/$ngname/$mm && grep Subject:
/var/spool/news/$ngname/$mm ;
   done ;
 echo "" ;
done
--- end ---

(The line that starts 'Subject:' is a continuation of the one above.)

e.g. To test the filter above, run this: 'grepng ^From:.*shawcable.net'

And then once I've updated my filters file one to apply the new filters to
all newsgroups:

--- applyfilt ---
for ff in `ls /var/spool/news/interesting.groups/` ; do
 echo $ff;
 applyfilter -v $ff ;
 echo "" ;
done
--- end ---

Laurence



More information about the leafnode-list mailing list