Unix Technical Forum

Fun with chroot

This is a discussion on Fun with chroot within the Sun Solaris Administration forums, part of the Solaris Operating System category; --> I have SunPCi II set up on a Solaris 8 system, with a dedicated resticted user called "pc" that ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > Sun Solaris Administration

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-16-2008, 07:37 AM
Limpbar
 
Posts: n/a
Default Fun with chroot

I have SunPCi II set up on a Solaris 8 system, with a dedicated resticted
user called "pc" that can be used to launch an SunPCi instance. The user
is assigned the restricted Korn shell and has access only to the "ls" and
"sunpci" commands (via symbolic links in the user home directory).
Additionally, most of the user's files are owned by root with permission
600, and ACLs permit the user to read and/or write to them. The result
is a user environment that is accessible only to root and user "pc", but
wherein "pc" is severely restricted.

Problem: When the SunPCi instance is launched, an F: drive permits the
user to browse the file system at will. The restrictions imposed by rksh
are lifted.

Proposed solution: Arrange things so that when the "pc" user runs his
SunPCi instance, it executes in a chroot jail with the user's home
directory as the filesystem root. The chroot jail will contain only the
files that SunPCi II requires to execute properly.

Progress so far: Copied SUNWspci2 from /opt to /home/pc. Created
/home/pc/dev and /home/pc/devices and used mknod to create the same
devices and symlinks that are created when the package is installed.
Created /home/pc/etc and created passwd and shadow files (containing
entries for just root and pc) and a group file and a shells file (with
just /usr/bin/rksh). Created /home/pc/usr/bin with rksh in it. Used ldd
to find all the libraries needed by rksh, and copied them to a mirror
image file structure under /home/pc.

....And it still doesn't work. I get "chroot: No such file or directory"
when I try to start a jailed SunPCi instance. Anybody got any
suggestions?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-16-2008, 07:38 AM
stremler@rohan.sdsu.edu
 
Posts: n/a
Default Re: Fun with chroot

In comp.sys.sun.admin Limpbar <soft@bar.of.clay> wrote:
[snip]
> ...And it still doesn't work. I get "chroot: No such file or directory"
> when I try to start a jailed SunPCi instance. Anybody got any
> suggestions?


Can you chroot from a shell to poke around the new chroot jail?

I duplicated your error by running "chroot `pwd` /sbin/sh" in an
empty directory. Making an sbin and copying in /sbin/sh resolved
the problem.

Perhaps you need sh installed as well?

--
Stewart Stremler stremler@rohan.sdsu.edu
------------------------------------------------------------------------------
"I don't have much understanding" - Charles Herbig, 1995
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-16-2008, 07:38 AM
Limpbar
 
Posts: n/a
Default Re: Fun with chroot

In article <cdmg0c$4ic$1@gondor.sdsu.edu>, stremler@rohan.sdsu.edu
says...
> In comp.sys.sun.admin Limpbar <soft@bar.of.clay> wrote:
> [snip]
> > ...And it still doesn't work. I get "chroot: No such file or directory"
> > when I try to start a jailed SunPCi instance. Anybody got any
> > suggestions?

>
> Can you chroot from a shell to poke around the new chroot jail?
>
> I duplicated your error by running "chroot `pwd` /sbin/sh" in an
> empty directory. Making an sbin and copying in /sbin/sh resolved
> the problem.
>
> Perhaps you need sh installed as well?


Ah, yes. I was missing that and (as it turns out) a fairly large number
of other necessary files.

I had to go through all the SUNWspci2 scripts and find all the
binary files that they referenced, plus all the libraries and devices.
Then I had to find all the libraries for the SUNWspci2 binaries. Then I
had to truss a SunPCi instance and scan the output for all the config
files, device files, and any libraries that ldd didn't tell me about.
(Yes, ldd misses a few.) It took me about three hours to find and re-
create everything in the chroot directory. What a pain in the butt! No
wonder chroot isn't used all that often.

But the "pc" user running a SunPCi instance is now 'owned' as they say.
So much for browsing the whole system with the R: drive. (I mistakenly
said it was the F: drive, yesterday. The F: drive is the SUNWspci2
installation directory; the R: drive is the system root directory.)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:18 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com