🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #37356

Re: NNTP authentication, revisited (C2 sec)

#37356
From: Russ Allbery
Date: Mon, 10 May 1999 00:00
56 lines
2645 bytes
nico halpern <nico_halpern@my-dejanews.com> writes:

> I recently installed inn-2.2 on a Digital UNIX v4.0b box. I have been
> having problems hacking nnrpd.c trying to have it authenticate users
> from /etc/passwd. nnrpd (as forked by innd) runs as the 'news' user, and
> the calls to getpwnam(user) for user->pw_passwd return "*", as expected.

FYI, readers.conf in current snapshots (not STABLE) has the capabilities
required to do this in a cleaner fashion.  It can talk to an external
authentication program that can make the right OS-dependent or setup-
dependent calls to work out the authentication.

> To get around this, I modified nnrpd.c as attached below. I have tested
> the routine sia_validate_user() on a separate (test) program, and it
> seems to work just fine, returning SIAFAIL when the user/pass don't
> match.

> +#if HAVE_SIASEC
> +#      include <sia.h>
> +#endif

This should really be either:

#ifdef HAVE_SIASEC

or

#if defined(HAVE_SIASEC)

What you have may work, but I think it's unnecessarily unportable.

> +#if HAVE_SIASEC
> +               if (sia_validate_user(NULL, argc_sec, argv_sec, NULL,
> user,
> +                                         NULL, 1, NULL, pass)==SIAFAIL)
>                 continue;
> +#endif

The problem with doing this is that if there's any other sort of error,
you've lost it.  You're only checking SIAFAIL.  You really want to save
the return code of sia_validate_user() and make sure it succeeded.

Are you running nnrpd as root when you run it by hand?  Does
sia_validate_user() work for any user or only for root?  (I don't know
much about the facility that you're using.)

Something else to try, just to make sure, is comment out your
sia_validate_user() call so that that section always succeeds and it
thinks authentication always worked.  Then try connecting with a client
and see if you still get that error message.  That will determine if the
call to sia_validate_user() is the problem or not.

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

Technical Details
Message-ID: <ylyaiwtmbz.fsf@windlord.stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <7h7u9l$t3v$1@nnrp1.deja.com>

Show Full Headers
Complete Article Headers
Message-ID: <ylyaiwtmbz.fsf@windlord.stanford.edu>
Subject: Re: NNTP authentication, revisited (C2 sec)
Date: Mon, 10 May 1999 00:00:00 +0000
From: Russ Allbery <rra@stanford.edu>
References: <7h7u9l$t3v$1@nnrp1.deja.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 476408496
Organization: The Eyrie
Newsgroups: news.software.nntp