linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: chroot() breaks syslog() ?
@ 2003-08-04  5:49 Steven Micallef
  2003-08-04  5:34 ` Ben Collins
  2003-08-04 13:33 ` Herbert Pötzl
  0 siblings, 2 replies; 13+ messages in thread
From: Steven Micallef @ 2003-08-04  5:49 UTC (permalink / raw)
  To: 'Ben Collins'; +Cc: 'linux-kernel@vger.kernel.org'

You're right - my mistake, it doesn't actually work on 2.4.8 either, I think
I was looking at the wrong thing when I thought it was actually working.

Is it worth considering (optionally) making /dev available to chroot()'ed
environments, or would that just defeat the whole purpose of chroot()?

Regards,

Steve.

> -----Original Message-----
> From: Ben Collins [mailto:bcollins@debian.org]
> Sent: Monday, 4 August 2003 3:19 PM
> To: Steven Micallef
> Cc: 'linux-kernel@vger.kernel.org'
> Subject: Re: chroot() breaks syslog() ?
> 
> 
> > connect(3, {sin_family=AF_UNIX, path="/dev/log"}, 16) = -1 
> ENOENT (No such
> > file or directory)
> > 
> > Is this intentional? If so, is there a work-around? I 
> discovered this when
> > debugging 'rwhod', but I imagine there are many more utils 
> that would be
> > affected too.
> 
> I don't know how it ever did work, if in fact it did for you. /dev/log
> is not a kernel device, it's just a normal socket created by syslogd.
> 
> Now, if you use devfs, and mount devfs under the chroot, it magically
> propogates /dev/log. But that's not the normal thing.
> 
> -- 
> Debian     - http://www.debian.org/
> Linux 1394 - http://www.linux1394.org/
> Subversion - http://subversion.tigris.org/
> WatchGuard - http://www.watchguard.com/
> __________ Information from NOD32 1.449 (20030630) __________
> 
> This message was checked by NOD32 for Exchange e-mail monitor.
> http://www.nod32.com
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread
* RE: chroot() breaks syslog() ?
@ 2003-08-06 13:34 Oliver Pitzeier
  0 siblings, 0 replies; 13+ messages in thread
From: Oliver Pitzeier @ 2003-08-06 13:34 UTC (permalink / raw)
  To: herbert; +Cc: Olaf Titz, linux-kernel

Herbert Pötzl <herbert@13thfloor.at> wrote:
[ ... ]
> hmm, how will you avoid creation of special (devicenodes)
> files if I have raw access to any partition? I can 'simply'
> use xxd to create my special inodes on the medium ...
> and I would not care if mount is enabled or not when I
> wipe the root partition with dd ...

AFAIK, there are possibilities to deny _RAW_ access to partitions, while in a chroot-jail... If not, I'll tell the grsec-team to implement a new feature. :)

Best regards,
 Oliver


^ permalink raw reply	[flat|nested] 13+ messages in thread
* RE: chroot() breaks syslog() ?
@ 2003-08-06  8:42 Oliver Pitzeier
  2003-08-06 11:08 ` Herbert Pötzl
  0 siblings, 1 reply; 13+ messages in thread
From: Oliver Pitzeier @ 2003-08-06  8:42 UTC (permalink / raw)
  To: 'Olaf Titz', linux-kernel, 'Herbert Potzl'

> > IMHO, devfs in chroot environment, is defeating the purpose 
> > because if you have access to raw devices, like the device
> > your chroot dir is on, 
> > you can easily mount that device again, and voila you have 
> > access to 
> > the full tree, if you
> 
> You need to be root to mount the device, and as root you can 
> also create the device special file. A chroot environment 
> does not reliably guard against root breaking out of it.

That's not completly wrong nor is it completly true. :)

You _CAN_ guard yourself from root's breaking out of some chroot environment.
Using grsec (www.grsecurity.net). Denying double-chroots, creation of special
files within chroot-environments and if you like it... Deny mounting within
chroot. :)

There are many options provided - just use 'em. :)

Best regards,
 Oliver


^ permalink raw reply	[flat|nested] 13+ messages in thread
* RE: chroot() breaks syslog() ?
@ 2003-08-04  7:30 Steven Micallef
  0 siblings, 0 replies; 13+ messages in thread
From: Steven Micallef @ 2003-08-04  7:30 UTC (permalink / raw)
  To: 'Torsten Foertsch', 'linux-kernel@vger.kernel.org'

> consider syslogd's -a option. Or simply call openlog(3) with 
> LOG_NDELAY before 
> chroot(). Or place the first call to syslog() before 
> chroot(). Syscall() does 
> not close the socket between calls.
> 
> int main(void) {
>   openlog( "klaus", LOG_NDELAY, LOG_NEWS);
>   chroot("/tmp");
>   printf( "before\n" ); fflush( stdout );
>   syslog(LOG_ALERT, "TEST1");
>   printf( "between\n" ); fflush( stdout );
>   syslog(LOG_ALERT, "TEST2");
> }

That works perfectly, thanks.

Regards,

Steve.

^ permalink raw reply	[flat|nested] 13+ messages in thread
* chroot() breaks syslog() ?
@ 2003-08-04  5:27 Steven Micallef
  2003-08-04  5:19 ` Ben Collins
  2003-08-04  7:23 ` Torsten Foertsch
  0 siblings, 2 replies; 13+ messages in thread
From: Steven Micallef @ 2003-08-04  5:27 UTC (permalink / raw)
  To: 'linux-kernel@vger.kernel.org'

Hi all,

I've stumbled onto what seems to have broken somewhere between 2.4.8 and
2.4.18 (sorry, I've been unable to test it on a later version just yet).
Basically, when using chroot(), syslog() calls don't work.

The following simple example is broken on 2.4.18:

#include    <stdio.h>
#include    <sys/syslog.h>

int main(void) {
    chroot("/home/steve");
    syslog(LOG_ALERT, "TEST");
}

An strace reveals the following:

connect(3, {sin_family=AF_UNIX, path="/dev/log"}, 16) = -1 ENOENT (No such
file or directory)

Is this intentional? If so, is there a work-around? I discovered this when
debugging 'rwhod', but I imagine there are many more utils that would be
affected too.

Cheers,

Steve Micallef

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-08-06 13:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-04  5:49 chroot() breaks syslog() ? Steven Micallef
2003-08-04  5:34 ` Ben Collins
2003-08-04  6:12   ` David Lang
2003-08-04  8:40   ` Wichert Akkerman
2003-08-04 13:33 ` Herbert Pötzl
2003-08-04 20:19   ` Olaf Titz
  -- strict thread matches above, loose matches on Subject: below --
2003-08-06 13:34 Oliver Pitzeier
2003-08-06  8:42 Oliver Pitzeier
2003-08-06 11:08 ` Herbert Pötzl
2003-08-04  7:30 Steven Micallef
2003-08-04  5:27 Steven Micallef
2003-08-04  5:19 ` Ben Collins
2003-08-04  7:23 ` Torsten Foertsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).