Re: mutilog via fifo

richard lucassen <[email protected]> Sun, 3 Aug 2008 12:02:53 +0200
Newsgroups gmane.comp.djb.syslog
Organization XAQ Systems
Message-ID <[email protected]>
On Sun, 03 Aug 2008 11:32:14 +0930
Daryl Tester <[email protected]> wrote:

> (* Replyto set to avoid auto responders - *sigh* *)

Only two things are infinite, the universe and human stupidity, and I'm
not sure about the former. -- Albert Einstein

> > So, what's the difference between elhttp using "/dev/stdout" as
> > logfile and e.g. publicfile?
> 
> I honestly don't know.  I would have expected /dev/stdout and the real
> stdout to be similar (at least writing to the same file descriptor),
> *except* that they won't be sharing the same file table entry (unless
> open(2) is treating the "/dev/std*" entries differently than other
> files and reusing the entry).  It's something I need to sit and think
> about ...
>
> > Apparently publicfile sends its logs in a different way to stdout?
> 
> I'm not sure about publicfile (haven't used it), but most/all of
> djb's tools send their logging to stdout/stderr - it's your using
> of /dev/stdout that's different ... wait a sec.  You're using
> tcpserver - isn't stdout (as well as stdin) wired to the incoming
> tcp socket (particularly when elhttp gets around to opening it)?

Indeed it is. 0 and 1 are used by tcpserver:

For each connection, it runs prog, with descriptor 0 reading from the
network and descriptor 1 writing to the network.

> Don't you want to be using /dev/stderr?

I tried that, but this did not work. And as I agree that I should use
stderr, I did some other tests and I found why this did not work:

setuidgid qftp

I think the user qftp has no write access to stderr. But I definitly
want to run elhttp as an unpriviledged user.

Well, let's see how publicfile is invoked by tcpserver, publicfile is
called with "envuidgid qftp" (not setuidgid):

#!/bin/sh
exec 2>&1
exec envuidgid qftp softlimit -o20 -d50000 tcpserver -DRHl0 -b50 -c100 0
80 /usr/local/publicfile/bin/httpd /public/file

When publicfile is invoked by tcpserver, it runs as user qftp. When
elhttp is invoked by tcpserver this way, it runs as root.

Why is that?

R.

-- 
___________________________________________________________________
It is better to remain silent and be thought a fool, than to speak
aloud and remove all doubt.

+------------------------------------------------------------------+
| Richard Lucassen, Utrecht                                        |
| Public key and email address:                                    |
| http://www.lucassen.org/mail-pubkey.html                         |
+------------------------------------------------------------------+