🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
8 messages
8 total messages Started by The Doctor Mon, 09 Oct 2023 14:57
Getting spamassassin and clamav as inn filters
#90940
Author: The Doctor
Date: Mon, 09 Oct 2023 14:57
6 lines
1116 bytes
Any recipes how?
-- 
Member - Liberal International This is doctor@nk.ca Ici doctor@nk.ca
Yahweh, King & country!Never Satan President Republic!Beware AntiChrist rising!
Look at Psalms 14 and 53 on Atheism https://www.empire.kred/ROOTNK?t=94a1f39b 
An oil stain on the carpet is not removed by picking up the litter. -unknown Beware https://mindspring.com
Re: Getting spamassassin and clamav as inn filters
#90952
Author: Gea-Suan Lin
Date: Thu, 12 Oct 2023 04:26
36 lines
1765 bytes
On 2023-10-09, The Doctor <doctor@doctor.nl2k.ab.ca> wrote:
> Any recipes how?

Yeah, I just implemented a simple hack within `cleanfeed.local`.  Have
tried, but not so useful.  Still many spam into comp.lang.c and other
groups.

The most efficient way to avoid Google Groups spam for now is just
giving up anything from Google Groups.

```
use Mail::SpamAssassin;

my $sa_agent = Mail::SpamAssassin->new();

sub local_filter_last {
    return unless $hdr{Path} =~ /google-groups\.googlegroups\.com/;

    my %myhdr = %hdr;
    delete $myhdr{__BODY__};
    delete $myhdr{__LINES__};

    my $header_str = join "\n", map { "$_: $hdr{$_}" } keys %myhdr;
    my $article_str = "$header_str\n\n$hdr{__BODY__}";

    my $mail = $sa_agent->parse($article_str);
    my $status = $sa_agent->check($mail);

    return reject("Reject Google Groups posting to $hdr{Newsgroups} by SpamAssassin") if $status->is_spam();

    $status->finish();
    $mail->finish();

    return;
}
```
Re: Getting spamassassin and clamav as inn filters
#90954
Author: Ray Banana
Date: Thu, 12 Oct 2023 05:44
42 lines
2190 bytes
* Gea-Suan Lin wrote:
> On 2023-10-09, The Doctor <doctor@doctor.nl2k.ab.ca> wrote:
>> Any recipes how?
>
> Yeah, I just implemented a simple hack within `cleanfeed.local`.  Have
> tried, but not so useful.  Still many spam into comp.lang.c and other
> groups.
[...]
> use Mail::SpamAssassin;
>
> my $sa_agent = Mail::SpamAssassin->new();
>
> sub local_filter_last {
>     return unless $hdr{Path} =~ /google-groups\.googlegroups\.com/;
>
>     my %myhdr = %hdr;
>     delete $myhdr{__BODY__};
>     delete $myhdr{__LINES__};
>
>     my $header_str = join "\n", map { "$_: $hdr{$_}" } keys %myhdr;
>     my $article_str = "$header_str\n\n$hdr{__BODY__}";
>
>     my $mail = $sa_agent->parse($article_str);
>     my $status = $sa_agent->check($mail);
>
>     return reject("Reject Google Groups posting to $hdr{Newsgroups} by SpamAssassin") if $status->is_spam();
>
>     $status->finish();
>     $mail->finish();
>
>     return;
> }
> ```

OK, now you need a ~/.spamassassin directory for your news user and a user_prefs 
file in that directory. After that you can start adding rules for Usenet spam. 
You will also need to feed several hundreds of spam and ham articles to sa-learn --spam 
or sa-learn --ham as the news user. After that, SpamAssassin will gradually improve.

-- 
Пу́тін — хуйло́
http://www.eternal-september.org
Re: Getting spamassassin and clamav as inn filters
#90953
Author: Julien ÉLIE
Date: Thu, 12 Oct 2023 06:58
17 lines
1764 bytes
Hi Gea-Suan Lin,

>> Any recipes how?
> 
> Yeah, I just implemented a simple hack within `cleanfeed.local`.  Have
> tried, but not so useful.  Still many spam into comp.lang.c and other
> groups.

FWIW, there's a doc in French to set up a "spamchk" funnel to 
SpamAssassin in the newsfeeds file:
 
https://web.archive.org/web/20230901182332/https://git.alphanet.ch/gitweb/?p=inn-install;a=blob_plain;f=README.html;hb=HEAD#filtrer-le-spam-avec-spamassassin

-- 
Julien ÉLIE

« Medicus curat, natura sanat. »
Re: Getting spamassassin and clamav as inn filters
#90957
Author: Gea-Suan Lin
Date: Thu, 12 Oct 2023 09:00
63 lines
3029 bytes
Thanks for the information.

I added a setting into ~/.spamassassin/user_prefs for recognizing MIME
part:

    #
    bayes_token_sources all

Then I manually selected 200+ hams and 200+ spams from comp.lang.c, and
50+ spams from comp.lang.python as well as 200+ spams from sci.crypt.
Afterwards I sent all these hams/spams into sa-learn.

The result looks pretty good so far.  Almost all new spams into
comp.lang.c were blocked by SpamAssassin.

I put my trained files here, so you may just reuse it:

https://newsfeed.hasname.com/files/usenet-spamassassin-20231012.tar.gz

Ray Banana <rayban@raybanana.net> wrote:
> * Gea-Suan Lin wrote:
>> On 2023-10-09, The Doctor <doctor@doctor.nl2k.ab.ca> wrote:
>>> Any recipes how?
>>
>> Yeah, I just implemented a simple hack within `cleanfeed.local`.  Have
>> tried, but not so useful.  Still many spam into comp.lang.c and other
>> groups.
> [...]
>> use Mail::SpamAssassin;
>>
>> my $sa_agent = Mail::SpamAssassin->new();
>>
>> sub local_filter_last {
>>     return unless $hdr{Path} =~ /google-groups\.googlegroups\.com/;
>>
>>     my %myhdr = %hdr;
>>     delete $myhdr{__BODY__};
>>     delete $myhdr{__LINES__};
>>
>>     my $header_str = join "\n", map { "$_: $hdr{$_}" } keys %myhdr;
>>     my $article_str = "$header_str\n\n$hdr{__BODY__}";
>>
>>     my $mail = $sa_agent->parse($article_str);
>>     my $status = $sa_agent->check($mail);
>>
>>     return reject("Reject Google Groups posting to $hdr{Newsgroups} by SpamAssassin") if $status->is_spam();
>>
>>     $status->finish();
>>     $mail->finish();
>>
>>     return;
>> }
>> ```
> 
> OK, now you need a ~/.spamassassin directory for your news user and a user_prefs 
> file in that directory. After that you can start adding rules for Usenet spam. 
> You will also need to feed several hundreds of spam and ham articles to sa-learn --spam 
> or sa-learn --ham as the news user. After that, SpamAssassin will gradually improve.
> 

-- 
                                                Resistance is futile.
                          https://blog.gslin.org/ & <gslin@gslin.org>
Re: Getting spamassassin and clamav as inn filters
#91520
Author: yamo'
Date: Sun, 28 Jan 2024 09:05
33 lines
2270 bytes
Hi Julien,


Julien ÉLIE a tapoté le 12/10/2023 08:58:
> Hi Gea-Suan Lin,
> 
>>> Any recipes how?
>>
>> Yeah, I just implemented a simple hack within `cleanfeed.local`.  Have
>> tried, but not so useful.  Still many spam into comp.lang.c and other
>> groups.
> 
> FWIW, there's a doc in French to set up a "spamchk" funnel to 
> SpamAssassin in the newsfeeds file:
>  
> https://web.archive.org/web/20230901182332/https://git.alphanet.ch/gitweb/?p=inn-install;a=blob_plain;f=README.html;hb=HEAD#filtrer-le-spam-avec-spamassassin
> 

The spamchk funnel is slower than calling SpamAssassin in cleanfeed.local.
After some tests, I've adopted the technique from Gea-Suan Lin, it could
be found here :
 <http://al.howardknight.net/?STYPE=msgid&MSGI=%3Cug7sh8%24pcc%241%40colo-sc-1.gslin.com%3E>


I will update the French documentation :
 <https://git.mcos.nc/INN/inn_install>

-- 
Stéphane
UTILISATEURS de GOOGLE GROUPS, vous n'aurez bientôt plus accès à Usenet.
<https://support.google.com/groups/answer/11036538>
Des serveurs gratuits de remplacement : <http://usenet-fr.yakakwatik.org>
Des logiciels : <http://usenet-fr.yakakwatik.org/lecteurs-de-news.html>
Re: Getting spamassassin and clamav as inn filters
#91521
Author: Ray Banana
Date: Sun, 28 Jan 2024 10:22
38 lines
2252 bytes
Thus spake yamo' <yamo@beurdin.invalid>
 
[...]
> After some tests, I've adopted the technique from Gea-Suan Lin, it could
> be found here :
>  <http://al.howardknight.net/?STYPE=msgid&MSGI=%3Cug7sh8%24pcc%241%40colo-sc-1.gslin.com%3E>

For performance reasons, especially if you receive a full text feed, I
would recommend to use spamd instead of starting spamassassin for every
article:

                my %myhdr = %hdr;
                delete $myhdr{__BODY__};
                delete $myhdr{__LINES__};
                my $header_str = join "\n", map { "$_: $hdr{$_}" } keys %myhdr;
                my $article_str = "$header_str\n\n$hdr{__BODY__}";
                my $spamtest = Mail::SpamAssassin::Client->new({
                                    port => /spamd port/,
                                    host => /spamd host/,
                                    username => 'news'}); # Use ~news/.spamassassin/user_prefs 

                my $result = $spamtest->process($article_str);
                $score = $result->{score};

                INN::syslog('notice',  $hdr{'Message-ID'} . " Score:  $score, isspam: " . $result->{isspam} );
                if ($result->{isspam} =~ 'True') {
                    [...] # local proceessing, nocemize etc.
                    return 'SPAM';

                } else {
                    [...] # local processing
                }



-- 
Пу́тін — хуйло́
https://www.eternal-september.org
Re: Getting spamassassin and clamav as inn filters
#91522
Author: yamo'
Date: Sun, 28 Jan 2024 18:58
26 lines
1960 bytes
Hi Ray,

Ray Banana a tapoté le 28/01/2024 11:22:
> Thus spake yamo' <yamo@beurdin.invalid>
>  
> [...]
>> After some tests, I've adopted the technique from Gea-Suan Lin, it could
>> be found here :
>>  <http://al.howardknight.net/?STYPE=msgid&MSGI=%3Cug7sh8%24pcc%241%40colo-sc-1.gslin.com%3E>
> 
> For performance reasons, especially if you receive a full text feed, I
> would recommend to use spamd instead of starting spamassassin for every
> article:


Thanks!

It works but I have to test a little more.


-- 
Stéphane
UTILISATEURS de GOOGLE GROUPS, vous n'aurez bientôt plus accès à Usenet.
<https://support.google.com/groups/answer/11036538>
Des serveurs gratuits de remplacement : <http://usenet-fr.yakakwatik.org>
Des logiciels : <http://usenet-fr.yakakwatik.org/lecteurs-de-news.html>
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