🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #74386

Re: Cleanfeed config to allow HTML and binary attachments

#74386
From: John F. Morse
Date: Tue, 17 Oct 2006 02:48
561 lines
23276 bytes
Jeffrey M. Vinocur wrote:

>In article <4WSYg.73790$QZ1.22699@bgtnsc04-news.ops.worldnet.att.net>,
>John F. Morse <xanadu.bbs@invalid.net> wrote:
>  
>
>>I'd sure like to know why you think this. I need to learn why, and I 
>>hope you don't consider my inquiry to mean I dispute what you say. I'm 
>>just very curious, and want to learn the nuts and bolts so I can better 
>>help myself (and others) in the future.
>>
>>I'm not trolling or looking for any argument. I'm just curious why my 
>>testing using the final arbitrator -- the computer -- seems to run this 
>>script OK, but you feel it cannot be trusted.
>>    
>>
>
>Okay, let me tackle this first to get it out of the way, and then
>I'll try to get through the rest of the post.
>
>You're essentially saying, "Why bother having configuration files
>and settable options, when I can just make changes directly to
>the source code?"
>
>This is a question that has long been settled, which is why
>essentially every software package of any substance has a system
>of some kind to allow the user to configure it without modifying
>the source.
>
>Here are a couple reasons off the top of my head:
>
>  (1) The software can be more robust if the developer sets out
>      clearly where modifications should take place, rather than
>      having to try to write code that will work even when
>      changes are made to it by someone who doesn't understand
>      the assumptions underlying it.
>
>  (2) When it comes time to upgrade to a new version, it's much
>      easier to figure out what customization you've done when
>      it's all set out in a separate file, rather than having to
>      extract it back out from the source and reapply those
>      changes to the new version.
>
>  (3) When talking to other people about your configuration, it's
>      easier to communicate clearly by describing the settings
>      you're using, rather than the changes you've made to the
>      source code.
>
>Your testing may be enough to convince you that #1 isn't a
>problem for you, and well and good.  But #2 is the problem that
>I'm worried about down the road.  And probably we're having #3 as
>we speak.
>


Ah ha! I see your point(s) now!

My balking was primarily (probably all) due to my looking at the two 
Perl files and considering them as "configuration" files (files of options).

I really didn't consider these Perl files (file.pl) as a source or 
source code, although they are the source of the commands and variables 
for Perl -- which I considered the "software" or "source code."

With that in mind, I could add the code to the local.pl file, then add 
the pointer to point to it in the filter_innd.pl file.

But maybe I've already done this?! Perhaps I have something 
misconfigured from the git-go, but Cleanfeed still processed, making me 
believe I have everything correct?

Let me show you what I actually have, and have been using for the past 
few months (please keep an eye on my shell commands to determine where I 
am). This is lengthy, but necessary to show what I have. In any reply, 
please delete all but the first couple of lines of each file (so I can 
tell which file is which).

john@Wintergreen18:~$ ssh optima7
Password:
Linux optima7 2.4.27-2-386 #1 Wed Aug 17 09:33:35 UTC 2005 i586 GNU/Linux

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
No mail.

Last login: Mon Oct 16 16:47:37 2006 from wintergreen18.my.net

john@optima7:~$ cd /etc/news

john@optima7:/etc/news$ ls -al
total 376
drwxr-xr-x   3 root root  1248 2006-09-16 20:04 .
drwxr-xr-x  98 root root  5456 2006-08-28 19:24 ..
-rw-r--r--   1 root root   162 2006-07-16 14:44 actsync.cfg
-rw-r--r--   1 root root   158 2006-07-15 10:33 actsync.cfg_original
-rw-r--r--   1 root root   326 2006-07-15 09:33 actsync.cfg_test
-rw-r--r--   1 root root  1120 2006-07-16 15:14 actsync.ign
-rw-r--r--   1 root root   382 2006-07-15 09:01 actsync.ign_original
-rw-r--r--   1 root root   304 2006-06-18 13:01 buffindexed.conf
-rw-r--r--   1 root root 53067 2006-08-30 18:03 cleanfeed
-rw-r--r--   1 root root  7397 2006-06-24 05:28 cleanfeed.conf_original
-rw-r--r--   1 root root 87179 2006-06-18 13:01 control.ctl
-rw-r--r--   1 root root   859 2006-06-18 13:01 cycbuff.conf
-rw-r--r--   1 root root   495 2006-06-18 13:01 distrib.pats
-rw-r--r--   1 root root  1536 2006-09-16 19:59 expire.ctl
drwxr-xr-x   2 root root   416 2006-10-01 11:45 filter
-rw-r--r--   1 root root  5510 2006-09-16 20:01 incoming.conf
-rw-r--r--   1 root root  4960 2006-07-21 18:40 inn.conf

<snip>

john@optima7:/etc/news$ less cleanfeed

# vim: set tabstop=4 shiftwidth=4 autoindent smartindent smarttab 
syntax=perl:
#
# Copyright 1999 Jeremy Nixon <jeremy@exit109.com>
# Copyright 2001 Marco d'Itri <md@linux.it>
#
# This software is distributed under the terms of the Artistic License.
# Please see the LICENSE file in the distribution.
#

# CHANGE THE BELOW SETTING!
# Directory where cleanfeed.local and the other configuration files live.
# Set this to undef to not use any external file.

#Changed below 20060627 by JFM
#$config_dir = '/news/bin/filter';
#To
$config_dir = 'etc/news/bin/filter';

##############################################################################
# Server configuration
#
# Set $MODE according to what you're running.
# Acceptable values: inn, highwind.
# If you are running a highwind-like server then the value set here is 
ignored
# and the default from highwind.pl is used.

$MODE ||= 'inn';

##############################################################################
# WARNING: NO USER SERVICEABLE PARTS BELOW THIS LINE
# IF YOU WANT TO CHANGE SOMETHING, PLEASE USE cleanfeed.local
##############################################################################

# default configuration
sub get_config {
        %config = (
        verbose => 1,                   # verbose rejection reasons in 
news.notice/logfile?
        aggressive => 1,                        # set to 0 if your 
lawyers are paranoid
        maxgroups => 14,                        # maximum number of 
groups in a crosspost
        block_binaries => 1,            # block misplaced binaries
        block_late_cancels => 0,        # block cancels of rejected articles
        block_user_spamcancels => 1,# reject spam cancels with X-Trace 
or N-P-H
        block_user_cancels => 0,        # accept only spam cancels
        block_extra_reposts => 1,       # block reposts for articles not 
cancelled

        do_md5 => 1,                            # do the md5 checks?
        do_phl => 1,                            # do the 
posting-host/lines EMP check?
        do_fsl => 1,                            # do the 
from/subject/lines EMP check?
        do_scoring_filter => 1,         # use the scoring filter?

        do_emp_dump => 1,                       # dump EMP histories to 
a file for persistence?
        emp_dump_file => '',            # file to dump EMP histories to

        MD5RateCutoff => 5,                     # reject if this many 
copies are in the history
        MD5RateCeiling => 85,           # only count this high
        MD5RateBaseInterval => 7200,# How long to wait before 
decrementing the count
        PHLRateCutoff => 20,
        PHLRateCeiling => 80,
        PHLRateBaseInterval => 3600,
        FSLRateCutoff => 20,
        FSLRateCeiling => 40,
        FSLRateBaseInterval => 1000,

        fuzzy_md5 => 1,                         # screw around with the 
body before md5ing?
        fuzzy_max_length => 700,        # don't screw with bodies over 
this many lines
        md5_max_length => 2000,         # don't md5 articles over this 
many lines
        trim_interval => 900,           # trim hashes every N seconds
        stats_interval => 3600,         # write status file every N seconds
        MIDmaxlife => 4,                        # time to keep rejected 
message-ids, in hours
        md5_skips_followups => 1,       # avoid MD5 check on articles 
with References?
        do_mid_filter => 1,                     # use the message-id 
CHECK filter? (INN only)
        do_supersedes_filter => 1,      # do the excessive supersedes 
filter?
        drop_useless_controls => 1,     # drop sendsys, senduuname, 
version control msg
        drop_ihave_sendme => 1,         # drop ihave, sendme control 
messages

        low_xpost_maxgroups => 6,       # max xposts in low_xpost_groups
        meow_ext_maxgroups => 2,        # max xposts from meow_groups to 
other groups

        binaries_in_mod_groups => 0,    # allow binaries in moderated 
groups?
        max_encoded_lines => 15,        # number of encoded binary lines 
to allow

        block_mime_html => 1,           # block MIME encapsulated HTML 
(attached files)
                                                                #  (NOT 
straight or multipart/alternative)
        block_html => 1,                        # block text/html but 
not multipart/alternative
        block_multi_alt => 0,           # block multipart/alternative 
articles

        active_file => '',      # active file to determine which groups 
are moderated

        # Logging and pid_file don't work for INN (uses news.notice)
        log_directory => '',
        log_name => '',
        log_accepts => 0,                               # include 
accepted articles in the log?
        max_log_size => 0,
        rotate_file => '',                              # rotate log if 
this file exists
        keep_old_logs => 7,                             # how many old 
logfiles to keep

        pid_file => '',

        # crude stats on what the filter is doing
        statfile => '',
        html_statfile => '',
        inn_syslog_status => 0,                 # status to syslog 
(late-model INN only)

        timer_info => 1,                # timing information 
(arts/second) in status report?

        debug_batch_directory => '',    # directory for debugging batches
        debug_batch_size => 0,                  # max size of batch 
files before rotation

        ### binaries allowed if groups match
        bin_allowed => '^\w+\.binae?r|^alt\.sex\.pictures|^fur\.artwork'.
                
'|^alt\.anonymous\.messages$|^de\.alt\.dateien|^rec\.games\.bolo$'.
                '|^comp\.security\.pgp\.test$|^sfnet\.tiedostot'.
                '|^fido\.|^linux\.|^unidata\.',

        ### no binaries allowed even if bin_allowed matches
        bad_bin => '\.d$|^alt\.chello',

        ### md5 EMP check not done if groups match
        md5exclude => '\.test(?:$|\.)|^es\.pruebas$',

        ### reject all articles crossposted to groups matching this
        poison_groups => '^alt\.(?:binaires|bainaries)|sexzilla|^newsmon$'.
                '|h[i\d]pcl[o\d]ne|h\.i\.p\.c\.r\.i\.m\.e'.
                ($] >= 5.005 ? '|(?<!free\.)h[i\d]pcr[i\d]m[e\d]'
                                        : 
'|^alt\.hipcrime|^us\.hipcrime|^hipcrime|h\dpcr\dme'),

        ### no checks done if groups match
        allexclude => '^clari\.|^biz\.clarinet\.',

        ### HTML allowed here (if block_html or block_multi_alt is 
turned on)

This appears to be the original Cleanfeed script. There are no changes 
to the HTML and binary stuff, but notice the "$config_dir = 
'etc/news/bin/filter';" near the top.

But is this actually the correct file for this location? Check this out:

john@optima7:/etc/news$ less cleanfeed.conf_original

# Cleanfeed configuration file


sub local_config {

### !! WARNING !! YOU CAN & MUST SET ONLY ONE OF THE FOLLOWING:
$inn = 1;               # set $inn = 1 for INN
$highwind = 0;          # set $highwind = 1 for Cyclone/Typhoon/Breeze
$nntprelay = 0;         # set $nntprelay = 1 for NNTPRelay

%config_local = (

# Settings in %config_local will OVERRIDE any defaults
# in Cleanfeed.
#
# Any setting here will blindly replace one with the
# same name in %config.  No sanity checks are done.
# Be careful!
#
# On/off settings should be set to 1 for on, 0 for off

   ### Setting aggressive to 0 disables all content-based filters
   'aggressive' => 1,

   ### Active file
   #'active_file' => undef,
   'active_file' => '/var/lib/news/active',
   #Above by JFM 20060623

   #########################################################

<snip>

That looks totally different. Perhaps I originally moved (renamed) 
something incorrectly? I remember having trouble figuring out Cleanfeed 
back in the early summer.

Let's take a look inside the filter directory:

john@optima7:/etc/news$ cd filter

john@optima7:/etc/news$ cd filter
john@optima7:/etc/news/filter$ ls -al
total 286
drwxr-xr-x  2 root root    416 2006-10-01 11:45 .
drwxr-xr-x  3 root root   1248 2006-09-16 20:04 ..
-rw-r--r--  1 root root  47159 2006-06-23 07:39 
filter_innd_ORIGINAL_CLEANFEED.pl
-rw-r--r--  1 root root   6124 2006-06-18 13:01 filter_innd_ORIGINAL.pl
-rw-r--r--  1 root root  53102 2006-10-01 11:45 filter_innd.pl
-rw-r--r--  1 root root  53127 2006-10-01 11:12 filter_innd.pl.20061001
-rw-r--r--  1 root root  53070 2006-07-28 14:22 filter_innd.pl_WORKED_OK
-rw-r--r--  1 root root   2263 2006-06-18 13:01 filter_nnrpd.pl
-rw-r--r--  1 root root   4177 2006-06-18 13:01 nnrpd_access.pl
-rw-r--r--  1 root root   2653 2006-06-18 13:01 nnrpd_auth.pl
-rw-r--r--  1 root root   1336 2006-06-18 13:01 startup_innd.pl
john@optima7:/etc/news/filter$

The "filter_innd.pl.20061001" is the one that had the groups listed 
individually.
The "filter_innd.pl_WORKED_OK" is the same file before I added the 
individual groups.
The "filter_innd_ORIGINAL_CLEANFEED.pl" is a copy of the Version 
0.95.7b  3 September 1998 file
The "filter_innd_ORIGINAL.pl" is $Id: filter_innd.pl,v 1.4 2000/04/04 
23:40:09 rra Exp $
All of these four are simply stored here. Is this a problem?

With the hook set in /etc/news/cleanfeed wouldn't it appear that the 
following file would be considered "cleanfeed.local"?

john@optima7:/etc/news/filter$ less filter_innd.pl

# vim: set tabstop=4 shiftwidth=4 autoindent smartindent smarttab 
syntax=perl:
#
# Copyright 1999 Jeremy Nixon <jeremy@exit109.com>
# Copyright 2001 Marco d'Itri <md@linux.it>
#
# This software is distributed under the terms of the Artistic License.
# Please see the LICENSE file in the distribution.
#

# CHANGE THE BELOW SETTING!
# Directory where cleanfeed.local and the other configuration files live.
# Set this to undef to not use any external file.

#Changed below 26600627 by JFM
#$config_dir = '/news/bin/filter';
#To
$config_dir => 'undef';

##############################################################################
# Server configuration
#
# Set $MODE according to what you're running.
# Acceptable values: inn, highwind.
# If you are running a highwind-like server then the value set here is 
ignored
# and the default from highwind.pl is used.

$MODE ||= 'inn';

##############################################################################
# WARNING: NO USER SERVICEABLE PARTS BELOW THIS LINE
# IF YOU WANT TO CHANGE SOMETHING, PLEASE USE cleanfeed.local
##############################################################################

# default configuration
sub get_config {
        %config = (
        verbose => 1,                   # verbose rejection reasons in 
news.notice/logfile?
        aggressive => 1,                        # set to 0 if your 
lawyers are paranoid
        maxgroups => 5,                     # maximum number of groups 
in a crosspost [was 14 JFM]
        block_binaries => 1,            # block misplaced binaries
        block_late_cancels => 0,        # block cancels of rejected articles
        block_user_spamcancels => 1,# reject spam cancels with X-Trace 
or N-P-H
        block_user_cancels => 0,        # accept only spam cancels
        block_extra_reposts => 1,       # block reposts for articles not 
cancelled

        do_md5 => 1,                            # do the md5 checks?
        do_phl => 1,                            # do the 
posting-host/lines EMP check?
        do_fsl => 1,                            # do the 
from/subject/lines EMP check?
        do_scoring_filter => 1,         # use the scoring filter?

        do_emp_dump => 1,                       # dump EMP histories to 
a file for persistence?
        emp_dump_file => '',            # file to dump EMP histories to

        MD5RateCutoff => 5,                     # reject if this many 
copies are in the history
        MD5RateCeiling => 85,           # only count this high
        MD5RateBaseInterval => 7200,# How long to wait before 
decrementing the count
        PHLRateCutoff => 20,
        PHLRateCeiling => 80,
        PHLRateBaseInterval => 3600,
        FSLRateCutoff => 20,
        FSLRateCeiling => 40,
        FSLRateBaseInterval => 1000,

        fuzzy_md5 => 1,                         # screw around with the 
body before md5ing?
        fuzzy_max_length => 700,        # don't screw with bodies over 
this many lines
        md5_max_length => 2000,         # don't md5 articles over this 
many lines
        trim_interval => 900,           # trim hashes every N seconds
        stats_interval => 3600,         # write status file every N seconds
        MIDmaxlife => 4,                        # time to keep rejected 
message-ids, in hours
        md5_skips_followups => 1,       # avoid MD5 check on articles 
with References?
        do_mid_filter => 1,                     # use the message-id 
CHECK filter? (INN only)
        do_supersedes_filter => 1,      # do the excessive supersedes 
filter?
        drop_useless_controls => 1,     # drop sendsys, senduuname, 
version control msg
        drop_ihave_sendme => 1,         # drop ihave, sendme control 
messages

        low_xpost_maxgroups => 6,       # max xposts in low_xpost_groups
        meow_ext_maxgroups => 2,        # max xposts from meow_groups to 
other groups

        binaries_in_mod_groups => 0,    # allow binaries in moderated 
groups?
        max_encoded_lines => 15,        # number of encoded binary lines 
to allow

        block_mime_html => 1,           # block MIME encapsulated HTML 
(attached files)
                                                                #  (NOT 
straight or multipart/alternative)
        block_html => 1,                        # block text/html but 
not multipart/alternative
        block_multi_alt => 0,           # block multipart/alternative 
articles

        active_file => '',      # active file to determine which groups 
are moderated

        # Logging and pid_file don't work for INN (uses news.notice)
        log_directory => '',
        log_name => '',
        log_accepts => 0,                               # include 
accepted articles in the log?
        max_log_size => 0,
        rotate_file => '',                              # rotate log if 
this file exists
        keep_old_logs => 7,                             # how many old 
logfiles to keep

        pid_file => '',

        # crude stats on what the filter is doing
        statfile => '',
        html_statfile => '',
        inn_syslog_status => 0,                 # status to syslog 
(late-model INN only)

        timer_info => 1,                # timing information 
(arts/second) in status report?

        debug_batch_directory => '',    # directory for debugging batches
        debug_batch_size => 0,                  # max size of batch 
files before rotation

        ### binaries allowed if groups match
        bin_allowed => '^\w+\.binae?r|^alt\.sex\.pictures|^fur\.artwork'.
                
'|^alt\.anonymous\.messages$|^de\.alt\.dateien|^rec\.games\.bolo$'.
                '|^comp\.security\.pgp\.test$|^sfnet\.tiedostot'.
                '|^fido\.|^linux\.|^unidata|^xanadu\.|^xanadu\.test',

        ### no binaries allowed even if bin_allowed matches
        bad_bin => '\.d$|^alt\.chello',

        ### md5 EMP check not done if groups match
        md5exclude => '\.test(?:$|\.)|^es\.pruebas$',

        ### reject all articles crossposted to groups matching this
        poison_groups => '^alt\.(?:binaires|bainaries)|sexzilla|^newsmon$'.
                '|h[i\d]pcl[o\d]ne|h\.i\.p\.c\.r\.i\.m\.e'.
                ($] >= 5.005 ? '|(?<!free\.)h[i\d]pcr[i\d]m[e\d]'
                                        : 
'|^alt\.hipcrime|^us\.hipcrime|^hipcrime|h\dpcr\dme'),

        ### no checks done if groups match
        allexclude => '^clari\.|^biz\.clarinet\.',

        ### HTML allowed here (if block_html or block_multi_alt is 
turned on)
        html_allowed => '^microsoft\.|^xanadu\.',

john@optima7:/etc/news/filter$

This is the file I modified.

This doesn't make sense to me (nor you, I presume).

If these two files are reversed, how is Cleanfeed working?

Where is cleanfeed.local?

john@optima7:/etc/news/filter$ sudo updatedb
Password:
john@optima7:/etc/news/filter$ locate cleanfeed.local
/home/john/Downloads/cleanfeed-0.95.7b/cleanfeed.local.ex
/home/john/Downloads/cleanfeed-20020501/cleanfeed.local.sample
/home/john/Downloads/cleanfeed-20020501/cleanfeed.local.sample-it
john@optima7:/etc/news/filter$

These appear to be only samples.

Ideas?

-- 
John
Technical Details
Message-ID: <%vXYg.74713$QZ1.58022@bgtnsc04-news.ops.worldnet.att.net>
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!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn12feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!17a21c27!not-for-mail
References: <O%STg.165050$QM6.101199@bgtnsc05-news.ops.worldnet.att.net> <qSYWg.242888$QM6.16449@bgtnsc05-news.ops.worldnet.att.net> <egld06$5sk$1@puck.litech.org> <4WSYg.73790$QZ1.22699@bgtnsc04-news.ops.worldnet.att.net> <eh1bjb$d4c$4@puck.litech.org>

Show Full Headers
Complete Article Headers
Message-ID: <%vXYg.74713$QZ1.58022@bgtnsc04-news.ops.worldnet.att.net>
Subject: Re: Cleanfeed config to allow HTML and binary attachments
Date: Tue, 17 Oct 2006 02:48:27 GMT
From: "John F. Morse" <xanadu.bbs@invalid.net>
References: <O%STg.165050$QM6.101199@bgtnsc05-news.ops.worldnet.att.net> <qSYWg.242888$QM6.16449@bgtnsc05-news.ops.worldnet.att.net> <egld06$5sk$1@puck.litech.org> <4WSYg.73790$QZ1.22699@bgtnsc04-news.ops.worldnet.att.net> <eh1bjb$d4c$4@puck.litech.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!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn12feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!17a21c27!not-for-mail
Reply-To: xanadu.bbs@invalid.net
Organization: Xanadu BBS
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040514
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: news.software.nntp
In-Reply-To: <eh1bjb$d4c$4@puck.litech.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 561
NNTP-Posting-Host: 80a130efdb1bd7b1debf6df8ba669169
X-Complaints-To: abuse@worldnet.att.net
X-Trace: bgtnsc04-news.ops.worldnet.att.net 1161053307
NNTP-Posting-Date: Tue, 17 Oct 2006 02:48:27 GMT