Run Subsonic in Chroot Jail?

General discussions.

Moderator: moderators

Run Subsonic in Chroot Jail?

Postby dman777 » Thu May 05, 2011 11:42 am

For Linux...

Would it be possible to run Subsonic in a chroot jail? For example, if I make a /chroot/subsonic filesystem I would have to copy the java files and subsonic into the /chroot/subsonic.

What else would I need to copy into the chroot jail?

Would this mean the packets wouldn't be tranversed in the prexisting iptable rules?

Also, since my music collection is on /mnt/music I assume it wouldn't be accessable from the new root, right?
dman777
 
Posts: 19
Joined: Sat Mar 26, 2011 4:58 am

Postby martyscholes » Fri May 06, 2011 4:19 pm

For Linux...

Would it be possible to run Subsonic in a chroot jail? For example, if I make a /chroot/subsonic filesystem I would have to copy the java files and subsonic into the /chroot/subsonic.

I have only dabbled in jails, but you can run just about anything in a jail, as long as all of the needed files are in the subtree, either through mounts or hard links. Soft links will not work. The stuff you need includes all of the binaries (including shells, jre, etc.), libraries, config files and media.
What else would I need to copy into the chroot jail?

Try it and see. Watch the logs very closely to see what is missing. You would be surprised about all of the little things that are needed.

Would this mean the packets wouldn't be tranversed in the prexisting iptable rules?

My guess is that since the processes are running under the same kernel as everything else, then networking rules will apply to jails also. All that jails do is move the root of the filesystem to a different place, walling off everything else.
Also, since my music collection is on /mnt/music I assume it wouldn't be accessable from the new root, right?

As mentioned above, make sure the media is mounted in the jail subtree. Most of my recent experience is with Solaris where zones are used. My instance of subsonic runs at a reduced privilege level in the global zone. I keep toying with making a zone specifically for each site service. Subsonic is an obvious candidate.

I don't see many posts here about running subsonic on Unix / Linux. Try it and see. Let us know what happens.
martyscholes
 
Posts: 41
Joined: Fri May 06, 2011 3:36 pm

Postby dman777 » Sat May 07, 2011 4:28 pm

haveing problems.

from chrooted account:

Code: Select all
localhost / # chroot --userspec=subsonic /subsonic /bin/bash
bash-4.1$ ./subsonic
bash: ./subsonic: is a directory
bash-4.1$ ./subsonic.sh
Started Subsonic [PID 7681, /subsonic/subsonic_sh.log]
bash-4.1$ cat /subsonic/subsonic_sh.log
basename: missing operand
Try `basename --help' for more information.
* Home for VM '' does not exist:
* Invalid System VM:
bash-4.1$


localhost subsonic # lr
total 31M
-rw-r-xr-x 1 subsonic subsonic 35K Oct 8 2009 LICENSE.TXT
-rw-r-xr-x 1 subsonic subsonic 540 Jan 22 2010 README.TXT
-rw-r-xr-x 1 subsonic subsonic 3.0K Jan 7 06:27 Getting Started.html
-rw-r-xr-x 1 subsonic subsonic 1.1K Jan 12 11:10 subsonic.bat
-rw-r-xr-x 1 subsonic subsonic 18M Feb 6 01:40 subsonic.war
-rw-r-xr-x 1 subsonic subsonic 11M Feb 6 01:40 subsonic-booter-jar-with-dependencies.jar
drwxr-xr-x 3 subsonic subsonic 4.0K Mar 22 08:08 jetty
drwxr-xr-x 5 subsonic subsonic 4.0K Mar 22 08:08 lucene
drwxr-xr-x 2 subsonic subsonic 4.0K Mar 23 09:33 transcode
drwxr-xr-x 7 subsonic subsonic 4.0K Apr 18 15:35 thumbs
drwxr-xr-x 22 root root 4.0K May 4 09:00 ..
-rw-r-xr-x 1 subsonic subsonic 491 May 4 09:50 subsonic.properties
-rw-r-xr-x 1 subsonic subsonic 2.5M May 6 03:00 subsonic13.index
-rw-r-xr-x 1 subsonic subsonic 85K May 6 09:55 subsonic.log
drwxr-xr-x 2 subsonic subsonic 4.0K May 6 23:14 db
drwxr-xr-x 3 root root 4.0K May 7 10:32 usr
-rw------- 1 subsonic subsonic 117 May 7 10:51 .bash_history
drwxr-xr-x 2 root root 4.0K May 7 10:59 etc
drwxr-xr-x 14 root root 4.0K May 7 11:04 lib64
drwxr-xr-x 2 root root 4.0K May 7 11:10 dev
drwxr-xr-x 2 root root 4.0K May 7 11:22 bin
-rw-r--r-- 1 subsonic root 126 May 7 11:24 subsonic_sh.log
-rwxr-xr-x 1 subsonic subsonic 4.9K May 7 11:25 subsonic.sh
drwxr-xr-x 13 subsonic subsonic 4.0K May 7 11:25 .
drwxr-xr-x 2 subsonic root 4.0K May 7 11:26 subsonic
localhost subsonic # lr /usr/bin/
Display all 1552 possibilities? (y or n)
localhost subsonic # lr usr/bin/
total 12K
drwxr-xr-x 3 root root 4.0K May 7 10:32 ..
lrwxrwxrwx 1 root root 13 May 7 10:34 java -> run-java-tool
drwxr-xr-x 2 root root 4.0K May 7 10:34 .
-rwxr-xr-x 1 root root 1.5K May 7 10:34 run-java-tool
localhost subsonic #

[/code]
dman777
 
Posts: 19
Joined: Sat Mar 26, 2011 4:58 am

Postby martyscholes » Sat May 07, 2011 6:26 pm

Seems strange. Can you run any java programs by hand from the jail?
martyscholes
 
Posts: 41
Joined: Fri May 06, 2011 3:36 pm

Re: Run Subsonic in Chroot Jail?

Postby o1023509 » Wed Oct 03, 2012 9:51 pm

I've done it using the subsonic-4.7-standalone.tar.gz and jre-7u7-linux-i586.tar.gz (sun-java bin packages).

You're problem seems to be caused by java anyway, try out those and let me know if you have further problems.

If you want/need it, I can also give you the ls -laR of my jail or an archive with the whole stuff in it :)
o1023509
 
Posts: 1
Joined: Wed Oct 03, 2012 9:40 pm


Return to General

Who is online

Users browsing this forum: No registered users and 7 guests