🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
7 messages
7 total messages Started by Tim Pennick Tue, 17 Oct 2000 00:00
Authenticating with perl hooks
#48775
Author: Tim Pennick
Date: Tue, 17 Oct 2000 00:00
20 lines
1676 bytes
Hi All,

I'm slowly getting to grps with authentication using the sample nnrp_auth.pl
provided.  However, I nearly fell at what I hope is almost the final hurdle,
as the sample code returns an array with 4 elements, whereas the code of nnrpd
seemed to be expecting 5.  I confirmed my suspicions when I discovered the
readme.perl_hook file, which is contradictory as to whether 4 or 5 elements
should be returned.  In the paragraph which calls for 5 elements, the
documentation states that the 5th element should be a number denoting the
maximum data transfer rate between client and server.

Does anyone know if this value is used for anything or is just a dummy value?
If it is used, what is a reasonable value for it if I don't want to limit the
transfer rate, i.e. do I just set it to the biggest number I can think of?

Regards,

Tim Pennick

Re: Authenticating with perl hooks
#48780
Author: Russ Allbery
Date: Tue, 17 Oct 2000 00:00
23 lines
1748 bytes
Tim Pennick <tpennick@extra.axion.bt.co.uk> writes:

> I'm slowly getting to grps with authentication using the sample
> nnrp_auth.pl provided.  However, I nearly fell at what I hope is almost
> the final hurdle, as the sample code returns an array with 4 elements,
> whereas the code of nnrpd seemed to be expecting 5.  I confirmed my
> suspicions when I discovered the readme.perl_hook file, which is
> contradictory as to whether 4 or 5 elements should be returned.  In the
> paragraph which calls for 5 elements, the documentation states that the
> 5th element should be a number denoting the maximum data transfer rate
> between client and server.

> Does anyone know if this value is used for anything or is just a dummy
> value?  If it is used, what is a reasonable value for it if I don't want
> to limit the transfer rate, i.e. do I just set it to the biggest number
> I can think of?

It's used, but you can return 0 to allow an unlimited transfer rate.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Re: Authenticating with perl hooks
#48793
Author: Russ Allbery
Date: Wed, 18 Oct 2000 00:00
38 lines
2677 bytes
Tim Pennick <tpennick@extra.axion.bt.co.uk> writes:

> Using the amended example supplied in
> ..../news/bin/filter/nnrpd_auth.pl, I assumed that my nnrp.access file
> should carry the 'broadbrush' access restrictions.  If a user tries to
> gain access to a group to which this file doesn't give them access, I
> assumed that nnrp would issue a "Needs Authorisation" to the client,
> which would then reply with an authinfo, which as I understand it,
> supplies the user/password information.  This is then pased to a new
> call to 'authenticate', with the type attribute set to 'authenticate"
> rather than 'connect'.  This would then query the users.cdb file in the
> case of the example I'm using.

Yes.  That's the way that it should work.  LIST commands won't return the
"needs authorization" replies, though.  The protocol is kind of icky in
that area.

If you exclude groups in nnrp.access, I don't believe that the client will
get any sort of useful "authentication required" message if they try to
access those groups; instead, the groups will just appear to not exist at
all.  I'm a lot more familiar with how this works in INN 2.3 than in INN
2.2, so I'm not sure how much help I can be in this area.  I think this is
a lot more straightforward to do with INN 2.3, so if upgrading is an
option, you may want to consider that.

What you want to do is create the situation where if the user attempts to
either read or post, they'll get an "authentication required" response,
right?  Does it work to respond in authenticate saying that neither
posting nor reading is allowed but returning 200 as the response code?

(Hm... I see that the Perl auth hook documentation says that you can
return 480 in response to a connection.  I'm not sure that's a valid thing
to do in the protocol.)

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Re: Authenticating with perl hooks
#48794
Author: Tim Pennick
Date: Wed, 18 Oct 2000 00:00
40 lines
2681 bytes
With thanks to Russ for getting me over that hurdle, but as so often happens,
it wasn't the final hurdle after all....

My authentication now works such that if I don't have a host field in
nnrp.access that matches my reader client, I get the message (you aren't
listed in my access file, goodbye" as I would expect.  So that bit's working.
Howevr, in cases where the host matches, and a telnet to port 119 succeeds,
any attempt to access a newsgroup fails with the information that there is no
such newsgroup.  'list active' or 'list newsgroups' returns no information,
and no error.

my 'authenticate' function returns an array containing the following values:
"200	1	1	*	0".

If I switch nnrpperlauth to false in inn.conf, all my newsgroups become
available.

Its just occurred to me that I may have misunderstoo the functionality.

Using the amended example supplied in ..../news/bin/filter/nnrpd_auth.pl, I
assumed that my nnrp.access file should carry the 'broadbrush' access
restrictions.  If a user tries to gain access to a group to which this file
doesn't give them access, I assumed that nnrp would issue a "Needs
Authorisation" to the client, which would then reply with an authinfo, which
as I understand it, supplies the user/password information.  This is then
pased to a new call to 'authenticate', with the type attribute set to
'authenticate" rather than 'connect'.  This would then query the users.cdb
file in the case of the example I'm using.

If this is the way things are supposed to work, I shouldn't have any problem
accessing any newsgroup as I have * access.

If anyone could give me any hints or pointers or clear up any obvious
misunderstandings I'd be grateful.

Many thanks once again

Tim Pennick

Re: Authenticating with perl hooks
#48809
Author: Tim Pennick
Date: Thu, 19 Oct 2000 00:00
44 lines
3275 bytes
On 18 Oct 2000 11:01:51 -0700, Russ Allbery <rra@stanford.edu> wrote:
>Tim Pennick <tpennick@extra.axion.bt.co.uk> writes:
>
>> Using the amended example supplied in
>> ..../news/bin/filter/nnrpd_auth.pl, I assumed that my nnrp.access file
>> should carry the 'broadbrush' access restrictions.  If a user tries to
>> gain access to a group to which this file doesn't give them access, I
>> assumed that nnrp would issue a "Needs Authorisation" to the client,
>> which would then reply with an authinfo, which as I understand it,
>> supplies the user/password information.  This is then pased to a new
>> call to 'authenticate', with the type attribute set to 'authenticate"
>> rather than 'connect'.  This would then query the users.cdb file in the
>> case of the example I'm using.
>
>Yes.  That's the way that it should work.  LIST commands won't return the
>"needs authorization" replies, though.  The protocol is kind of icky in
>that area.
>
>If you exclude groups in nnrp.access, I don't believe that the client will
>get any sort of useful "authentication required" message if they try to
>access those groups; instead, the groups will just appear to not exist at
>all.  I'm a lot more familiar with how this works in INN 2.3 than in INN
>2.2, so I'm not sure how much help I can be in this area.  I think this is
>a lot more straightforward to do with INN 2.3, so if upgrading is an
>option, you may want to consider that.

Sorry Russ, I AM using 2.3.  Maybe its the references to nnrp.access that
threw you of the scent.  This is the file that the example nnrpd_auth.pl file
uses, and so I have re-instated it, as (if I understand correctly),
readers.conf is disabled when you switch on NNRP_PERLAUTH in inn.conf.  Maybe
the docs aren't up-to-date, but the way I understand things is that:

Whatever happens within the 'authenticate' function, (assuming perl
authentication is switched on and readers.conf is therefore ignored) if the
authenticate function responds with "200 1 1 * 0" to a call which passed the
'connect' rather than 'authenticate' type attribute, the client should have
full access to the groups carried by the server.  I can't get this bit working
as no groups are visible at all.

Regards,

Tim Pennick

Re: Authenticating with perl hooks
#48821
Author: Russ Allbery
Date: Thu, 19 Oct 2000 00:00
39 lines
2307 bytes
Tim Pennick <tpennick@extra.axion.bt.co.uk> writes:

> Sorry Russ, I AM using 2.3.

Ah!  Then in that case this should be easier.

> Maybe its the references to nnrp.access that threw you of the scent.

Yup.

> This is the file that the example nnrpd_auth.pl file uses, and so I have
> re-instated it, as (if I understand correctly), readers.conf is disabled
> when you switch on NNRP_PERLAUTH in inn.conf.

Nothing looks at nnrp.access in 2.3 no matter what you do.

I believe that if you turn in nnrpperlauth, your Perl authentication stuff
is the *only* thing that's used.  That means that any IP-based
restrictions or the like you need to handle in your authenticate function.
I don't use the nnrp Perl authentication stuff, so I could be wrong, but
that was my understanding.

> Whatever happens within the 'authenticate' function, (assuming perl
> authentication is switched on and readers.conf is therefore ignored) if
> the authenticate function responds with "200 1 1 * 0" to a call which
> passed the 'connect' rather than 'authenticate' type attribute, the
> client should have full access to the groups carried by the server.

That's correct.

> I can't get this bit working as no groups are visible at all.

Okay, I can't see what could possibly be going wrong here.  Could you post
this section of your authenticate sub?

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Re: Authenticating with perl hooks
#48825
Author: Tim Pennick
Date: Fri, 20 Oct 2000 00:00
81 lines
4587 bytes
On 19 Oct 2000 11:54:08 -0700, Russ Allbery <rra@stanford.edu> wrote:
>Tim Pennick <tpennick@extra.axion.bt.co.uk> writes:
>
>> Sorry Russ, I AM using 2.3.
>
>Ah!  Then in that case this should be easier.
>
>> Maybe its the references to nnrp.access that threw you of the scent.
>
>Yup.
>
>> This is the file that the example nnrpd_auth.pl file uses, and so I have
>> re-instated it, as (if I understand correctly), readers.conf is disabled
>> when you switch on NNRP_PERLAUTH in inn.conf.
>
>Nothing looks at nnrp.access in 2.3 no matter what you do.
>
>I believe that if you turn in nnrpperlauth, your Perl authentication stuff
>is the *only* thing that's used.  That means that any IP-based
>restrictions or the like you need to handle in your authenticate function.

The example nnrpd_auth.pl file which I've been using, and which I thought came
with inn-2.3.0, explicitly opens two files, an nnrp.access file and a
users.cdb file, so I thought this was as good a strategy as any to follow.  If
you do an authenticate with 'connect', the nnrp.access file is checked, and if
you do an authenticate with type attribute set to 'authenticate' then the
users.cdb file is read.

My plan is that most newsgroups will match one of the patterns listed in
nnrp.access and will be available following the first run uf 'authenticate'.
However if the user then tries to access a group that isn't matched by any of
the entries in this file, the attempt will cause nnrpd to call authenticate
again with the 'authenticate' attribute type.  Users.cdb will contain user,
password and access list information.

HOwever, all this is jumping the gun a bit.

>I don't use the nnrp Perl authentication stuff, so I could be wrong, but
>that was my understanding.
>
>> Whatever happens within the 'authenticate' function, (assuming perl
>> authentication is switched on and readers.conf is therefore ignored) if
>> the authenticate function responds with "200 1 1 * 0" to a call which
>> passed the 'connect' rather than 'authenticate' type attribute, the
>> client should have full access to the groups carried by the server.
>
>That's correct.
>
>> I can't get this bit working as no groups are visible at all.
>
>Okay, I can't see what could possibly be going wrong here.  Could you post
>this section of your authenticate sub?
I've tried cutting it down to the bare minimum:
The following two lines are the first lines in the 'authenticate' sub.

@results = ("200","1","1","*","0");
return @results;

This returns a code 200 to the client, with a posting OK message, but sending
'list active' yields no newsgroups, although if I switch off nnrp_perlauth in
inn.conf, "list active" retrieves my active file.

I've been having a look at the code in .../inn-2.3.0/nnrpd/perl.c and
.../nnrpd.c, and it looks as though there isn't a direct relationship between
what my authenticate function returns as the first element of its returned
array, and the code the server sends the client, but this might be a red
herring.

I wonder if anyone else is using perl authentication with INN2.3.0, and if so,
whether they could post (or send me) an example of how they got it to work.  I
was trying to use this method because I thought it would be a smipler way to
maintain the access lists, than using readers.conf.  If there's a better way
of doing it, I'd be extatic to hear it.

Regards to all,

Tim Pennick
>-- 
>Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

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