🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #82252

Proposed Cleanfeed changes (vs. Release 271):

#82252
From: D. Stussy
Date: Mon, 30 Nov 2009 00:07
167 lines
7945 bytes
Changes:
1)  Print cleanfeed release number/date into statistics files.
2)  Filter for politics groups need not consume one of the two local
topics.
3)  Fix "Reply-To:" header check.  ".invalid" TLD not valid for it.
4)  Make message-ID checking case insensitive.

Default/sample "bad_from" file contents (targets RFC 2606 entries, common
syntax errors, and Microsoft TLD abuse):
^@
@\.
@[^(, ]*\.\.
@[[:alnum:]]*@
@(.+\.)?test>?$
@.+\.phx\.gbl>?$
@(.+\.)?[0-9]*>?$
@(.+\.)?localhost>?$
@(.+\.)?localdomain>?$
@(.+\.)?example(\.[a-z]{3,})?>?$

Note:  The entry containing [0-9] also matches where "@" is the last
character - i.e. no domain-part.  Such might not be obvious at first
glance.  The entry containing "example" matches gTLDs only as "example.de",
a match with a ccTLD, is a valid, registered domain.

Cleanfeed patch:
--- ~news/bin/filter/cleanfeed.txt      2009-10-13 12:23:08.000000000 +0000
+++ ~news/bin/filter/filter_innd.pl     2009-11-29 23:22:37.000000000 +0000
@@ -5,7 +5,8 @@
 #
 # Modified by Steve Crook <steve@mixmin.net>
 # Redistributed in accordance with the terms of the Artistic license.
-# $Id: cleanfeed 271 2009-10-13 12:23:08Z cleanfeed $
+# $Id: cleanfeed 271 2009-10-13 12:23:08z cleanfeed $
+$cleanfeed_version= '271 (2009-10-13 12:23:08z)';
 #
 # This software is distributed under the terms of the Artistic License.
 # Please see the LICENSE file in the distribution.
@@ -88,9 +89,10 @@

     low_xpost_maxgroups => 6,   # max xposts in low_xpost_groups
     meow_ext_maxgroups => 2,    # max xposts from meow_groups to other
groups
+    politics_ext_maxgroups => 2, # max xposts from politics_groups to
other groups
     off_topic_maxgroups => 2,   # How many off topic groups allowed in a
distro

     binaries_in_mod_groups => 0,    # allow binaries in moderated groups?
     max_encoded_lines => 15,    # number of encoded binary lines to allow
     max_base64_lines => 200,    # Allow x lines of content containing
Base64
                                 # in non-binary groups
@@ -173,6 +175,7 @@
     meow_groups => '^alt\.fan\.karl-malden\.nose|^alt\.flame|^alt\.troll'.
         '|^alt\.alien\.vampire\.flonk\.flonk\.flonk|^alt\.romath'.
         '|^alt\.snuh|^alt\.fan\.natasha',
+    politics_groups => '\.politi[ck]',

     ### Topic groups allow administrators to limit crossposting from
defined
     ### groups to undefined groups.  The allowed number of groups is
defined
@@ -298,8 +301,8 @@
                     phl_exempt phl_exclude supersedes_exempt bad_nph_hosts
                     phn_exempt phr_exempt phn_exclude flood_groups
                     refuse_messageids net_abuse_groups spam_report_groups
-                    adult_groups not_adult_groups faq_groups ratio_exclude
-                    image_allowed image_extensions meow_groups
+                   adult_groups not_adult_groups faq_groups
politics_groups
+                   image_allowed image_extensions meow_groups
ratio_exclude
                     topic1_groups topic2_groups off_topic_maxgroups)) {
                 if (defined $config_append{$_}) {
                     $config{$_} .= "|$config_append{$_}";
@@ -625,6 +628,8 @@
             and /$config{low_xpost_groups}/o;
         $gr{meow}++ if $config{meow_groups}
             and /$config{meow_groups}/o;
+       $gr{politics}++ if $config{politics_groups}
+           and /$config{politics_groups}/o;
         $gr{topic1}++ if $config{topic1_groups}
             and /$config{topic1_groups}/o;
         $gr{topic2}++ if $config{topic2_groups}
@@ -783,10 +788,14 @@

         return reject('Too many newsgroups (meow)', 'Too many newsgroups')
             if $gr{meow}
-                #and $gr{meow} != scalar @groups
                 and $config{meow_ext_maxgroups}
                 and ($fupcnt - $gr{meow}) > $config{meow_ext_maxgroups};

+       return reject('Too many newsgroups (politics)', 'Too many
newsgroups')
+           if $gr{politics}
+               and $config{politics_ext_maxgroups}
+               and ($fupcnt - $gr{politics}) >
$config{politics_ext_maxgroups};
+
         return reject('Off-topic newsgroups (topic1)', 'Off-topic
newsgroups')
             if $gr{topic1}
                 and $gr{topic1} > 1
@@ -889,7 +898,6 @@
                 return reject('HTML post')
                     if $lch{'content-type'} =~ m#text/html#;

-
             # MIME HTML without Text
             return reject('HTML Multipart without Text/Plain.')
                 if $lch{'content-type'} =~ /multipart/
@@ -1113,16 +1121,15 @@
             if $hdr{Subject} =~ m#\[(\d+)/(\d+)\]$# and $1 > $2;
         #

-        # Reject bad From headers.  We also check Sender and Reply-To
headers
-        # against the same Regular Expression.
+       # Reject bad From/Sender/Reply-To headers.
         if ($Bad_From) {
-            return reject("Banned Reply-To ($1)", 'Bad Reply-To')
-                if $hdr{'Reply-To'} =~ $Bad_From_RE;
-            return reject("Banned Sender ($1)", 'Bad Sender')
+           return reject("Bad Reply-To ($hdr{'Reply-To'})",'Bad Reply-To')
+               if $hdr{'Reply-To'} =~ qr/($Bad_From|@(.+\.)?invalid>?$)/i;
+           return reject("Bad Sender ($hdr{Sender})",'Bad Sender')
                 if $hdr{Sender} =~ $Bad_From_RE;
-            return reject("Banned From ($1)", 'Bad From')
+           return reject("Bad From ($hdr{From})", 'Bad From')
                 if $hdr{From} =~ $Bad_From_RE;
-        };
+       }

         # Reject bad Subject headers.
         return reject("Subject ($1)", 'Bad Subject')
@@ -1586,7 +1593,7 @@
     return '' if not $config{do_mid_filter};
     my ($id) = @_;

-    if ($config{refuse_messageids} and $id =~
/$config{refuse_messageids}/o) {
+    if ($config{refuse_messageids} and $id =~
/$config{refuse_messageids}/io) {
         $status{refused}++;
         return 'No';
     }
@@ -1654,6 +1661,7 @@
     . "<title>Cleanfeed Status</title>\n"
     . "</head>\n<body>\n\n"
     . "<p>\n"
+    . "<b>Cleanfeed Version:</b> " . $cleanfeed_version . "<br>\n"
     . "<b>Filter started:</b> " . scalar(localtime $Start_Time) . "<br>\n"
     . "<b>Report generated:</b> " . scalar(localtime) . "<br>\n"
     . 'Uptime: ' . ($now - $Start_Time) . " seconds\n"
@@ -1750,7 +1758,8 @@
         slog('E', "Cannot open $config{statfile}: $!");
         return;
     }
-    print FILE 'Filter started: ' . scalar(localtime $Start_Time) . "\n"
+    print FILE 'Cleanfeed Version: ' . $cleanfeed_version . "\n"
+    . 'Filter started: ' . scalar(localtime $Start_Time) . "\n"
     . 'Report generated: ' . scalar(localtime) . "\n"
     . 'Uptime: ' . ($now - $Start_Time) . " seconds\n\n"
     . "Accepted: $status{accepted}\nRejected: $status{rejected}\n";

Technical Details
Message-ID: <hev2cb$bl9$1@snarked.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.CARNet.hr!weretis.net!feeder1.news.weretis.net!news.snarked.org!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <hev2cb$bl9$1@snarked.org>
Subject: Proposed Cleanfeed changes (vs. Release 271):
Date: Sun, 29 Nov 2009 16:07:39 -0800
From: "D. Stussy" <spam+newsgroups@bde-arc.ampr.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.CARNet.hr!weretis.net!feeder1.news.weretis.net!news.snarked.org!not-for-mail
Newsgroups: news.software.nntp
Lines: 167
Reply-To: "D. Stussy" <replies@newsgroups.kd6lvw.ampr.org>
NNTP-Posting-Host: pool-71-118-30-21.lsanca.dsl-w.verizon.net
X-Trace: snarked.org 1259539659 11945 71.118.30.21 (30 Nov 2009 00:07:39 GMT)
X-Complaints-To: newsmaster+complaints@snarked.org
NNTP-Posting-Date: Mon, 30 Nov 2009 00:07:39 +0000 (UTC)
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478