🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
54 messages
54 total messages Page 2 of 2 Started by John F. Morse Sat, 07 Mar 2009 17:10
Page 2 of 2 • 54 total messages
Re: Can Cleanfeed filter on a specific user?
#80367
Author: Son of Serpent Esq
Date: Wed, 11 Mar 2009 02:40
46 lines
2497 bytes
John F. Morse wrote:
> This is similar to what Steve recommended for multiple bad guys:
>
>
> if ($hdr{'From'} =~ /
>         steve\@mixmin\.net      # Troll
>     |   example\@invalid\.org   # Flooder
>     |   \@baddomain.com         # Shoe sales
> /x) {
>
>
> I did try the above, but perl -wc reports a syntax error that I couldn't 
> find/fix. Maybe it was a missing curly bracket?

You would just need to add what to do when one of those conditions
matches. Here's what I do:

###
 if ($hdr{'From'} =~ /
         steve\@mixmin\.net      # Troll
     |   example\@invalid\.org   # Flooder
     |   \@baddomain.com         # Shoe sales
 /x) {
 saveart('local.reject.from');
   if ($hdr{Path} =~ /^not\-for\-mail$/) { 
   return reject('Please read *local group here* '); 
   }; # end path check
 }; # end reject from
###

I do the path check for local posts "not-for-mail" because I'm 
not trying to save usenet and just want to make sure stuff I 
consider abuse does not originate from my site.

And I don't want to reject anything posted to my local groups so I
put everything between:

 if ($hdr{Newsgroups} !~ /^mylocalgroups/) {
 
  #  All my filters are inside here.

 );

This leaves the option open to discuss any problems in my local
groups. Just in case I screw something up. ;)
Re: Can Cleanfeed filter on a specific user? (File based solution)
#80368
Author: D. Stussy
Date: Wed, 11 Mar 2009 02:41
68 lines
3698 bytes
"Jeffrey M. Vinocur" <jeff@litech.org> wrote in message
news:gp7244$ut5$1@puck.litech.org...
> In article <gp4jp2$tc5$1@optima7.xanadu-bbs.net>,
> John F. Morse <dont.bother> wrote:
> >
> >Can your my $badpeople = 'aol\.com'; be added to in the future with the
> >alternation metacharacter '|' ? Such as:
> >
> >my $badpeople = 'aol\.com'|'gmail\.com'|'microsoft\.com'|'ex-wife';
> >
> >and so forth?
>
> Eek not quite like that.
>
> The single quotes define a string.  The equals sign puts that
> string into a variable.  When you use the variable in a regular
> expression (or almost anywhere else), the contents of that string
> are inserted in place of the variable.
>
> So you can't do
>
> my $badpeople = 'aol\.com'|'gmail\.com'|'microsoft\.com'|'ex-wife';
>
> any more than you can do
>
> print 'aol\.com'|'gmail\.com'|'microsoft\.com'|'ex-wife';
>
> because there's nothing magical about combining strings with | to
> make some extra special kinda of string that you're then putting
> into a variable.  (The | used as top-level syntax like you're
> doing means something totally different.)
>
> But you -can- absolutely do what you're intending, by making one
> long string that goes into a variable, and then putting that into
> the regular expression.  (It's the regular expression that makes
> the | mean what you think it means.)  Like this:
>
> my $badpeople = 'aol\.com|gmail\.com|microsoft\.com|ex-wife';

My solution was file based (cleanfeed.local):

sub local_filter_last {
        return reject('MI5 Spam')
                if $lch{subject} =~
/M.*I.*5.*P.*E.*R.*S.*E.*C.*U.*T.*I.*O.*N/i;
        return reject('Banned From header address %1')
                if $Bad_From and ($hdr{'From'} =~ /($Bad_From)/i);
        return reject('Banned Sender header address %1')
                if $Bad_From and ($hdr{'Sender'} =~ /($Bad_From)/i);
        return reject('Banned Reply-To header address %1')
                if $Bad_From and ($hdr{'Reply-To'} =~ /($Bad_From)/i);
}

sub local_config {
...
        read_regex('bad_from',\$Bad_From);
}


As it turns out, the read_file subroutines work from the cleanfeed.local
file too.  However, I'm not certain about the "%1" parameter - except that
"$1" didn't work.  What do I need there - or do I need to put the "if"
clause first?

Added bonus - my "MI5 Persecution" killer.  ;-)
Occasionally, it does still show up!

Re: Can Cleanfeed filter on a specific user? (File based solution)
#80374
Author: D. Stussy
Date: Wed, 11 Mar 2009 23:03
41 lines
2783 bytes
"D. Stussy" <spam@bde-arc.ampr.org> wrote in message
news:gp78cd$689$1@aux.snarked.org...
> [A fix to my prior posting.  I needed doubled-quotes.  Argh!]
> ...
> My solution was file based (cleanfeed.local):
>
> sub local_filter_last {
>         return reject('MI5 Spam')
>                 if $lch{subject} =~
> /M.*I.*5.*P.*E.*R.*S.*E.*C.*U.*T.*I.*O.*N/i;
>         return reject('Banned From header address %1')
>                 if $Bad_From and ($hdr{'From'} =~ /($Bad_From)/i);
>         return reject('Banned Sender header address %1')
>                 if $Bad_From and ($hdr{'Sender'} =~ /($Bad_From)/i);
>         return reject('Banned Reply-To header address %1')
>                 if $Bad_From and ($hdr{'Reply-To'} =~ /($Bad_From)/i);
> }
>
> sub local_config {
> ...
>         read_regex('bad_from',\$Bad_From);
> }

Corrected snippet (and optimized):

sub local_filter_last {
        return reject('MI5 Spam')
                if $lch{subject} =~
/M.*I.*5.*P.*E.*R.*S.*E.*C.*U.*T.*I.*O.*N/i;
        if ($Bad_From) {
                return reject("Banned From address: $1",'Banned From')
                        if $hdr{'From'} =~ /($Bad_From)/i;
                return reject("Banned Sender address: $1",'Banned Sender')
                        if $hdr{'Sender'} =~ /($Bad_From)/i;
                return reject("Banned Reply-To address: $1",'Banned
Reply-To')
                        if $hdr{'Reply-To'} =~ /($Bad_From)/i;
        }
}

Page 2 of 2 • 54 total messages
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads