🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
9 messages
9 total messages Started by Aioe Sat, 23 May 2009 13:06
filter_nnrpd.pl and errors
#81073
Author: Aioe
Date: Sat, 23 May 2009 13:06
24 lines
2395 bytes
I know that when nnrpd tries to execute filter_post() inside filter_nnrpd.pl, 
if there's an error, an message is logged with *error* priority through 
syslog and the article is *accepted* . IMHO this is wrong.
Since filter_post() in mostly used as an antispam filter, if that filter dies 
or can't be executed due some syntax error in the code, the article should 
be *rejected* instead of being *accepted* . In the currently used way, if 
due some reason the filter can't be executed, the server becomes completely 
open till the newsmaster becomes aware of that error than solves it. If all 
incoming articles are accepted, nobody perceives that failure and this makes 
longer the time needed by the newsmaster before solving it. In this way, the 
first *real* alert about filter malfunctions are those complaints sent against 
spam messages posted through the 'at this point /completely/ open' server. 
IMHO this nnrpd behaviour is highly unsafe because everyone could post 
everything if the filter dies.
nnrpd logs filter errors with 'err' syslog priority. IMHO this is bad (and 
maybe wrong). Since filtering is a vital feature, errors should be logged 
with 'crit' priority instead 'err'. innwatch sends alerts to the newsmaster 
if there's some log line only inside news.crit, so if nnrpd logs filter 
errors with that priority, the server maintainer can receive an email that 
explains what is happening.


 
Re: filter_nnrpd.pl and errors
#81086
Author: Julien ÉLIE
Date: Sun, 24 May 2009 08:53
98 lines
5038 bytes
Hi Paolo,

Hadn't innreport reported the problem near the beginning of one of its daily
reports?  (in the error section)


> I know that when nnrpd tries to execute filter_post() inside filter_nnrpd.pl,
> if there's an error, an message is logged with *error* priority through
> syslog and the article is *accepted* . IMHO this is wrong.
> Since filter_post() in mostly used as an antispam filter, if that filter dies
> or can't be executed due some syntax error in the code, the article should
> be *rejected* instead of being *accepted* . In the currently used way, if
> due some reason the filter can't be executed, the server becomes completely
> open till the newsmaster becomes aware of that error than solves it.

To be consistent, we should have the same behaviour with innd.  filter_art()
is mostly used as an antispam filter and we then have to *reject* all articles
if Cleanfeed dies.
I'm not very appealed by that...



> nnrpd logs filter errors with 'err' syslog priority. IMHO this is bad (and
> maybe wrong). Since filtering is a vital feature, errors should be logged
> with 'crit' priority instead 'err'.

It is easy to change the log from 'err' to 'crit'.

Index: nnrpd/perl.c
===================================================================
--- nnrpd/perl.c      (révision 8490)
+++ nnrpd/perl.c      (copie de travail)
@@ -182,7 +182,7 @@
     buf[0] = '\0';

     if (SvTRUE(ERRSV)) {    /* Check $@. */
-        syslog(L_ERROR, "Perl function filter_post died: %s",
+        syslog(L_FATAL, "Perl function filter_post died: %s",
                SvPV(ERRSV, PL_na));
         (void)POPs;
         PerlFilter(false);

Index: innd/perl.c
===================================================================
--- innd/perl.c      (révision 8490)
+++ innd/perl.c      (copie de travail)
@@ -113,7 +113,7 @@
     /* Check $@, which will be set if the sub died. */
     buf[0] = '\0';
     if (SvTRUE(ERRSV)) {
-        syslog(L_ERROR, "Perl function filter_art died on article %s: %s",
+        syslog(L_FATAL, "Perl function filter_art died on article %s: %s",
                HDR_FOUND(HDR__MESSAGE_ID) ? HDR(HDR__MESSAGE_ID) : "?",
                SvPV(ERRSV, PL_na));
         (void) POPs;
@@ -160,7 +160,7 @@
     /* Check $@, which will be set if the sub died. */
     buf[0] = '\0';
     if (SvTRUE(ERRSV)) {
-        syslog(L_ERROR, "Perl function filter_messageid died on id %s: %s",
+        syslog(L_FATAL, "Perl function filter_messageid died on id %s: %s",
                messageID, SvPV(ERRSV, PL_na));
         (void) POPs;
         PerlFilter(false);
@@ -220,7 +220,7 @@

     /* Check $@, which will be set if the sub died. */
     if (SvTRUE(ERRSV)) {
-        syslog(L_ERROR, "Perl function filter_mode died: %s",
+        syslog(L_FATAL, "Perl function filter_mode died: %s",
                 SvPV(ERRSV, PL_na));
         (void) POPs;
         PerlFilter(false);


The behaviour for Python has to be checked.  I think it does not die but
will give an error each time an article is received (but I have to test
it to be sure).


However, is it really what should be done?

I read in HACKING:

    For historical reasons, error messages that are fatal to the news subsystem
    are logged at the LOG_CRIT priority, and therefore die in innd should use
    message_log_syslog_crit.  This seems like priority inflation and may change
    in the future to message_log_syslog_err.


Besides, when there is an error at startup (filter_nnrpd.pl has not a
correct syntax for instance), it is logged as 'err', not 'crit'.

-- 
Julien ÉLIE

« Ambo florentes aetatibus, Arcades ambo » (Virgile, _Églogue VII_) 
Re: filter_nnrpd.pl and errors
#81087
Author: Ray Banana
Date: Sun, 24 May 2009 09:20
27 lines
2836 bytes
Thus spake Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
 
> To be consistent, we should have the same behaviour with innd.  filter_art()
> is mostly used as an antispam filter and we then have to *reject* all articles
> if Cleanfeed dies.
> I'm not very appealed by that...

Neither am I. I prefer to get spam in this case rather than getting no
articles at all. You can always clean up the spam after receiving it,
but it's quite difficult to get articles you have already rejected.

>> nnrpd logs filter errors with 'err' syslog priority. IMHO this is bad (and
>> maybe wrong). Since filtering is a vital feature, errors should be logged
>> with 'crit' priority instead 'err'.
[...]
> However, is it really what should be done?

No. Paolo's suggestions are entirely focussed on aioe's setup, which is
quite different from other setups. If the integrity of his server
entirely relies on the filter code, he could possibly run his entire
filter in an eval() block and thus reject articles even if his filter
code dies and also issue error messages with a severity he considers
appropriate. 

-- 
Time flies like an arrow, fruit flies like a Banana.
http://news.motzarella.org
Re: filter_nnrpd.pl and errors
#81090
Author: John F. Morse
Date: Sun, 24 May 2009 13:17
26 lines
2229 bytes
Ray Banana wrote:

> Neither am I. I prefer to get spam in this case rather than getting no
> articles at all. You can always clean up the spam after receiving it,
> but it's quite difficult to get articles you have already rejected.

I also agree.

Do you have an automated process for cleaning out spam that is already
in the spool?

BTW, just for your info, the Optima2 and Optima5 Ubuntu Hardy servers
ran fine, up until this morning when a weekly cron job disconnected the
news.notice logging. I restarted sysklog and it is again logging
news.notice. No big deal though because these are just experimental
servers and will be changed to Debian soon.

The Optima11 Lenny server worked fine (so far as I can tell).


-- 
John 

No Microsoft, Apple, AT&T, Novell, Trend Micro, nor Ford products were used in the preparation or transmission of this message.

The EULA sounds like it was written by a team of lawyers who want to tell me what I can't do. The GPL sounds like it was written by a human being, who wants me to know what I can do.
Re: filter_nnrpd.pl and errors
#81093
Author: Gary L. Burnore
Date: Sun, 24 May 2009 14:16
30 lines
2627 bytes
On Sun, 24 May 2009 08:17:47 -0500, "John F. Morse"
<xanadu.bbs@example.invalid> wrote:

>Ray Banana wrote:
>
>> Neither am I. I prefer to get spam in this case rather than getting no
>> articles at all. You can always clean up the spam after receiving it,
>> but it's quite difficult to get articles you have already rejected.
>
>I also agree.
>
>Do you have an automated process for cleaning out spam that is already
>in the spool?

To be clear, filter_nnrpd scans posts from your own CLIENTS.  It's easy to
kill the access of a client if he happens to do his only spam run while your
filter is down.
-- 
gburnore@databasix dot com          
---------------------------------------------------------------------------
                  How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore                       |  ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
                                      |  ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix                             |  ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
                                      |  ÝÛ³ 3 4 1 4 2  ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division |     Official Proof of Purchase
===========================================================================
           Want one?  GET one!   http://signup.databasix.com
===========================================================================
Re: filter_nnrpd.pl and errors
#81096
Author: Steve Crook
Date: Sun, 24 May 2009 14:36
14 lines
1615 bytes
On Sun, 24 May 2009 11:20:44 +0200, Ray Banana wrote in
Message-Id: <8063fqluvn.fsf@banana.shacknet.nu>:

> Neither am I. I prefer to get spam in this case rather than getting no
> articles at all. You can always clean up the spam after receiving it,
> but it's quite difficult to get articles you have already rejected.
Seconded.  Especially as it's quite easy to break Perl filtering by
simply inserting a syntax error into cleanfeed.local or any of the bad_*
files that are processed by read_regex.

-- 
pub   1024D/228761E7 2003-06-04 Steven Crook
      Key fingerprint = 1CD9 95E1 E9CE 80D6 C885  B7EB B471 80D5 2287 61E7
uid                  Steven Crook <steve@mixmin.net>
Re: filter_nnrpd.pl and errors
#81098
Author: Ray Banana
Date: Sun, 24 May 2009 14:48
32 lines
2993 bytes
Thus spake Gary L. Burnore <gburnore@databasix.com>
 
> On Sun, 24 May 2009 08:17:47 -0500, "John F. Morse"
> <xanadu.bbs@example.invalid> wrote:
>>Ray Banana wrote:
>>> Neither am I. I prefer to get spam in this case rather than getting no
>>> articles at all. You can always clean up the spam after receiving it,
>>> but it's quite difficult to get articles you have already rejected.
>>I also agree.
>>Do you have an automated process for cleaning out spam that is already
>>in the spool?
> To be clear, filter_nnrpd scans posts from your own CLIENTS.  

Both my and John's comments referred to Julien's remark:

| To be consistent, we should have the same behaviour with innd.  filter_art()
|                                                          ^^^^^^^^^^^^^^^^^^
| is mostly used as an antispam filter and we then have to *reject* all
| articles if Cleanfeed dies.
| I'm not very appealed by that...
  

> It's easy to kill the access of a client if he happens to do his only
> spam run while your filter is down.

Not in the case of aioe, as there are neither user accounts nor
authentication mechanisms. That's why Paolo would like to completely
forbid posting when the filter is down.

-- 
Time flies like an arrow, fruit flies like a Banana.
http://news.motzarella.org
Re: filter_nnrpd.pl and errors
#81097
Author: D. Stussy
Date: Mon, 25 May 2009 02:00
48 lines
3385 bytes
"Ray Banana" <rayban@banana.shacknet.nu> wrote in message
news:8063fqluvn.fsf@banana.shacknet.nu...
> Thus spake Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
> > To be consistent, we should have the same behaviour with innd.
filter_art()
> > is mostly used as an antispam filter and we then have to *reject* all
articles
> > if Cleanfeed dies.
> > I'm not very appealed by that...
>
> Neither am I. I prefer to get spam in this case rather than getting no
> articles at all. You can always clean up the spam after receiving it,
> but it's quite difficult to get articles you have already rejected.

If rejections were to occur, it should be with the code that says
"deferred - try again later" (used when a server already has a offer of the
article from a different peer in hand).

> >> nnrpd logs filter errors with 'err' syslog priority. IMHO this is bad
(and
> >> maybe wrong). Since filtering is a vital feature, errors should be
logged
> >> with 'crit' priority instead 'err'.
> [...]
> > However, is it really what should be done?
>
> No. Paolo's suggestions are entirely focussed on aioe's setup, which is
> quite different from other setups. If the integrity of his server
> entirely relies on the filter code, he could possibly run his entire
> filter in an eval() block and thus reject articles even if his filter
> code dies and also issue error messages with a severity he considers
> appropriate.

Conversely, I don't run a posting filter, but occasionally I've noted log
entries complaining that one (that I don't have) can't be found.  Maybe
there should be yet another option in inn.conf regarding this:

usepostingfilter:        no/false | yes/true | required

yes and no are obvious.  With '"required", nnrpd should exit with a fatal
error if it's missing, and if the filter exits unexpectedly, the message is
rejected.

With "no", the missing log entries are skipped.

Does that make everyone happy?

Re: filter_nnrpd.pl and errors
#81099
Author: Julien ÉLIE
Date: Mon, 25 May 2009 17:28
37 lines
2431 bytes
Hi D. Stussy,

> Conversely, I don't run a posting filter, but occasionally I've noted log
> entries complaining that one (that I don't have) can't be found.

I assume it is something like:
    May 25 19:14:54 news nnrpd[25646]: SERVER perl filter not defined

Just create an <pathfilter>/filter_nnrpd.pl file with these three lines:

sub filter_post {
  return '';
}

It will stop the error.



> Maybe there should be yet another option in inn.conf regarding this:
>
> usepostingfilter:        no/false | yes/true | required
>
> yes and no are obvious.  With '"required", nnrpd should exit with a fatal
> error if it's missing, and if the filter exits unexpectedly, the message is
> rejected.
> With "no", the missing log entries are skipped.

"no"       <=> sub filter_post { return ''; }
"yes"      <=> sub filter_post { my $value = ''; [...] return $value; }
"required" <=> Ray's eval() suggestion for errors, news.err log when
               no function

-- 
Julien ÉLIE

« Video meliora proboque deteriora sequor. » (Ovide)
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