Article View: news.software.nntp
Article #37378NNTP authentication, revisited (C2 sec)
From: nico_halpern
Date: Tue, 11 May 1999 00:00
Date: Tue, 11 May 1999 00:00
102 lines
3646 bytes
3646 bytes
Hello,
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.
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.
When I telnet to the nntp port or run nnrpd in stdin/stdout
mode, the authentication dialog is as follows:
200 news.ramapo.edu InterNetNews NNRP server INN 2.2 21-Jan-1999 ready
(posting ok).
authinfo user foo
381 PASS required
authinfo pass bar
281 Ok
quit
205 .
The problem is, when I use regular news clients to connect
(pine,netscape,etc), nnrpd returns 'bad_auth'. I have run nnrpd through
gdb, stepping line by line, but I still can't figure out what is going
wrong here.
Is the logic in the code OK? Anyone has done this before? Can someone
help? I have found little (or none) information on the FAQ, ORA's
Managing Usenet (3rd ed.) on this particular topic..
I must say, this is my first news server, and this little problem is
annoying the hell out of me. Are there any other ways of accomplishing
this?
This is what my nnrp.access looks like:
*:: -no- : -no- :!*
*:Read Post:+::*
TIA,
-Nico Halpern.
--- nnrpd.c.original Mon May 10 10:58:55 1999
+++ nnrpd.c Mon May 10 11:06:22 1999
@@ -25,6 +25,9 @@
#if HAVE_GETSPNAM
# include <shadow.h>
#endif /* HAVE_GETSPNAM */
+#if HAVE_SIASEC
+# include <sia.h>
+#endif
/*
** Here is some defensive code to protect the news server from hosts,
@@ -149,6 +152,11 @@
{ NULL }
};
+#if HAVE_SIASEC
+int argc_sec = 0;
+char ** argv_sec = NULL;
+#endif
+
/*
** Log a summary status message and exit.
@@ -480,8 +488,11 @@
if ((spwd = getspnam(user)) != NULL)
pwd->pw_passwd = spwd->sp_pwdp;
#endif
- if (!EQ(pwd->pw_passwd, crypt(pass, pwd->pw_passwd)))
+#if HAVE_SIASEC
+ if (sia_validate_user(NULL, argc_sec, argv_sec, NULL,
user,
+ NULL, 1, NULL, pass)==SIAFAIL)
continue;
+#endif
} else {
/* Matching for a specific user or just the host? */
if (user && (!EQ(user, fields[2]) || !EQ(pass, fields[3])))
@@ -784,6 +795,11 @@
struct group *grp;
GID_T shadowgid;
#endif /* HAVE_GETSPNAM */
+
+#if HAVE_SIASEC
+ argc_sec = argc;
+ argv_sec = argv;
+#endif
#if !defined(HPUX)
/* Save start and extent of argv for TITLEset. */
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
Technical Details
Message-ID:
<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-mailShow Full Headers
Complete Article Headers
Message-ID: <7h7u9l$t3v$1@nnrp1.deja.com> Subject: NNTP authentication, revisited (C2 sec) Date: Tue, 11 May 1999 00:00:00 +0000 From: nico_halpern@my-dejanews.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: 476373185 X-Http-Proxy: 1.0 x31.deja.com:80 (Squid/1.1.22) for client 24.3.136.79 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Tue May 11 00:40:22 1999 GMT Newsgroups: news.software.nntp X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I)