🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #89241

Re: readers.conf

#89241
From: Miner
Date: Sat, 19 Mar 2022 18:02
105 lines
3365 bytes
 Julien ??LIE wrote:

> 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.
> 
> 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?

In my example condition '"192.168.1.0/24, !192.168.1.5"' mean
reject any connection from network 192.168.1.0/24, except
192.168.1.5 host.

In other words: I need to permit connection from a few hosts and
terminate any incoming connection from others immediately.
Currently inn seem does not support selective rules.

> 
> 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>"
> > }

"default:" value need to be "<FAIL>" - nobody welcome except a
few hosts.

> 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).

How about?..

auth allowed {
    hosts: "192.168.1.5"
    default: "<SUCCESS>"
}

auth disallowed {
    hosts: "192.168.1.0/24"
    default: "<FAIL>"
}

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

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

-- 
Miner
Technical Details
Message-ID: <t155s1$bk5$1@txtcon.i2p>
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> <t142go$gncm$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <t155s1$bk5$1@txtcon.i2p>
Subject: Re: readers.conf
Date: Sat, 19 Mar 2022 18:02:42 +0000
From: Miner <john@doe.invalid>
References: <t0krjp$6fh$1@txtcon.i2p> <t12i1g$fkek$1@news.trigofacile.com> <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
Newsgroups: news.software.nntp
Organization: TxtCon.I2P
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 19 Mar 2022 18:02:42 -0000 (UTC)
Injection-Info: txtcon.i2p; posting-account="miner"; posting-host="127.163.152.53"; logging-data="11909"; mail-complaints-to="txtcon@i2pmail.org"