Search code examples
linuxapachetomcatubuntuchroot

Running server from inside Chroot in ubuntu


Due to the peculiar nature of the application, I'm thinking of running servers such as Apache, Tomcat from within a chroot environment. Using schroot and debootstrap, I'm able to create a clone of my 10.04 ubuntu(minimal ubuntu) inside chroot directory. I've install tomcat and apache inside chroot . But how do I access these two servers?

  1. Can I access them like a normal apache/tomcat installed on parent server?
  2. Can the parent OS access the apache/tomcat of chroot os?

First, which of these options is possible. Second, any caveats that I should handle with each of these options.

I want something like

 Internet ---> [Main host Ubuntu 10.04 Apache ----> (chroot ubuntu Tomcat)  ]

Solution

  • chrooting is one of the simplest forms of virtual machines. If your application is security-sensitive, you might consider running a more full-featured solution, such as OpenVZ, Xen, KVM, VirtualBox or commercial solutions, such as VMware and a few others.

    That being said, you should really consider to view your chrooted OS as just another host in your network. When you'll be using just chroot, you can access it as localhost (127.0.0.1) with some port number you'll assign to it (chrooted system will effectively share port assignations with parent system), while using other virtualization solutions allows you to assign a normal separate IP to each virtual machine and run it much as you would run a separate physical box.

    chrooting is fairly "weak" security solution, is parent and child share a lot of resources almost without limitations (i.e. memory, CPU, process pool, disc space, privileges, sockets, etc). They only limitation in fact is limited filesystem access (i.e. chrooted applications can access only a portion of whole file system), although it provides some degree of isolation.