🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
15 messages
15 total messages Started by Bill Kearney Thu, 27 Dec 2001 16:42
Best way to determine if login is required?
#55758
Author: Bill Kearney
Date: Thu, 27 Dec 2001 16:42
17 lines
1815 bytes
Hi all,

What's considered the 'best practice' for determining if a client needs to
log into a server?  I'm assuming the server is going to be supporting the
AUTHINFO commands.  How should one 'feel out' the server to see if it wants
authentication?  I'm trying to write a client that will handle both
authenticated and anonymous access.  But if the user 'improperly' inserts a
username/password pair I'm considering whether the client should ignore
those values and proceed anonymously.  That is, anonymously in the context
of not performing the authinfo command.

Thanks,
Bill Kearney



Re: Best way to determine if login is required?
#55757
Author: Dirk Nimmich
Date: Thu, 27 Dec 2001 19:15
28 lines
2400 bytes
Bill Kearney wrote:
> What's considered the 'best practice' for determining if a client needs to
> log into a server?  I'm assuming the server is going to be supporting the
> AUTHINFO commands.  How should one 'feel out' the server to see if it wants
> authentication?

Unfortunately, there is no best practice.

Sometimes you can just send your authentication data before
anything else and it will do. But some servers don't like this.
(Microsoft's NNTP server seems to stay in an endless loop after
this, for example.)

Most servers respond with a 480 code if they expect authentication.
Unfortunately you don't know what type of authentication (AUTHINFO
GENERIC or USER/PASS) they want, but using AUTHINFO USER/PASS seems
to be ok most of the time. Furthermore, some servers only give you
access to some (default) groups unless you authenticate the user,
so legitimate users have to provide their authentication data
without such a request by the server to get full access.

Therefore, tin for example only sends authentication data upon
request of the server (480 response code). (It first tries AUTHINFO
GENERIC, then AUTHINFO USER/PASS.) But there is an command line
option to authenticate the user at connection startup to help those
users reading from a server that only gives full access after
pro-active login.
Re: Best way to determine if login is required?
#55759
Author: Bill Kearney
Date: Thu, 27 Dec 2001 20:07
47 lines
3082 bytes
> Unfortunately, there is no best practice.

As I expected.

> Sometimes you can just send your authentication data before
> anything else and it will do. But some servers don't like this.
> (Microsoft's NNTP server seems to stay in an endless loop after
> this, for example.)

Hmm, I've not seen this behavior.  It's responded to all 'authinfo
user/pass' commands without going into a loop.  Any particular version
you're thinking of?  The latest one in Win2k Sp3 seems to not hang.

> Most servers respond with a 480 code if they expect authentication.
> Unfortunately you don't know what type of authentication (AUTHINFO
> GENERIC or USER/PASS) they want, but using AUTHINFO USER/PASS seems
> to be ok most of the time.

Ick, I'd forgotten about AUTHINFO GENERIC.  Any idea what servers use it
instead of user/pass?

> Furthermore, some servers only give you
> access to some (default) groups unless you authenticate the user,
> so legitimate users have to provide their authentication data
> without such a request by the server to get full access.

This I have seen.  I've seen some that won't even speak to you unless you
authenticate.  Some that would present a full list but not allow read/post
and then some that would customize the results based on authentication.


> Therefore, tin for example only sends authentication data upon
> request of the server (480 response code). (It first tries AUTHINFO
> GENERIC, then AUTHINFO USER/PASS.) But there is an command line
> option to authenticate the user at connection startup to help those
> users reading from a server that only gives full access after
> pro-active login.

This sounds good.  I'll try that and report back.

Thanks!

-Bill Kearney



Re: Best way to determine if login is required?
#55760
Author: Russ Allbery
Date: Thu, 27 Dec 2001 22:10
13 lines
1520 bytes
Bill Kearney <wkearney99@hotmail.com> writes:

> Ick, I'd forgotten about AUTHINFO GENERIC.  Any idea what servers use it
> instead of user/pass?

Practically no one uses AUTHINFO GENERIC.

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

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Best way to determine if login is required?
#55762
Author: Frank Durda IV
Date: Fri, 28 Dec 2001 00:25
185 lines
9933 bytes
Bill Kearney <wkearney99@hotmail.com> wrote:
: Hi all,
: 
: What's considered the 'best practice' for determining if a client needs to
: log into a server?

Here are the steps I live by on my servers:

(1) If a newsreader wants to authenticate, it SHOULD send AUTHINFO commands 
    immediately after connecting.  (Our server can grant users additional
    services and speed, but they have to identify themselves first, otherwise
    they may get the stock package if connecting from a trusted netblock;
    otherwise, they get no access at all.)

(2) If the newsreader doesn't authenticate right away, it can try to do stuff
    until confronted with a 480 response (which may come from any command
    other than HELP, QUIT and AUTHINFO).  At that point, the newsreader MUST
    choose:
	(3) send the AUTHINFO commands now and on success*, repeat the blocked
	    command, and then proceed normally.
    OR	
        (4) don't go that direction any more since the unknown client (as the
	    server knows you right now) clearly isn't allowed to do whatever
	    the command was that returned 480.

Using the above formula, we have had absolutely no problems in dealing with
Microsoft, Netscape, Agent and numerous other newsreaders.  All seem to cope
reasonably well, with one obscure exception, mentioned below.


* Based on our discussions with Forte in the early days of authinfo and how
  they wanted the server to behave, our servers close a connection with a
  502 error immediately (after a sleep(n)) if an "authinfo pass" fails to
  match the expected login/password entry in the access file.   The sleep is
  there to discourage password cracking attempts, greatly reducing the number
  of tries that can be attempted per hour.  All good and bad authinfo
  attempts are logged.

  As demonstrated in recent days, Typhoon servers apparently let you remain
  connected, despite giving a bad login/password.  This is a nasty security
  problem because no legit newsreader will try alternate login/passwords if
  the first one fails, so this behavior of the server only benefits the
  hacker, who can sit there for hours, brute force cracking passwords,
  possibly with little or no logging of what is going on.  Not nice.



In the one case where the above flow didn't work, we have had an instance of
a customer ordering one of the higher-level packages, and for these you
always have to authenticate so the server can adjust accordingly.  We ran
into a version of trn that if it didn't run into a 480 error, it would never
authenticate, and there was no way to force it to authenticate without it
first encountering a 480 error.

Finally, we set up a special port that always acts like you are unknown and
required everybody to authenticate.  Of course, about the time we got the
alternate port working, the customer upgraded to a newer version of trn
which had a way to force authentication, and the issue went away.

The moral for anyone writing a newsreader: be sure that there is a way
to force authentication to occur on each connect rather than trying to always
make the determination automatically and then running into a situation like
the one described.


FYI, As a troubleshooting trick, Airnews alters the greeting banner and HELP
command display for each connection so you can see what privs/speeds
you have based on what we know about you right now, like this:

200 library1.airnews.net AIRNEWS Server is ready. 6(108) [Who_are_you] (posting ok)
help
100 Legal commands
  authinfo user Name|pass Password
  article [MessageID|Number]
...
  xpath MessageID
Your Service level is Not yet logged-in

(At this point, about all you can do is authinfo, quit and help.  Other
 commands either fail with 480 or return "playing-dumb" answers.)

authinfo user amsomebody@connecting.from.somewhere.net
381 PASS required
authinfo pass apassword
281 Ok - Classic 150Kbit/sec, 2 connects allowed
help
100 Legal commands
  authinfo user Name|pass Password
  article [MessageID|Number]
...
  xpath MessageID
Your Service level is Classic 150Kbit/sec, 2 connects allowed


or coming from a known netblock that has a different service package:

200 library1.airnews.net AIRNEWS Server is ready. 6(108) [foobarnet] (posting ok)
help
100 Legal commands
  authinfo user Name|pass Password
  article [MessageID|Number]
...
  xpath MessageID
Your Service level is Foobarnet News Access 768Kbit/sec, 4 connects allowed


- - - - - - - - -


When it gets down to it, the entire authentication thing is really pasted-on.
The original code at Airnews was crafted to exactly match what Agent was
emitting, because the stock INN tree didn't have any code to handle
AUTHINFO back then (the 1.4 and 1.5 era).  Today, we now have a system that
directs a given login to a configuration file that describes all the settings
for that class of user, keeping the access files small but allowing a lot
of customization.


We also fought the problem of the standard greeting response code, 200/201.**
We found that Agent and other newsreaders that were confronted with a 201
on initial connect would never allow posting, (wouldn't even issue a post
command), even if they authenticated (via authinfo) and would be allowed to
post once authenticated.  This was kind of dumb anyway, because the server
99% of the time wouldn't know if the customer was going to be allowed to post
at the time the greeting banner is displayed anyway.

So, to this day we have to lie and greet everybody with 200 regardless of
whether posting is allowed or not.  The client finds out when they run into
a 480 or some other restricting response.

** It's actually worse than that.  Seems some versions of Agent weren't
   using the response code numbers, and were actually looking for the string
   "posting ok".

   We even changed the "help" output at one point to only show the commands
   that were available prior to authenticating, and doing this broke the
   Agent newsreaders.  Seems some Agent versions issued a "help" command 
   immediately after connecting and prior to authenticating, then analyzed
   the "help" output to figure out what commands were available on the
   server and would use or not use the available commands accordingly.
   This is so non-RFC-ish, something you think Microsoft might come up
   with!  :-(

   So a tip: don't output a shorter list of help commands prior to
   authenticating, or change their order or spacing in the help display from
   what appears in stock INN, or else some Agent newsreaders will think
   that they have no or few commands to work with.  (No, dropping "post"
   from the help list didn't change that other irritating behavior, but
   thanks for asking.)  I hope modern Agent versions don't do this anymore.


: I'm assuming the server is going to be supporting the
: AUTHINFO commands.  How should one 'feel out' the server to see if it wants
: authentication?  I'm trying to write a client that will handle both
: authenticated and anonymous access.  But if the user 'improperly' inserts a
: username/password pair I'm considering whether the client should ignore
: those values and proceed anonymously.  That is, anonymously in the context
: of not performing the authinfo command.

If you are being anonymous, don't issue the authinfo commands, unless by
chance the server has actually created an entry in the access file for
"anonymous" with an empty password, like FTP servers do.  I've never seen
that done on a NNTP server, and it seems pointless if you can simply accept
post/article commands without requiring an authinfo command in the first
place.

Of course, there is a difference between the news server knowing who the
clients are and requiring authinfo, and disclosing that knowledge in any
posts that are generated or in any logs that are kept.   Quite a few servers
go out of their way to not add anything to posts that would identify the
poster to an individual, but if the guy with the court order shows up, most
server operators want to be able to go back and identify the poster rather
than lose their equipment to an electronic dissecting lab.  More and more
court orders sound like the highwayman Dennis Moore: "The Rogues Identity,
or Your Server".  Or was that Lophines?  :-(



Frank Durda IV - only this address works:|"Like the HitchHikers Guide to the
   <uhclem.jan02%nemesis.lonestar.org>   | Galaxy, when the Internet is
                                         | inaccurate, at least it can be said
This Anti-spam address expires Jan. 31st | to be definitively inaccurate."
Copr. 2001, ask before reprinting.

Re: Best way to determine if login is required?
#55763
Author: Andrew - Supernews
Date: Fri, 28 Dec 2001 00:51
58 lines
3909 bytes
In article <5B1BB2EE7B245B3C.BB02DD5EEF21BD78.75A5618A870ED179@lp.airnews.net>,
Frank Durda IV wrote:
[snip lots of stuff about authentication] 
> We also fought the problem of the standard greeting response code, 200/201.**
> We found that Agent and other newsreaders that were confronted with a 201
> on initial connect would never allow posting, (wouldn't even issue a post
> command), even if they authenticated (via authinfo) and would be allowed to
> post once authenticated.  This was kind of dumb anyway, because the server
> 99% of the time wouldn't know if the customer was going to be allowed to post
> at the time the greeting banner is displayed anyway.
> 
> So, to this day we have to lie and greet everybody with 200 regardless of
> whether posting is allowed or not.  The client finds out when they run into
> a 480 or some other restricting response.

We send 200 if either we know that the user can post, or we don't yet know
enough about who the user is to decide either way. We only send 201 if there
is no way that this connection is ever going to be able to post.

>    We even changed the "help" output at one point to only show the commands
>    that were available prior to authenticating, and doing this broke the
>    Agent newsreaders.  Seems some Agent versions issued a "help" command 
>    immediately after connecting and prior to authenticating, then analyzed
>    the "help" output to figure out what commands were available on the
>    server and would use or not use the available commands accordingly.
>    This is so non-RFC-ish, something you think Microsoft might come up
>    with!  :-(
> 
>    So a tip: don't output a shorter list of help commands prior to
>    authenticating, or change their order or spacing in the help display from
>    what appears in stock INN, or else some Agent newsreaders will think
>    that they have no or few commands to work with.

Hmm.

Our help output has looked like this for some years now:

100 help follows
Supported commands: 
  ARTICLE     AUTHINFO    BODY        DATE        GROUP       HDR       
  HEAD        HELP        LAST        LIST        LISTGROUP   MODE      
  NEWGROUPS   NEWNEWS     NEXT        OVER        PAT         POST      
  QUIT        SLAVE       STAT        XGTITLE     XHDR        XOVER     
  XROVER      XPAT        
For further information contact <news@supernews.com>

I don't recall any reports of problems with this. We did, however, at one
point discover that some Agent versions get confused if the HELP output
arrives split across multiple segments (tsk, very sloppy programming there);
if you have Agent's "keepalives" setting enabled, it issues regular HELP
commands to avoid having the connection time out (also an exceptionally bad
idea), and it would get permanently out of sync with the responses if they
did not arrive as single segments.

-- 
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services
Re: Best way to determine if login is required?
#55764
Author: Russ Allbery
Date: Fri, 28 Dec 2001 01:05
18 lines
1943 bytes
Andrew <andrew+nonews@supernews.com> writes:

> I don't recall any reports of problems with this. We did, however, at
> one point discover that some Agent versions get confused if the HELP
> output arrives split across multiple segments (tsk, very sloppy
> programming there); if you have Agent's "keepalives" setting enabled, it
> issues regular HELP commands to avoid having the connection time out
> (also an exceptionally bad idea), and it would get permanently out of
> sync with the responses if they did not arrive as single segments.

Why on earth didn't they use DATE?

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

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Best way to determine if login is required?
#55765
Author: Frank Durda IV
Date: Fri, 28 Dec 2001 01:40
40 lines
3089 bytes
Andrew - Supernews <andrew+nonews@supernews.com> wrote:
: Hmm.
: 
: Our help output has looked like this for some years now:
: 
: 100 help follows
: Supported commands: 
:  ARTICLE     AUTHINFO    BODY        DATE        GROUP       HDR       
:  HEAD        HELP        LAST        LIST        LISTGROUP   MODE      
:  NEWGROUPS   NEWNEWS     NEXT        OVER        PAT         POST      
:  QUIT        SLAVE       STAT        XGTITLE     XHDR        XOVER     
:  XROVER      XPAT        
: For further information contact <news@supernews.com>
: 
: I don't recall any reports of problems with this. We did, however, at one

I think you are lucking-out.  As long as the words it was looking for
showed-up in the expected alphabetical order, it seemed happy.  It didn't
seem to care about the syntax part.   If you were to leave some commands out,
or have your entries sorted down columns, it would probably break.  We
gritched about this a lot, so maybe Forte doesn't do try to devine legal
commands from a free-format reply anymore.  We ran into this first back 
around 1996 and perhaps they fixed in since then.


: We send 200 if either we know that the user can post, or we don't yet know
: enough about who the user is to decide either way. We only send 201 if there
: is no way that this connection is ever going to be able to post.

Yeah, same here, but that is a very rare event.  They are more likely to
get a 400 "go away" greeting during maintenance than ever see a 201.


Frank Durda IV - only this address works:|"Windows XP has gone 013^H^H^H004
   <uhclem.jan02%nemesis.lonestar.org>   | days without a new security hole
                                         | being discovered.  Pretty amazing
This Anti-spam address expires Jan. 31st | for the 'most secure operating
Copr. 2001, ask before reprinting.       | system on the market'."

Re: Best way to determine if login is required?
#55766
Author: Frank Durda IV
Date: Fri, 28 Dec 2001 01:45
18 lines
2124 bytes
Russ Allbery <rra@stanford.edu> wrote:
: Why on earth didn't they use DATE? [as a keepalive dummy command]

Perhaps because there isn't a "date" command in RFC 977?

The better question is, why didn't they just let the connection close,
and later on start a new one if they needed one?   Naw, that action would
be efficient and a conserver of resources.   They probably couldn't get the
"Runs on Windows" stickers if you did that... :-)
 

Frank Durda IV - only this address works:|"Windows XP has gone 013^H^H^H004
   <uhclem.jan02%nemesis.lonestar.org>   | days without a new security hole
                                         | being discovered.  Pretty amazing
This Anti-spam address expires Jan. 31st | for the 'most secure operating
Copr. 2001, ask before reprinting.       | system on the market'."

Re: Best way to determine if login is required?
#55767
Author: Russ Allbery
Date: Fri, 28 Dec 2001 02:21
15 lines
1689 bytes
Frank Durda IV <uhclem.jan02@nemesis.lonestar.org> writes:
> Russ Allbery <rra@stanford.edu> wrote:

>> Why on earth didn't they use DATE? [as a keepalive dummy command]

> Perhaps because there isn't a "date" command in RFC 977?

Ah, yeah.  *sigh*  I'd forgotten about that.

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

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Best way to determine if login is required?
#55768
Author: Don Quixote
Date: Fri, 28 Dec 2001 03:55
8 lines
1449 bytes
Andrew - Supernews might have said:

[Buncha stuff 'bout Agent, and how it does and doe snot errors & whatnot]

May I forward this to them?


Re: Best way to determine if login is required?
#55769
Author: Curt Welch
Date: Fri, 28 Dec 2001 04:08
27 lines
2427 bytes
andrew@supernews.com wrote:
> In article
> <5B1BB2EE7B245B3C.BB02DD5EEF21BD78.75A5618A870ED179@lp.airnews.net>,
> Frank Durda IV wrote: [snip lots of stuff about authentication]
> > We also fought the problem of the standard greeting response code,
> > 200/201.**

> We send 200 if either we know that the user can post, or we don't yet
> know enough about who the user is to decide either way. We only send 201
> if there is no way that this connection is ever going to be able to post.

I never send 201.  Always 200.

> I don't recall any reports of problems with this. We did, however, at one
> point discover that some Agent versions get confused if the HELP output
> arrives split across multiple segments (tsk, very sloppy programming
> there);

My server was sending the 200 greeting string as two segments (a side
effect of speed limiting the output to a very low value before
authentication). I found two PC picture decoding newsreaders that couldn't
deal with that before I changed it.  Lots of sloppy clients out there...

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: Best way to determine if login is required?
#55770
Author: Curt Welch
Date: Fri, 28 Dec 2001 04:22
40 lines
3342 bytes
"Bill Kearney" <wkearney99@hotmail.com> wrote:
> Hi all,
>
> What's considered the 'best practice' for determining if a client needs
> to log into a server?  I'm assuming the server is going to be supporting
> the AUTHINFO commands.  How should one 'feel out' the server to see if it
> wants authentication?  I'm trying to write a client that will handle both
> authenticated and anonymous access.  But if the user 'improperly' inserts
> a username/password pair I'm considering whether the client should ignore
> those values and proceed anonymously.  That is, anonymously in the
> context of not performing the authinfo command.

No you shouldn't do that.  You need to force the user to decide whether
to send the password or not, and if the user tells you to send the
password, do that right after sending MODE READER (which should always send
at the start even though most "real" servers ignore it. :)).  You will also
need to watch for the 480 responses and be ready to send it again however.

To help the user understand the issues, do something like what OE has done.
Add an extra checkbox that says something like "server requires user name
and password".  And if they don't check that, don't let them enter the
user name and password (i.e. disable or hide the user name and password
fields).  This gives the user something obvious to try when the login isn't
working, i.e. they try turning that check off to see if it works.

Also, when they have a user name and password which isn't working, it would
be good to include some words of advice in the error message - i.e. tell
them to try turning the checkbox off (or even better, give them a button
they can click in the error dialog which will try the connection again
without sending the user name and password).

There is no standard type of behavior you can see in news server to know if
it's needed or not.  Even a server which is working may work "better" (e.g.
give the user a higher speed connection) after authenticating, so you
should always authenticate if the user has told you to do that.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: Best way to determine if login is required?
#55771
Author: Bill Kearney
Date: Fri, 28 Dec 2001 04:40
17 lines
1972 bytes
>   As demonstrated in recent days, Typhoon servers apparently let you
remain
>   connected, despite giving a bad login/password.  This is a nasty
security
>   problem because no legit newsreader will try alternate login/passwords
if
>   the first one fails, so this behavior of the server only benefits the
>   hacker, who can sit there for hours, brute force cracking passwords,
>   possibly with little or no logging of what is going on.  Not nice.

Unfortunately, Typhoon is not the only server that allows this.  I agree
with you, disconnecting failed authentication seems like a very good idea.

-Bill Kearney


Re: Best way to determine if login is required?
#55779
Author: Dirk Nimmich
Date: Fri, 28 Dec 2001 18:54
28 lines
2248 bytes
Bill Kearney wrote:
[Dirk Nimmich wrote:]
>> Sometimes you can just send your authentication data before
>> anything else and it will do. But some servers don't like this.
>> (Microsoft's NNTP server seems to stay in an endless loop after
>> this, for example.)
> 
> Hmm, I've not seen this behavior.

I see it was somewhat misleading what I wrote. If you supply
authentication data the server does not want to have (e.g. send an
invalid username/password pair), the server sends a 502 error
message and then responds any following command with 480 which in
turn gets answered by a second try of authentication and so on. It
does not close the connection, but you cannot use the server even
if you would have had access to it if you didn't supply any
authentication.

> Any particular version you're thinking of?

Just try with the one running at msnews.microsoft.com.

> Ick, I'd forgotten about AUTHINFO GENERIC.  Any idea what servers use it
> instead of user/pass?

Very few. And if they do, you have to know what they expect. That's
why so few clients seem to support it.
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