🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
11 messages
11 total messages Started by Andrew Raines Fri, 27 May 2005 18:57
inndstart under daemontools's supervise(8)
#71710
Author: Andrew Raines
Date: Fri, 27 May 2005 18:57
46 lines
2498 bytes
My INN installation works fine, but I'd like to get inndstart
under supervise(8) like nnrpd.  Here's my run script:

    #!/bin/sh
    exec 2>&1
    envdir ./env sh -c '
       exec softlimit -m "${MEM}" \
       setuidgid news \
       /usr/local/news/bin/inndstart -P"${PORT}" -f -r
    '

After running ./run by hand as root, I see this in news.crit:

    inndstart: can't seteuid to 0: Operation not permitted
    innd: OVDB: can not open database unless ovdb_monitor is running.
    innd: OVDB: ovdb_getlock failed: No such file or directory
    innd: SERVER cant open overview method

inndstart has the correct permissions:

    $ ls -l ~news/bin/inndstart
    -r-sr-x---  1 root news 188206 Apr 18 10:53 /usr/local/news/bin/inndstart

The manpage for inndstart states:

    can't seteuid to %d: %s
        (Fatal) Unable to change the effective UID.  If
        inndstart has the correct permissions (setuid root)
        and seteuid to root (UID 0) is failing, this may mean
        that your system has seteuid(2) but doesn't have
        support for POSIX saved UIDs.  If this is the case,
        please report this to the INN maintainers.

However, I'm running Debian Sid with a 2.4.27 kernel -- that
has to be one of the most common platforms for running INN.
It must be something I'm doing wrong in the
daemontoolsilization.  Any ideas?

Here's a full strace of the `sudo ./run':

    <URL: http://paste.lisp.org/display/8633>

Thanks.

-- 
    aa@raines.ws (Andrew A. Raines)
Re: inndstart under daemontools's supervise(8)
#71713
Author: Russ Allbery
Date: Fri, 27 May 2005 23:07
21 lines
1831 bytes
Andrew Raines <aa@raines.ws> writes:

> After running ./run by hand as root, I see this in news.crit:

>     inndstart: can't seteuid to 0: Operation not permitted
>     innd: OVDB: can not open database unless ovdb_monitor is running.
>     innd: OVDB: ovdb_getlock failed: No such file or directory
>     innd: SERVER cant open overview method

> inndstart has the correct permissions:

>     $ ls -l ~news/bin/inndstart
>     -r-sr-x---  1 root news 188206 Apr 18 10:53 /usr/local/news/bin/inndstart

Usually that means that the partition is mounted nosuid.

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

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: inndstart under daemontools's supervise(8)
#71714
Author: Andrew Raines
Date: Fri, 27 May 2005 23:55
25 lines
1758 bytes
Russ Allbery <rra@stanford.edu> writes:

> Andrew Raines <aa@raines.ws> writes:
>
>> After running ./run by hand as root, I see this in news.crit:
>
>>     inndstart: can't seteuid to 0: Operation not permitted
>>     innd: OVDB: can not open database unless ovdb_monitor is running.
>>     innd: OVDB: ovdb_getlock failed: No such file or directory
>>     innd: SERVER cant open overview method
>
>> inndstart has the correct permissions:
>
>>     $ ls -l ~news/bin/inndstart
>>     -r-sr-x---  1 root news 188206 Apr 18 10:53 /usr/local/news/bin/inndstart
>
> Usually that means that the partition is mounted nosuid.

I knew I left something out:

    $ mount | grep /usr
    /dev/hda4 on /usr type ext3 (rw)

-- 
    aa@raines.ws (Andrew A. Raines)
Re: inndstart under daemontools's supervise(8)
#71715
Author: Russ Allbery
Date: Sat, 28 May 2005 00:36
19 lines
1789 bytes
Andrew Raines <aa@raines.ws> writes:
> Russ Allbery <rra@stanford.edu> writes:

>> Usually that means that the partition is mounted nosuid.

> I knew I left something out:

>     $ mount | grep /usr
>     /dev/hda4 on /usr type ext3 (rw)

I really don't know then.  The error message that you're seeing indicates
that inndstart isn't running as root (given that you're on Linux and the
seteuid semantics work properly there).

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

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: inndstart under daemontools's supervise(8)
#71746
Author: Andrew Raines
Date: Wed, 01 Jun 2005 16:26
33 lines
2290 bytes
Russ Allbery <rra@stanford.edu> writes:

> I really don't know then.  The error message that you're
> seeing indicates that inndstart isn't running as root
> (given that you're on Linux and the seteuid semantics
> work properly there).

This doesn't make any sense.  rc.news runs inndstart via

   eval ${WHAT} ${RFLAG} ${INNFLAGS}

and nobody complains.  If I run inndstart from the command
line, I get an EPERM setgroups().  Furthermore, adding a
geteuid() call to inndstart.c, I see that the setuid root
isn't even working:

   getuid32()                              = 9
   geteuid32()                             = 9
   setgroups32(1, [9])                     = -1 EPERM (Operation not permitted)
   write(2, "inndstart: ", 11inndstart: )             = 11
   write(2, "can\'t setgroups (is inndstart se"..., 43can't setgroups \
              (is inndstart setuid root?)) = 43

Again, inndstart is 4550:

   $ ls -ld ~/bin/inndstart
   -r-sr-x---  1 root news 188325 Jun  1 11:17 /usr/local/news/bin/inndstart
   
I must be missing something obvious.  What does rc.news do
that I can't do interactively?

-- 
    aa@raines.ws (Andrew A. Raines)
Re: inndstart under daemontools's supervise(8)
#71747
Author: Russ Allbery
Date: Wed, 01 Jun 2005 18:05
37 lines
2653 bytes
Andrew Raines <aa@raines.ws> writes:

> This doesn't make any sense.  rc.news runs inndstart via

>    eval ${WHAT} ${RFLAG} ${INNFLAGS}

> and nobody complains.  If I run inndstart from the command
> line, I get an EPERM setgroups().  Furthermore, adding a
> geteuid() call to inndstart.c, I see that the setuid root
> isn't even working:

>    getuid32()                              = 9
>    geteuid32()                             = 9
>    setgroups32(1, [9])                     = -1 EPERM (Operation not permitted)
>    write(2, "inndstart: ", 11inndstart: )             = 11
>    write(2, "can\'t setgroups (is inndstart se"..., 43can't setgroups \
>               (is inndstart setuid root?)) = 43

Yeah, that's what I thought from what you were describing.

> Again, inndstart is 4550:

>    $ ls -ld ~/bin/inndstart
>    -r-sr-x---  1 root news 188325 Jun  1 11:17 /usr/local/news/bin/inndstart
   
> I must be missing something obvious.  What does rc.news do
> that I can't do interactively?

Are you running it as the news user in both cases?  Is there some sort of
security configuration that is inherited by login accounts that doesn't
allow setuid to work?  (Some kind of capabilities system, perhaps?)

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

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: inndstart under daemontools's supervise(8)
#71748
Author: Andrew Raines
Date: Wed, 01 Jun 2005 18:58
28 lines
2118 bytes
Russ Allbery <rra@stanford.edu> writes:

> Andrew Raines <aa@raines.ws> writes:
>> I must be missing something obvious.  What does rc.news
>> do that I can't do interactively?
>
> Are you running it as the news user in both cases?

Yes.

> Is there some sort of security configuration that is
> inherited by login accounts that doesn't allow setuid to
> work?  (Some kind of capabilities system, perhaps?)

I don't think so.  It's a fairly stock Debian Sid install.
If it was a restrictive login class, I would expect
setuidgid to be immune.  It suffers from the same symptoms
though -- inndstart run by anything other than rc.news
doesn't have an EUID of 0.

I suppose I can live without supervise-ing innd.  It
doesn't seem to ever die that I've noticed in my short
tenure of maintaining a 2.1.0 university-wide installation.
I just wanted the extra assurance with my shiny new 2.4.2
roll-out.

-- 
    aa@raines.ws (Andrew A. Raines)
Re: inndstart under daemontools's supervise(8)
#71749
Author: Russ Allbery
Date: Wed, 01 Jun 2005 19:16
25 lines
2268 bytes
Andrew Raines <aa@raines.ws> writes:

> I don't think so.  It's a fairly stock Debian Sid install.  If it was a
> restrictive login class, I would expect setuidgid to be immune.  It
> suffers from the same symptoms though -- inndstart run by anything other
> than rc.news doesn't have an EUID of 0.

I'm mystified on this one.  I've even tested this on Debian sarge
specifically and not run into any problems.

> I suppose I can live without supervise-ing innd.  It doesn't seem to
> ever die that I've noticed in my short tenure of maintaining a 2.1.0
> university-wide installation.  I just wanted the extra assurance with my
> shiny new 2.4.2 roll-out.

It rarely dies, although I've had it die under unusual circumstances.
Note that innwatch will let you know as soon as it dies, with a standard
configuration, although restarting it with supervise would be even nicer.

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

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: inndstart under daemontools's supervise(8)
#71750
Author: Miquel van Smoorenburg
Date: Wed, 01 Jun 2005 19:58
29 lines
2345 bytes
In article <ufyw2niw6.fsf@raines.ws>, Andrew Raines  <aa@raines.ws> wrote:
>Russ Allbery <rra@stanford.edu> writes:
>
>> I really don't know then.  The error message that you're
>> seeing indicates that inndstart isn't running as root
>> (given that you're on Linux and the seteuid semantics
>> work properly there).
>
>This doesn't make any sense.  rc.news runs inndstart via
>
>   eval ${WHAT} ${RFLAG} ${INNFLAGS}
>
>and nobody complains.  If I run inndstart from the command
>line, I get an EPERM setgroups().  Furthermore, adding a
>geteuid() call to inndstart.c, I see that the setuid root
>isn't even working:
>
>   getuid32()                              = 9
>   geteuid32()                             = 9
>   setgroups32(1, [9])                     = -1 EPERM (Operation not permitted)
>   write(2, "inndstart: ", 11inndstart: )             = 11
>   write(2, "can\'t setgroups (is inndstart se"..., 43can't setgroups \
>              (is inndstart setuid root?)) = 43

Note that when you use strace, the setuid bit doesn't work for
security reasons. If you want to strace a setuid root binary,
run it as root, not as some other user.

Mike.
Re: inndstart under daemontools's supervise(8)
#71753
Author: Andrew Raines
Date: Wed, 01 Jun 2005 21:23
22 lines
1959 bytes
"Miquel van Smoorenburg" <miquels@netscum.invalid> writes:

> Note that when you use strace, the setuid bit doesn't
> work for security reasons. If you want to strace a setuid
> root binary, run it as root, not as some other user.

I was running strace as root, however, when setuidgid forks
it changes the UID to the news user.  So, when inndstart
starts its UID is 9, but it's being monitored by a parent
process of 0.  That would explain why in news.crit I'm only
seeing the ``can't seteuid'' error when I strace.

When I run without strace, I get errors about OVDB.  My run
script doesn't mess with ovdb_monitor which is apparently a
problem.  I changed ovmethod to tradindexed, rebuilt the
history, and now it works.  I had to remove the envdir I
was using too.

Thanks Mike!

-- 
    aa@raines.ws (Andrew A. Raines)
Re: inndstart under daemontools's supervise(8)
#71752
Author: Andrew Raines
Date: Wed, 01 Jun 2005 22:04
10 lines
1443 bytes
Andrew Raines <aa@raines.ws> writes:

> I changed ovmethod to tradindexed, rebuilt the history,
> and now it works.

Except now nnrpd hangs when I try to POST.  I'll just use
rc.news.  It looks like INN really prefers it that way.

-- 
    aa@raines.ws (Andrew A. Raines)
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