Hijack chroot for http?

Posted by: foxtrot_xray

Hijack chroot for http? - 26/06/2002 15:09

Just cursious, is there a chroot option for the webserver in Hijack?
I serached the boards and the faq, didn't see anything. Personally, having all the image and file directories in root are messy (I'm a clean kinda guy), and would like to put them in, say, /usr/html or something..
I COULD: 1. Live with it. 2. Change all the links in that cool-arse XML package, 3. Edit the kernel and check/make it for myself. However, 1: I will live with it, if there's no chroot option, 2. Too much trouble, too many links. 3. Wouldn't touch it. I know basic C, and would probalby be just lucky to make it work, but then blow up something. Literally.

Thanks!
Me.
Posted by: pgrzelak

Re: Hijack chroot for http? - 26/06/2002 17:22

Greetings!

You could symlink an index.html to your chroot directory, and turn off the ability to go up the directory structure (I think that is a hijack option).
Posted by: foxtrot_xray

Re: Hijack chroot for http? - 27/06/2002 15:38

Tried - (well, with the symlink..) Since all the links in the HTML/XML are relative, it still lookf for the images in /image, etc..
Unless, of course, I'm getting my link types confused..

Me.
Posted by: Aragon

Re: Hijack chroot for http? - 28/06/2002 06:22

Hi,

I made some changes to CharcoalGray99 a while ago. Please see this thread for more info.


Regards,
Aragon
Posted by: mlord

Re: Hijack chroot for http? - 28/06/2002 10:26

There is ONE reason why Hijack httpd does NOT do a chroot: It would lose access to half of the music directories on a two-drive empeg.

Solve that, and I'll give you your chroot.

Cheers
Posted by: jane

Re: Hijack chroot for http? - 30/06/2002 03:40

Since the music partitions are mounted read-only, is there any particular reason why they can't be mounted twice in two different locations?
For instance create a /httpd/ and then mount drive0 and drive1 under that dir and chroot to it?

What happens if these /httpd/driveX in stead of being mounts of the drive partitions are hard-links to the directiories where the drives are originally mounted?

Marius (Escort Cab + Mark II)
Posted by: wfaulk

Re: Hijack chroot for http? - 01/07/2002 00:35

You can't hard link directories and a symlink won't work.

The only way I know to make it work is to open the files and directories you'd need before the chroot(). It might be enough to just have the directory open, as dirent structs actually contain inode information, which ought to be directly accessible somehow. I just don't know how.

Of course, that assumes that readdir() works in more-or-less the same way in kernelspace.
Posted by: anti

Re: Hijack chroot for http? - 01/07/2002 02:03

A hardlink won't work,

but a mount --bind /drive0 /httpd/drive0 could do the trick.

(Sorry, no empeg at hand to test it.)
Posted by: mlord

Re: Hijack chroot for http? - 01/07/2002 07:03

Linux does not permit multiple links ("hard links") to directories, so that idea just plain won't work.

Multiple mount points could work, but it would likely lead to all kinds of confusion when uploading new files/music, since each mount would be maintaining its own individual in-memory directory tree information.. And all of this would consume more memory, leaving less for the player software.

Cheers
Posted by: jane

Re: Hijack chroot for http? - 01/07/2002 07:17

Well, *surely*, the problem with several different memory copies of the directories can be solved by "somebody" ;-)

Marius (Escort Cab + Mark II)