🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
7 messages
7 total messages Started by Nate Shockey Thu, 18 Dec 1997 00:00
INN Shadow password patch...
#24469
Author: Nate Shockey
Date: Thu, 18 Dec 1997 00:00
210 lines
6305 bytes
This is a multi-part message in MIME format.
--------------C7022435F3BE234DDB0479B5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

INN-1.7.2 shadow password file patch for Solaris...

        I'm not saying that this patch won't work with other
operating systems, I've just never tried it.  Ok, first
thing, copy the patch to your inn-1.X.X/nnrpd directory, and then
apply the patch in the normal way.
        Here's where a little explanation is necessary.
In order to read the shadow file, you have to be root, right?
Well, nobody wants to leave nnrpd running as root just so a
few lousy lusers can read their news.  The problem also exists
that the "authinfo" command is not required, which means
you can't force a setuid() right after the authinfo, because
not everyone does it.  The patch fixes this, but it still
requires nnrpd to be _run_ as root.  As soon as any command
other than authinfo is entered it will change itself
to news.  (It is up to you, however, to make nnrpd
run originally as root.  I run nnrpd from inetd for other
reasons, so this wasn't an issue for me.)
        In order to do this, though, you will have to
edit "nnrpd.h" and change the #define NEWS_UID to
the uid of your user "news" _after you have installed
the patch_.

        Thanks!  If this causes any problems, let me know! 
It's been running fine at FlashNet for sometime now, so I don't 
anticipate any trouble. :)

Nate Shockey
<underdog@flash.net>
--------------C7022435F3BE234DDB0479B5
Content-Type: text/plain; charset=us-ascii; name="spwdpatch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="spwdpatch"

*** article.c	Thu Dec 18 12:58:52 1997
--- article.c.ORIG	Mon Dec  8 17:48:50 1997
***************
*** 427,434 ****
      register BOOL	ok;
      ARTNUM		art;
  
-     setuid(NEWS_UID);
- 
      /* Find what to send; get permissions. */
      ok = PERMcanread;
      switch (*av[0]) {
--- 427,432 ----
***************
*** 997,1004 ****
      char		buff[SPOOLNAMEBUFF];
      ARTNUM		art;
  
-     setuid(NEWS_UID);
- 
      if (!PERMcanread) {
  	Reply("%s\r\n", NOACCESS);
  	return;
--- 995,1000 ----
***************
*** 1077,1084 ****
      ARTRANGE		range;
      char		buff[SPOOLNAMEBUFF];
  
-     setuid(NEWS_UID);
- 
      if (!PERMcanread) {
  	Printf("%s\r\n", NOACCESS);
  	return;
--- 1073,1078 ----
*** commands.c	Thu Dec 18 12:58:46 1997
--- commands.c.ORIG	Mon Dec  8 17:48:50 1997
***************
*** 276,283 ****
      TIMEINFO	t;
      struct tm	*gmt;
  
-     setuid(NEWS_UID);
- 
      if (GetTimeInfo(&t) < 0 || (gmt = gmtime(&t.time)) == NULL) {
  	Reply("%d Can't get time, %s\r\n", NNTP_TEMPERR_VAL, strerror(errno));
  	return;
--- 276,281 ----
***************
*** 306,313 ****
      char		*wildarg = NULL;
      char		savec;
  
-     setuid(NEWS_UID);
- 
      p = av[1];
      if (p == NULL || caseEQ(p, "active")) {
  	static time_t	last_time;
--- 304,309 ----
***************
*** 461,468 ****
      long		date;
      char		*grplist[2];
  
-     setuid(NEWS_UID);
- 
      /* Parse the date. */
      date = NNTPtoGMT(av[1], av[2]);
      if (date < 0) {
--- 457,462 ----
***************
*** 562,569 ****
      STRING		response;
      char		idbuff[SMBUF];
  
-     setuid(NEWS_UID);
- 
      if (!PERMcanpost) {
  	syslog(L_NOTICE, "%s noperm post without permission", ClientHost);
  	Reply("%s\r\n", NNTP_CANTPOST);
--- 556,561 ----
***************
*** 672,679 ****
  {
      char	*p;
  
-     setuid(NEWS_UID);
- 
      if ((p = HISgetent(av[1], TRUE)) == NULL)
  	Reply("%d Don't have it\r\n", NNTP_DONTHAVEIT_VAL);
      else
--- 664,669 ----
*** nnrpd.c	Thu Dec 18 13:01:50 1997
--- nnrpd.c.ORIG	Mon Dec  8 17:48:50 1997
***************
*** 11,17 ****
  #define MAINLINE
  #include "nnrpd.h"
  #include <netdb.h>
! #include <shadow.h>
  #if	defined(HPUX)
  #include <sys/pstat.h>
  #endif	/* defined(HPUX) */
--- 11,17 ----
  #define MAINLINE
  #include "nnrpd.h"
  #include <netdb.h>
! #include <pwd.h>
  #if	defined(HPUX)
  #include <sys/pstat.h>
  #endif	/* defined(HPUX) */
***************
*** 315,321 ****
      register char	*p;
      register BOOL	found;
      register int	i;
!     struct   spwd 	*swd;
      char		buff[BIG_BUFFER];
      char		*fields[5];
  
--- 315,321 ----
      register char	*p;
      register BOOL	found;
      register int	i;
!     struct passwd	*pwd;
      char		buff[BIG_BUFFER];
      char		*fields[5];
  
***************
*** 354,362 ****
  
  	/* See if we should lookup a specific user in the passwd file */
  	if (user && pass && EQ(fields[2], "+")) {
! 	    if ((swd = getspnam(user)) == NULL)
  		continue;
! 	    if (!EQ(swd->sp_pwdp, crypt(pass, swd->sp_pwdp)))
  		continue;
  	}
  	/* Matching for a specific user or just the host? */
--- 354,362 ----
  
  	/* 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;
  	}
  	/* Matching for a specific user or just the host? */
*** nnrpd.h	Thu Dec 18 12:58:38 1997
--- nnrpd.h.ORIG	Mon Dec  8 17:48:50 1997
***************
*** 34,44 ****
  #define ART_LINE_LENGTH		1000
  #define ART_LINE_MALLOC		1024
  
- /*
- ** Define this as the uid of user 'news'.
- ** INN-Solaris/shadow patch.
- */
- #define NEWS_UID		104
  
  /*
  **  Some convenient shorthands.
--- 34,39 ----

--------------C7022435F3BE234DDB0479B5--


Re: INN Shadow password patch...
#24462
Author: Chris Bellomy
Date: Thu, 18 Dec 1997 00:00
22 lines
1215 bytes
Nate Shockey <underdog@flash.net> wrote:

> INN-1.7.2 shadow password file patch for Solaris...

<snip>

>         Here's where a little explanation is necessary.
> In order to read the shadow file, you have to be root, right?

Not necessarily.  One could set /etc/shadow to 440, with user
news in the group with read access -- or one could just make
news the owner of /etc/shadow.  I don't really recommend either
approach, though.  Maybe others can shed some different light
on the subject.

-- 
Chris Bellomy				FlashNet Communications
VP of System Operations 		Fort Worth, Texas
cbellomy@flash.net			(817)332-8883

Re: INN Shadow password patch...
#24484
Author: Mike Wilson
Date: Fri, 19 Dec 1997 00:00
33 lines
1924 bytes
bill davidsen wrote:
> 
> | Not necessarily.  One could set /etc/shadow to 440, with user
> | news in the group with read access -- or one could just make
> | news the owner of /etc/shadow.  I don't really recommend either
> | approach, though.  Maybe others can shed some different light
> | on the subject.
> 
> As little as I like this idea, I surely like the idea of running as
> root a LOT less. With news allowed to read shadow I have a problem
> if someone gets in as news. With nnrpd running as root if someone
> gets in they get the store.
> 
> What's needed is a system call which takes the uid and the possible
> password and returns go/nogo. Absent that, I think a daemon like the
> actived would be useful, tiny program running as root, doing the
> test.


For now, to save me from hacking, I've simply placed the users crypted
password into the old SUNOS password field and it works. This might be
something others of you might with to do for "just" those users that
need it. This keeps ya from altering the shadow permissions or running
as root. Hopefully they will come up with something better in 1.8+

-- 

---
Mike Wilson
No Howard, No Eagle! - Spread the word.

Re: INN Shadow password patch...
#24488
Author: bill davidsen
Date: Fri, 19 Dec 1997 00:00
34 lines
1939 bytes
In article <67c10s$3fc$1@excalibur.flash.net>,
Chris Bellomy  <cbellomy@excalibur.flash.net> wrote:
| Nate Shockey <underdog@flash.net> wrote:
| 
| > INN-1.7.2 shadow password file patch for Solaris...
| 
| <snip>
| 
| >         Here's where a little explanation is necessary.
| > In order to read the shadow file, you have to be root, right?
| 
| Not necessarily.  One could set /etc/shadow to 440, with user
| news in the group with read access -- or one could just make
| news the owner of /etc/shadow.  I don't really recommend either
| approach, though.  Maybe others can shed some different light
| on the subject.

As little as I like this idea, I surely like the idea of running as
root a LOT less. With news allowed to read shadow I have a problem
if someone gets in as news. With nnrpd running as root if someone
gets in they get the store.

What's needed is a system call which takes the uid and the possible
password and returns go/nogo. Absent that, I think a daemon like the
actived would be useful, tiny program running as root, doing the
test.
--
bill davidsen (davidsen@tmr.com)
  "The action you see on fishing programs is something like the women
in _Playboy_. Not actually *fake*, but not remotely typical of the
average person's experience."  -me

Re: INN Shadow password patch...
#24509
Author: Matus Uhlar
Date: Fri, 19 Dec 1997 00:00
19 lines
1489 bytes
Chris Bellomy <cbellomy@excalibur.flash.net> wrote:
->>         Here's where a little explanation is necessary.
->> In order to read the shadow file, you have to be root, right?

-> Not necessarily.  One could set /etc/shadow to 440, with user
-> news in the group with read access -- or one could just make
-> news the owner of /etc/shadow.  I don't really recommend either
-> approach, though.  Maybe others can shed some different light
-> on the subject.

that can be big security risk. The best would be calling external not-buggy
passwd checkker which is setuid to root...
-- 
 Matus "fantomas" Uhlar, network manager at faculty of civil engineering
 of Technical University in Kosice, Slovakia
 E-mail: Matus.Uhlar@tuke.sk ; WWW: http://ccsun.tuke.sk/users/uhlar

Re: INN Shadow password patch...
#24537
Author: Robert Bannocks
Date: Mon, 22 Dec 1997 00:00
47 lines
2633 bytes
Chris Bellomy <cbellomy@excalibur.flash.net> wrote:
: Nate Shockey <underdog@flash.net> wrote:

: > INN-1.7.2 shadow password file patch for Solaris...

: <snip>

: >         Here's where a little explanation is necessary.
: > In order to read the shadow file, you have to be root, right?

: Not necessarily.  One could set /etc/shadow to 440, with user
: news in the group with read access -- or one could just make
: news the owner of /etc/shadow.  I don't really recommend either
: approach, though.  Maybe others can shed some different light
: on the subject.


Setting the shadow file's permissions may not work, if your
users can loggin to the system and change their password
then the passwd program will recreate the default shadow
file permissions no matter what you set the current shadow
file permissions (default= -r--------).

One creative way to do this kind of password checking would be
to follow that taken in the cyrus imap server and have a little
deamon that binds to a UNIX domain socket (to which access is controled
by file system permissions) that nnrpd contacts and uses to valiadte users
that way nnrpd does not have to run as root.  The password checking
deamon could potencially be modified to guard against sustained password
guessing atacks which the current patch does not do.  It also does not
check password expiry and account expiry either.  

It is a pitty that little of this aspect of nntpd has changed with the
recent releases of INN.  There are several developments in the are of
user validation that need addressing, e.g. PAM and ldap and no one seems
intrested in doing this work, although admitidly this is quite
difficult work given the complexity to be surmounted.

Another slightly of the of the discussion point is that there are no facilities in the
NNTP protocol to acheive password changing and no mention of this in the 
recently published draft NNTP-ng spec.

rob


Re: INN Shadow password patch...
#24542
Author: Nate Shockey
Date: Mon, 22 Dec 1997 00:00
22 lines
1630 bytes
Robert Bannocks wrote:

> 
> One creative way to do this kind of password checking would be
> to follow that taken in the cyrus imap server and have a little
> deamon that binds to a UNIX domain socket (to which access is controled
> by file system permissions) that nnrpd contacts and uses to valiadte users
> that way nnrpd does not have to run as root.  The password checking
> deamon could potencially be modified to guard against sustained password
> guessing atacks which the current patch does not do.  It also does not
> check password expiry and account expiry either.

	Actually, I've already got the Daemon and the patch written... I'm
going to be releasing it later this week, after I've made sure it
works on FlashNet's servers in production. ;)
 
____ _______					__________________
Nate Shockey					underdog@flash.net	
News Administrator				FlashNet Communications

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