3

I'm running Ubuntu, with PHP5-FPM, mysql & Nginx

I've just setup a chrooted jail with jailkit. Now I need to work out how to setup my php and mysql to work within the jail.

Google search doesn't give me much, and there's no documentation for this on the jailkit website. (It may be easy but I'm fairly new to this field)

Emmanuel
  • 347
  • 1
  • 9
  • 20

2 Answers2

6

Here is a sample configuration section that you can put in /etc/jailkit/jk_init.ini so that future jail adds are seamless.

I used this section

[mysql-client]
comment = mysql client
executables = /usr/bin/mysql
paths = /usr/lib/libmysqlclient.so.16.0.0 , /usr/lib/libmysqlclient.so.16, /usr/lib/libstdc++.so.6,/usr/lib/libstdc++.so.6.0.13,/lib/libgcc_s.so.1

Seemed to work well, you may need to change some paths. jailkit MAY resolve the symlink paths on its own but i added both in case.

Two caveats

1) Users must use full mysql -h syntax (mysql -h basehostname database) since you do not have the mysql local sockets in the jail

2) Your mysql must be listening on the public interface so the jail can connect to it.

1

Figured it out anyhow!

Just find out where the php & mysql binaries reside (/user/bin or /user/sbin) and copy them to the relative chroot directory. Then when you run the php command from the chroot user you'll get an error saying such and such a libary is missing so then you've just got to find that libaray and copy it into the relative chroot directory and keep going like that until all the dependant libraries have been copied over.

Emmanuel
  • 347
  • 1
  • 9
  • 20