Article View: news.software.nntp
Article #81380Re: Can someone write a nnrpd perl filter ?
From: Nomen Nescio
Date: Sat, 13 Jun 2009 09:30
Date: Sat, 13 Jun 2009 09:30
66 lines
3275 bytes
3275 bytes
Etian wrote:
> While you are developing it, you need it to work by itself. So in the
> main body, you store some data to the parts of %hdr that you want to
> test, and you call the functions to test them, and run it from the
> command line. After its working by itself, then you strip that stuff
> from the body.
>
> A big concern with INN, is that if the filter dies, then the x-trace and
> host are exposed to the world. Since this seems to be a concern shared
> by most of us, we could hope that in a future release the maintainers
> might allow these to be set in the authentication script rather than
> covering them up in the filter.
>
This is the best i can do. I wanted some basic rbl checks , but , honest ,
i'm still miles away from writing my own , a little help will be appreciated ,
thanks !
>use strict;
>use Digest::SHA1;
>our (%hdr, $modify_headers);
>sub filter_post {
> # Hash the NNTP-Posting-Host header
> my $ctx = Digest::SHA1->new;
> $ctx->add($hdr{'NNTP-Posting-Host'});
> $ctx->add("Would you like some salt with that?");
> $hdr{'NNTP-Posting-Host'} = $ctx->hexdigest;
> undef $hdr{'X-Trace'};
> # Refuse these From addresses
> if ($hdr{From} =~ /(
> \@darkshado\.ca
> | arcturianone\@earthlink\.net
> )/ix) {
> return "Sender address ($1) is blacklisted";
> };
> # Blacklist these groups
> if ($hdr{Newsgroups} =~ /(
> rec\.radio\.amateur\.policy
> | hr\.alt\.trash
> )/x) {
> return "Posting to $1 is currently blocked";
> };
> my $rval = "" ;
> if ($hdr{"Subject"} =~ /make.*money/i) {
> $rval = "Spam is not acceptable here..." ;
> } elsif ($hdr{'Subject'} =~ /^Re: /o and $hdr{'References'} eq "") {
> $rval = "Followup without References:";
> } elsif ($hdr{'From'} =~ /^\w*$/o or
> $hdr{'From'} !~ /^(.+?)\@([-\w\d]+\.)*([-\w\d]+)\.([-\w\d]{2,})$/o) {
> $rval = "From: is invalid, must be user\@[host.]domain.tld";
> }
> $modify_headers = 1;
> return '';
>}
>}
Technical Details
Message-ID:
<7aa2a719d87114dafd57505a134bfa8d@dizum.com>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.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!news.stack.nl!news.gabrix.ath.cx!m2n.gabrix.ath.cxShow Full Headers
Complete Article Headers
Message-ID: <7aa2a719d87114dafd57505a134bfa8d@dizum.com> Subject: Re: Can someone write a nnrpd perl filter ? Date: Sat, 13 Jun 2009 09:30:06 +0000 From: Nomen Nescio <Use-Author-Supplied-Address-Header@[127.1]> 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.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!news.stack.nl!news.gabrix.ath.cx!m2n.gabrix.ath.cx Comments: This message did not originate from the Sender address above. It was remailed automatically by anonymizing remailer software. Please report problems or inappropriate use to the remailer administrator at <abuse@dizum.com>. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Newsgroups: news.software.nntp Author-Supplied-Address: nobody<AT>dizum<DOT>com X-Abuse-Contact: mail2news-abuse@m2n.gabrix.ath.cx Lines: 67