LiteSpeed chroot setup

zoom

Well-Known Member
#1
During the installation of the pro version I requested "chroot" to be setup. The installation requests the path of the chroot'd environment to be absolute and it must include the server install path as well. I've setup a chroot directory /chroot with /opt/lsws under it as well. However, when I enter my absolute path of /chroot it keeps prompting me again and again. I didn't see anything in the documentation about chroot setup for LiteSpeed, could someone give me some guidance?? please???

Thanks in advance.
 

mistwang

LiteSpeed Staff
#2
The LSWS must be installed and run inside the chroot jail. I guess you should do as follow:

# mkdir -p /chroot/opt/lsws

# ./install.sh

....

server root: /chroot/opt/lsws
chroot path: /chroot
 

zoom

Well-Known Member
#3
Thanks mistwang,
I was able to get it installed correctly into the chroot'd directory. Having some problems getting it to execute the lsphp fastcgi binary. I checked to see what shared libs it might be using and put those into the chroot'd area as well, still no luck. Does it require some additional libs???


ldd lsphp reports the following libs are needed by lsphp.

libcrypt.so.1 => /lib/libcrypt.so.1 (0x40026000)
libresolv.so.2 => /lib/libresolv.so.2 (0x40053000)
libm.so.6 => /lib/tls/libm.so.6 (0x40065000)
libdl.so.2 => /lib/libdl.so.2 (0x40088000)
libnsl.so.1 => /lib/libnsl.so.1 (0x4008c000)
libc.so.6 => /lib/tls/libc.so.6 (0x42000000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
Error in the stderr.log:

Code:
lsphp: error while loading shared libraries: libresolv.so.2: cannot open shared object file: No such file or directory
 

mistwang

LiteSpeed Staff
#4
please run "lsws/admin/misc/chroot.sh /chroot/ /chroot/opt/lsws/fcgi-bin/lsphp", should fix the missing library for you. or you can do "cp /lib/libresolv.so.2 /chroot/lib/".
 

zoom

Well-Known Member
#5
That did the trick. PHP seems to work perfectly now in the chroot'd environment.

I do have one general question to ask though. If I wish to run in a chroot'd environment I assume that would require me to run any additional services within the chroot'd environment ie: MySQL, Perl, Python or Ruby correct??

Thanks again mistwang for all your help. Much Appreciated.
 

mistwang

LiteSpeed Staff
#6
You are welcome. :)

For Perl, Python or Ruby, you have to copy all related executable and binary into the jail,
For MySQL, you can run it either inside or outside the jail, you can point the MySQL server socket to a path inside the jail like /chroot/tmp/mysql.sock, for applications inside the jail, they can access mysql via socket /tmp/mysql.sock, or, just use the TCP server socket 127.0.0.1:3306.
 
Top