🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
13 messages
13 total messages Started by bill davidsen Thu, 14 Oct 1999 00:00
inndstart: setreuid(222, 0) failed: Not owner
#40840
Author: bill davidsen
Date: Thu, 14 Oct 1999 00:00
31 lines
1870 bytes
  I get this message when I try to run inndstart. Permissions appear to
be correct.

AIX 4.3.2, INN-2.3_10-05

id: uid=222(news) gid=200(news) groups=0(system),1(staff)

$ ls -l /usr/local/news/bin/innd*
-r-xr-x---   1 news     news     2256707 Oct 07 16:19  /usr/local/news/bin/innd
-r-xr-xr-x   1 news     news      570132 Oct 07 16:19  /usr/local/news/bin/inndf
-r-sr-x---   1 root     news      121470 Oct 07 16:19  /usr/local/news/bin/inndstart


  I know I've seen this before, but I can't remember if it was an AIX
bug or INN bug or some obscure permissions thing that 'make install'
didn't get right.

  I built 09-30 without this problem, but installed on another machine,
also freshly installed.

  Can someone refresh my memory if this is an old bug, or give me a clue
if not? Until I get an idea I don't want to just blindly try a new
version, this one has been working well on other operating systems.

-- 
bill davidsen <davidsen@tmr.com>  CTO, TMR Associates, Inc
  When taking small children to a carnival, always have them go potty
*before* you let them go on the rides, and let them eat all the junk
food and candy *after*.

Re: inndstart: setreuid(222, 0) failed: Not owner
#40865
Author: bill davidsen
Date: Fri, 15 Oct 1999 00:00
64 lines
3706 bytes
In article <ylaepltvlk.fsf@windlord.stanford.edu>,
Russ Allbery  <rra@stanford.edu> wrote:
| bill davidsen <davidsen@tmr.com> writes:
| 
| > I know I've seen this before, but I can't remember if it was an AIX bug
| > or INN bug or some obscure permissions thing that 'make install' didn't
| > get right.
| 
| As near as I can tell, it's something specific with AIX.
| 
| The call that's failing is this code:

  Yes, I looked for changes there. The 2.3_08-30 and 09-15 version are
running on AIX here without problems. So I am back to assuming that
there is either some subtle permissions issue here, or that the code has
been slightly changed. I know we used to have this problem and it went
away, back in 2.0 snapshots.

| The semantics that are supposed to work here are that you can become any
| user if your real *or* your effective UID is root (or your saved UID, but
| I don't actually use that).

  Right, you are supposed to be able to swap "who you are," and that's
been working.

| For some reason, this doesn't seem to work correctly on AIX.

  Well, at least in this case. Looking at the code in earlier 2.3, and
2.2 I see that the whole set_user thing is new, or at least not in
08-30, the last version I still have in unpacked form. I had 09-30
running but I have since taken that system down.

| For some reason, this doesn't seem to work correctly on AIX.  The initial
| dropping of permission works correctly, but then restoring root privs
| fails with the error that you're seeing.  I know it works fine on Solaris
| (tried it myself) and I'm pretty sure that it's been tested on FreeBSD,
| HP-UX, and Linux and works fine on all of those.

  Yes, I always try on Linux first, then AIX. I have no issues with and
of my (few) Solaris systems, so I will probably not ever upgrade beyond
1.7.1hacked which is there now.

| If anyone with more information about AIX in particular or the semantics
| of setreuid() in general could comment, I'd really appreciate it.  This
| isn't an area of strong expertise for me.

  Now that my memory is jogged, I believe that this came up in 2.0 and
the solution was to not use setreuid, since there are AIX issues. I
looked at the code, and I'm not sure why privs are being dropped and
regained in this way, given that we have done without before. However, I
guess I will report this to IBM as a bug, at least when linked with
-lbsd, since BSD seems to work as desired.

  If someone feels like a short note on why some of the setup is now
done as news instead of root I'd feel educated. I assume there was some
obscure bug or security issue on some non-AIX system.

-- 
bill davidsen <davidsen@tmr.com>  CTO, TMR Associates, Inc
  When taking small children to a carnival, always have them go potty
*before* you let them go on the rides, and let them eat all the junk
food and candy *after*.

Re: inndstart: setreuid(222, 0) failed: Not owner
#40907
Author: bill davidsen
Date: Mon, 18 Oct 1999 00:00
36 lines
2504 bytes
In article <yl3dvcp42d.fsf@windlord.stanford.edu>,
Russ Allbery  <rra@stanford.edu> wrote:
| bill davidsen <davidsen@tmr.com> writes:
| 
| > Now that my memory is jogged, I believe that this came up in 2.0 and the
| > solution was to not use setreuid, since there are AIX issues.
| 
| Okay.  I unfortunately wasn't around for that discussion.  :/  I'd really
| like to drop permissions when doing things like reading the configuration
| file, just in case there's a bug in any of that code.  The right approach
| may be to use an autoconf check and then unset HAVE_SETREUID on AIX.

  At least until AIX gets its act together. I regard this as a bug, at
least when it doesn't work with -lbsd, since the original setreuid()
call is from 4.2 (from memory).

| > If someone feels like a short note on why some of the setup is now done
| > as news instead of root I'd feel educated. I assume there was some
| > obscure bug or security issue on some non-AIX system.
| 
| No, it was just me being paranoid.  You can remove the set_user() calls
| and it should continue functioning fine.
| 
| I rewrote inndstart almost completely for INN 2.3 because I couldn't
| convince myself that the previous implementation was safe and I think I
| can convince myself that the current implementation is safe.

  And I thought you were just removing the last vestiges of actived ;-)

-- 
bill davidsen <davidsen@tmr.com>  CTO, TMR Associates, Inc
  When taking small children to a carnival, always have them go potty
*before* you let them go on the rides, and let them eat all the junk
food and candy *after*.

Re: inndstart: setreuid(222, 0) failed: Not owner
#40931
Author: Andrew Gierth
Date: Tue, 19 Oct 1999 00:00
17 lines
1566 bytes
>>>>> "bill" == bill davidsen <davidsen@tmr.com> writes:

 bill>   At least until AIX gets its act together. I regard this as a
 bill> bug, at least when it doesn't work with -lbsd, since the
 bill> original setreuid() call is from 4.2 (from memory).

I don't think I've ever come across a system which possessed an -lbsd
which didn't introduce all sorts of broken behaviour when that library
was included.

Besides, I thought recent versions of AIX had the Unix 98 branding?
setreuid() is in the spec for that.

-- 
Andrew.

Re: inndstart: setreuid(222, 0) failed: Not owner
#40942
Author: bill davidsen
Date: Tue, 19 Oct 1999 00:00
28 lines
2067 bytes
In article <87ogdvral7.fsf@erlenstar.demon.co.uk>,
Andrew Gierth  <andrew@erlenstar.demon.co.uk> wrote:
| >>>>> "bill" == bill davidsen <davidsen@tmr.com> writes:
| 
|  bill>   At least until AIX gets its act together. I regard this as a
|  bill> bug, at least when it doesn't work with -lbsd, since the
|  bill> original setreuid() call is from 4.2 (from memory).
| 
| I don't think I've ever come across a system which possessed an -lbsd
| which didn't introduce all sorts of broken behaviour when that library
| was included.
| 
| Besides, I thought recent versions of AIX had the Unix 98 branding?
| setreuid() is in the spec for that.

  I don't know what that spec says, but the BSD version works as INN
attempts to use it. If someone has the UNIX98 spec and can tell me if it
should work I'd be grateful. Or send me a man page, or whatever. If I
can quote a spec they claim to meet they can't tell me it works "right"
at least.

-- 
bill davidsen <davidsen@tmr.com>  CTO, TMR Associates, Inc
  When taking small children to a carnival, always have them go potty
*before* you let them go on the rides, and let them eat all the junk
food and candy *after*.

Re: inndstart: setreuid(222, 0) failed: Not owner
#40945
Author: Andrew Gierth
Date: Tue, 19 Oct 1999 00:00
29 lines
2243 bytes
>>>>> "bill" == bill davidsen <davidsen@tmr.com> writes:

 bill>   I don't know what that spec says, but the BSD version works
 bill> as INN attempts to use it. If someone has the UNIX98 spec and
 bill> can tell me if it should work I'd be grateful. Or send me a man
 bill> page, or whatever. If I can quote a spec they claim to meet
 bill> they can't tell me it works "right" at least.

The Unix 98 spec (which is downloadable from the opengroup website
somewhere, I think) says:

    The setreuid() function sets the real and effective user IDs of
    the current process to the values specified by the ruid and euid
    arguments. If ruid or euid is -1, the corresponding effective or
    real user ID of the current process is left unchanged.

    A process with appropriate privileges can set either ID to any
    value. An unprivileged process can only set the effective user ID
    if the euid argument is equal to either the real, effective, or
    saved user ID of the process.

    It is unspecified whether a process without appropriate privileges
    is permitted to change the real user ID to match the current real,
    effective or saved user ID of the process.

-- 
Andrew.

Re: inndstart: setreuid(222, 0) failed: Not owner
#40957
Author: Andrew Gierth
Date: Tue, 19 Oct 1999 00:00
33 lines
2072 bytes
>>>>> "Russ" == Russ Allbery <rra@stanford.edu> writes:

 Russ> The method that inndstart is using is what I understood to be
 Russ> the standard mechanism for dropping permissions temporarily.
 Russ> It calls setreuid(0, xxx) to set its real user ID to root (so
 Russ> that it will be able to regain permissions later) and its
 Russ> effective UID to the news user, basically swapping its real and
 Russ> effective UIDs.  It then does things that should be done
 Russ> unprivileged, with slightly more safety since the effective UID
 Russ> isn't root.  When it's done, it tries to swap the UIDs back
 Russ> with a call to setreuid(xxx, 0).

On systems with saved-ids (even ones like FreeBSD where
_POSIX_SAVED_IDS isn't defined) you should probably do something like

   setreuid(-1, news_user);

to become the news user (temporarily dropping permissions), and

   setreuid(-1, 0);

to switch back to root. (This works because your saved-set-uid is root,
so you're allowed to do this.)

If you have seteuid() available you should probably use that instead
of setreuid().

Messing with the real uid is the historical method.

-- 
Andrew.

Re: inndstart: setreuid(222, 0) failed: Not owner
#40971
Author: bill davidsen
Date: Wed, 20 Oct 1999 00:00
33 lines
2195 bytes
In article <ylln8zavsu.fsf@windlord.stanford.edu>,
Russ Allbery  <rra@stanford.edu> wrote:
| Andrew Gierth <andrew@erlenstar.demon.co.uk> writes:
| 
| > On systems with saved-ids (even ones like FreeBSD where _POSIX_SAVED_IDS
| > isn't defined) you should probably do something like
| 
| >    setreuid(-1, news_user);
| 
| > to become the news user (temporarily dropping permissions), and
| 
| >    setreuid(-1, 0);
| 
| > to switch back to root. (This works because your saved-set-uid is root,
| > so you're allowed to do this.)
| 
| I was thinking about that, but didn't understand saved IDs well enough.
| Okay.  How do I detect whether the system has saved IDs?  (Be convenient
| to be able to run configure checks as root for this sort of thing....)

  As noted elsewhere, I'm not positive what the value of ruid is on AIX
for a setuid program. The euid is definitely root, but ruid?? I want to
try setting ruid to root (probably sets euid), then euid to news, and
see if I can switch euid back to rootback. Before the exec I would set
everything the news.

-- 
bill davidsen <davidsen@tmr.com>  CTO, TMR Associates, Inc
  When taking small children to a carnival, always have them go potty
*before* you let them go on the rides, and let them eat all the junk
food and candy *after*.

Re: inndstart: setreuid(222, 0) failed: Not owner
#40992
Author: bill davidsen
Date: Wed, 20 Oct 1999 00:00
34 lines
2472 bytes
In article <876703mb00.fsf@erlenstar.demon.co.uk>,
Andrew Gierth  <andrew@erlenstar.demon.co.uk> wrote:

| The Unix 98 spec (which is downloadable from the opengroup website
| somewhere, I think) says:
| 
|     The setreuid() function sets the real and effective user IDs of
|     the current process to the values specified by the ruid and euid
|     arguments. If ruid or euid is -1, the corresponding effective or
|     real user ID of the current process is left unchanged.
| 
|     A process with appropriate privileges can set either ID to any
|     value. An unprivileged process can only set the effective user ID
|     if the euid argument is equal to either the real, effective, or
|     saved user ID of the process.
| 
|     It is unspecified whether a process without appropriate privileges
|     is permitted to change the real user ID to match the current real,
|     effective or saved user ID of the process.

  Hopefully "appropriate privileges" are defined somewhere. The
application of this to a program run by news, setuid root, is not
obvious after the euid is set to news. And I think on AIX setuid
programs would have ruid as news. I will continue to play with this, I
*think* I can set ruid to root, then euid to news, and still get back,
but I haven't had time to test since I did the initial bunch of tests.

-- 
bill davidsen <davidsen@tmr.com>  CTO, TMR Associates, Inc
  When taking small children to a carnival, always have them go potty
*before* you let them go on the rides, and let them eat all the junk
food and candy *after*.

Re: inndstart: setreuid(222, 0) failed: Not owner
#40994
Author: bill davidsen
Date: Wed, 20 Oct 1999 00:00
16 lines
1447 bytes
In article <7ukpid$4gt$1@newssvr02.news.prodigy.com>,
bill davidsen <davidsen@tmr.com> wrote:

|   As noted elsewhere, I'm not positive what the value of ruid is on AIX
| for a setuid program. The euid is definitely root, but ruid??

  Have checked since by rerunning my test prog, both ruid and euid are
root, that looks okay.

-- 
bill davidsen <davidsen@tmr.com>  CTO, TMR Associates, Inc
  When taking small children to a carnival, always have them go potty
*before* you let them go on the rides, and let them eat all the junk
food and candy *after*.

Re: inndstart: setreuid(222, 0) failed: Not owner
#41012
Author: Andrew Gierth
Date: Thu, 21 Oct 1999 00:00
20 lines
1548 bytes
>>>>> "bill" == bill davidsen <davidsen@tmr.com> writes:

 bill> | As noted elsewhere, I'm not positive what the value of ruid
 bill> | is on AIX for a setuid program. The euid is definitely root,
 bill> | but ruid??

 bill>   Have checked since by rerunning my test prog, both ruid and
 bill> euid are root, that looks okay.

Not even AIX is that perverse.

If you exec a setuid program:

  the real uid remains unchanged
  the effective and saved uids are set to the owner of the program.

-- 
Andrew.

Re: inndstart: setreuid(222, 0) failed: Not owner
#41075
Author: Andrew Gierth
Date: Sat, 23 Oct 1999 00:00
27 lines
1943 bytes
>>>>> "Russ" == Russ Allbery <rra@stanford.edu> writes:

 Russ> In the absence of a better idea at the moment, I'm committing
 Russ> changes right now that will use seteuid() if it's available to
 Russ> only change the effective UID, and if it isn't available, to
 Russ> fall back on setreuid() and swap the real and effective UIDs.
 Russ> Every system so far that I've seen that has a seteuid()
 Russ> function also supports POSIX saved UIDs, so that's a first pass
 Russ> at a portable solution.

 Russ> I considered using sysconf() to see if _POSIX_SAVED_IDS was
 Russ> set, but according to the above even that isn't reliable.  :/

How about:

  - use seteuid if available
    else if _POSIX_SAVED_IDS, then use setreuid(-1, euid)
    else swap the IDs

That should work on everything I've come across (though on some HP-UX
systems you may have to conjure up a seteuid or setreuid from the
system's setresuid() function).

-- 
Andrew.

Re: inndstart: setreuid(222, 0) failed: Not owner
#41088
Author: Andrew Gierth
Date: Sun, 24 Oct 1999 00:00
16 lines
1554 bytes
>>>>> "Russ" == Russ Allbery <rra@stanford.edu> writes:

 >> (though on some HP-UX systems you may have to conjure up a seteuid or
 >> setreuid from the system's setresuid() function).

 Russ> Isn't it good enough to just use setreuid(-1, ...) for them?

The last HP-UX system I had to deal with this issue on didn't have
setreuid at all AFAIR. That was 9.04, I don't recall whether 10.10 had
the same problem, and I haven't had occasion to use anything more
recent.

-- 
Andrew.

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