🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #89239

Re: readers.conf

#89239
From: Julien ÉLIE
Date: Sat, 19 Mar 2022 07:59
92 lines
3743 bytes
Hi Miner,

>> How to accept connections from a few IP addresses and immediately
>> reject anything from the same network range?
>>
>> I did try to do that, but unsuccessful. inn 2.6.4.
>>
>> auth "blah" {
>>   hosts: "192.168.1.0/24, !192.168.1.5"
>>   default: "<FAIL>"
>> }
> 
> => It assigns the identity "<FAIL>" to the users in 192.168.1.0/24 but 
> not 192.168.1.5.

After further investigation, I better understand the issue you're facing.
This syntax does not work.  I would tend to think this is a bug, but am 
unsure.  We have no examples of a "!" syntax in "hosts" lists in 
readers.conf...

The code just parses each part of the list, starting from the end.  So, 
assuming you're connecting from 192.168.1.5, it does:

1/ Does "!192.168.1.5" matches 192.168.1.5?  No, so go on trying.
2/ Does "192.168.1.0/24" matches 192.168.1.5?  Yes, so the auth block 
succeeds.

I would have said at step 1 that the auth block fails, but that's not 
what the code does...  Any opinion about that, and if it should be changed?

At least the documentation needs fixing as it says for "hosts": 
"comma-separated wildmat expressions allowed, but @ is not supported".



> With that logic in mind, a working readers.conf file to do that is:
> 
> auth blah {
>    hosts: "192.168.1.0/24, !192.168.1.5"
>    default: "<SUCCESS>"
> }
> 
> access full {
>    users: "<SUCCESS>"
>    newsgroups: *
> }

This does not work, unfortunately (in current versions of INN 2.6.x).

Here's a working example:

auth allowed {
     hosts: "192.168.1.0/24"
     default: "<SUCCESS>"
}

auth disallowed {
     hosts: "192.168.1.5"
     default: "<FAIL>"
}

access success {
     users: "<SUCCESS>"
     newsgroups: "*"
}

access fail {
     users: "<FAIL>"
     reject_with: "Not allowed!"
}

Remember the order is important (the last matching block applies, so the 
"disallowed" block should be after the "allowed" block).


The behaviour you asked for (directly rejecting the connection) can be 
achieved with the reject_with parameter:

% telnet news.trigofacile.com 119
400 Permission denied: Not allowed!


I hope this answer helps you.

Thanks for this question.  It permitted finding that "hole" in our 
documentation, or even a bug in the source code!

-- 
Julien ÉLIE

« Pour aller plus vite, j'additionne toujours de bas en haut : je fais
   du même coup l'addition et la preuve. » (Aurélien Scholl)
Technical Details
Message-ID: <t142go$gncm$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <t0krjp$6fh$1@txtcon.i2p> <t12i1g$fkek$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <t142go$gncm$1@news.trigofacile.com>
Subject: Re: readers.conf
Date: Sat, 19 Mar 2022 08:59:20 +0100
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <t0krjp$6fh$1@txtcon.i2p> <t12i1g$fkek$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.software.nntp
Organization: Groupes francophones par TrigoFACILE
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 19 Mar 2022 07:59:20 -0000 (UTC)
Injection-Info: news.trigofacile.com; posting-account="julien"; posting-host="176.143-2-105.abo.bbox.fr:176.143.2.105"; logging-data="548246"; mail-complaints-to="abuse@trigofacile.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0
Cancel-Lock: sha1:pKDxzEDp/a3NnjfTBga1qK8IN/w= sha256:oEEaaGktIShshqazjISKtvJTs2clPRQLwbRA60zbPbg= sha1:LS5VCguCHxlTyEuEUD35KHbgI5Y= sha256:8E9W5wuddbBpVfi0f0cU6xxBvLdDn9EcNEzBuK3q5pY=
In-Reply-To: <t12i1g$fkek$1@news.trigofacile.com>