🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
6 messages
6 total messages Started by Alex French Fri, 25 Sep 1998 00:00
Alternative nntp authentication methods?
#31741
Author: Alex French
Date: Fri, 25 Sep 1998 00:00
8 lines
818 bytes
Does anyone have a patch to let me use an arbitrary program to do nnrpd
authentication? Or even better, to use tacacs+?


Thanks,
Alex.

Re: Alternative nntp authentication methods?
#31723
Author: John Payne
Date: Fri, 25 Sep 1998 00:00
139 lines
5377 bytes
On Fri, 25 Sep 1998 16:39:20 +0100, Alex French <alex@medianet.ie> wrote:
>Does anyone have a patch to let me use an arbitrary program to do nnrpd
>authentication? Or even better, to use tacacs+?

This is what we're using here... written by brian and applied to INN2.1
we will get around to inn.conf'ing the auth program, but lethargy etc
have delayed it

It works for us.... no promises or guarantees 

*** nnrpd-orig.c	Wed Jul  8 01:42:47 1998
--- nnrpd.c	Fri Jul 31 02:24:02 1998
***************
*** 366,371 ****
--- 366,375 ----
      char		buff[BIG_BUFFER];
      char		filename[SMBUF];
      char		*fields[5];
+     /* <bln> */
+    int bln_rc;
+    char *bln_cmd;
+    char *bln_authp = "/usr/local/sbin/sack_nnrpd_auth";
  
      if ((F = fopen(accessfile, "r")) == NULL) {
  	syslog(L_ERROR, "%s cant fopen %s %m", ClientHost, accessfile);
***************
*** 447,461 ****
  	} else
  	    filename[0] = '\0';
  
! #ifdef DONT_HAVE_SHADOW
  	/* See if we should lookup a specific user in the passwd file */
  	if (user && pass && EQ(fields[2], "+")) {
  	    if ((pwd = getpwnam(user)) == NULL)
  		continue;
  	    if (!EQ(pwd->pw_passwd, crypt(pass, pwd->pw_passwd)))
  		continue;
- 	} else
  #endif
  	/* Matching for a specific user or just the host? */
  	if (user && (!EQ(user, fields[2]) || !EQ(pass, fields[3])))
  	    continue;
--- 451,483 ----
  	} else
  	    filename[0] = '\0';
  
! /* #ifdef DONT_HAVE_SHADOW */
  	/* See if we should lookup a specific user in the passwd file */
  	if (user && pass && EQ(fields[2], "+")) {
+ 
+             /* <bln> */
+             bln_cmd = (char *) malloc(strlen(bln_authp) + strlen(user)
+                                       + strlen(pass) + 3);
+             strcpy(bln_cmd, bln_authp);
+        	    strcat(bln_cmd, " ");
+             strcat(bln_cmd, user);
+             strcat(bln_cmd, " ");
+             strcat(bln_cmd, pass);
+             bln_rc = system(bln_cmd);
+ 
+             if(bln_rc)
+               continue;
+ 
+ #ifdef 0
  	    if ((pwd = getpwnam(user)) == NULL)
  		continue;
  	    if (!EQ(pwd->pw_passwd, crypt(pass, pwd->pw_passwd)))
  		continue;
  #endif
+         /* </bln> */
+ 
+ 	} else
+ /* #endif */
  	/* Matching for a specific user or just the host? */
  	if (user && (!EQ(user, fields[2]) || !EQ(pass, fields[3])))
  	    continue;
***************
*** 463,468 ****
--- 485,497 ----
  	PERMcanread = strchr(fields[1], 'R') != NULL;
  	PERMcanpost = strchr(fields[1], 'P') != NULL;
  	PERMlocpost = strchr(fields[1], 'L') != NULL;
+ 
+         /* <bln> test */
+         if(PERMcanread && PERMcanpost) PERMlocpost = 1;
+         /* </bln> */ 
+ 
  	if (strchr(fields[1], 'N') != NULL) PERMnewnews = TRUE;
  	if (ForceReadOnly) PERMcanpost=FALSE;
  	(void)strcpy(PERMuser, user ? user : fields[2]);


and the comment block from sack_nnrpd_auth.c

/*
 * sack_nnrpd_auth.c
 * 
 * July 7, 1998 - Brian L. Naylor
 *
 * Simple password-checking program to be spawned from nnrpd.
 * (We use MD5 passwords with PAM in /etc/passwd, and nnrpd
 * doesn't come close to supporting that.  There's already a
 * patch for nnrpd to spawn an external passwd checker, so
 * it's much easier just do write that than to hack in PAM
 * support.  impatience, *laziness*, and hubris.. :)
 *
 * User passwords reside in ~/.nntp_pass.  This file must 
 * consist of exactly one line:
 *
 * plaintext_password
 *
 * ..and it must be a plain file of mode x00 or this program 
 * will return an error.
 *
 * In order to call this program, simply pass it two arguments:
 * username and password.  It will verify that the user exists,
 * check the existence of ~/.nntp_pass and verify that its 
 * permissions are correct, and finally check that the password
 * passed in matches the one in the file.
 *
 * Possible return codes:
 *
 *   0 - success; the light is green, the trap is clean
 *   1 - failure; no such user
 *   2 - failure; ~/.nntp_pass does not exist
 *   3 - failure; ~/.nntp_pass is not a plain file
 *   4 - failure; ~/.nntp_pass has incorrect ownership
 *   5 - failure; ~/.nntp_pass is read- or write-able by group/other
 *   6 - failure; passwords do not match
 *   7 - failure; incorrect number of arguments
 *   8 - failure; unknown error
 */

-- 
John Payne      http://www.sackheads.org/jpayne    john@sackheads.org
       Sarcasm by request                        Fax: +44 870 0547954
My mail provider doesn't welcome UBE -  http://www.sackheads.org/uce/

Re: Alternative nntp authentication methods?
#31727
Author: Brian L. Naylor
Date: Fri, 25 Sep 1998 00:00
28 lines
1798 bytes
And on 25 Sep 1998 16:27:05 GMT, John Payne (e) came down
from on high, and said:
>On Fri, 25 Sep 1998 16:39:20 +0100, Alex French <alex@medianet.ie> wrote:
>>Does anyone have a patch to let me use an arbitrary program to do nnrpd
>>authentication? Or even better, to use tacacs+?
>
>This is what we're using here... written by brian and applied to INN2.1
>we will get around to inn.conf'ing the auth program, but lethargy etc
>have delayed it
>
>It works for us.... no promises or guarantees 

[snip my dodgy patch]

Do take care to inspect the code if you are brave enough to apply 
that patch.  I diddled it together without a single thought for 
any installation but our own, and I doubt it's terribly portable 
across configurations. 

Also, the stuff towards the bottom (yeah, that code that's marked
"test") should be removed.  =)

-- 
Brian L. Naylor                                  brian@sackheads.org
"The BOFHBot hates /all/ lusers equally.  I'm not the BOFHBot, but I
          think that's just a great policy."  -- AIXBot2

Re: Alternative nntp authentication methods?
#31768
Author: Per Hedeland
Date: Sun, 27 Sep 1998 00:00
18 lines
1502 bytes
In article <slrn70o6tu.kvf.brian+usenet@penfold.sackheads.org>
brian+usenet@sackheads.org (Brian L. Naylor) writes:
>Do take care to inspect the code if you are brave enough to apply 
>that patch.  I diddled it together without a single thought for 
>any installation but our own, and I doubt it's terribly portable 
>across configurations. 

Don't know about that, but I'd like to point out that passing user input
unscreened to system() isn't a very good idea security-wise - for that
reason, and to avoid displaying the password in (the probably unlikely)
case someone who shouldn't see it is around and does a 'ps' at the wrong
moment, passing both userid and password on stdin to the program is a
better way.

--Per Hedeland
per@erix.ericsson.se

Re: Alternative nntp authentication methods?
#31777
Author: Alex French
Date: Sun, 27 Sep 1998 00:00
16 lines
1187 bytes
On 25 Sep 1998 22:39:58 GMT, brian+usenet@sackheads.org (Brian L.
Naylor) was rumoured to have said:

>And on 25 Sep 1998 16:27:05 GMT, John Payne (e) came down
>from on high, and said:

>
>[snip my dodgy patch]


Thanks guys, just the ticket!


Alex.

Re: Alternative nntp authentication methods?
#31799
Author: Brian L. Naylor
Date: Mon, 28 Sep 1998 00:00
24 lines
1776 bytes
On 27 Sep 1998 10:55:01 GMT, Per Hedeland <per@erix.ericsson.se> wrote:
>Don't know about that, but I'd like to point out that passing user input
>unscreened to system() isn't a very good idea security-wise - for that

Egad, I know better than that.  :-/

*sigh*, nothing like public embarassment to put an end to that whole
'laziness' thing.

Here's a much more reasonable patch for external user authentication.
http://www.sackheads.org/~bnaylor/nnrpd-authentication-v2.patch

Compile nnrpd with -DEXTERNAL_AUTH="\"/path/to/auth/proggie\"" and
though not necessarily logically consistent, you'll also need to
make sure DONT_HAVE_SHADOW is defined.

"username\npassword\n" is written to the auth program's stdin, as
suggested by Per.  Non-zero exit status from the auth program indicates 
failure, as before.

-brian


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