note 56411 added to function.shell-exec
| From: | ludvigdotericsonatgmaildotcom at osu1 dot php dot net | Date: | Thu, 01 Sep 2005 18:50:29 +0000 |
| Subject: | note 56411 added to function.shell-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-94618@lists.php.net to get a copy of this message | ||
(if you have any other way of doing this PLEASE send me a mail)
(The following note is interesting to *NIX administrators ONLY)
Jailing a PHP CLI session is not the easiest thing to do.
PHP has a gigantic list of dependencies, you can check it by
ldd
which php
Each of these .so files (shared libraries) can have dependencies, and can depend on each other,
making the list much bigger.
However, there are tools out there to copy all dependencies into a jailed directory, you just have
to search for them - and I had no luck.
What I did was just to run these few commands:
su
mkdir /jailpath && mkdir /jailpath/lib
cp /lib/*.so* /jailpath/lib/
mkdir /jailpath/usr && mkdir /jailpath/usr/bin && mkdir /jailpath/usr/lib
cp /usr/lib/*.so* /jailpath/usr/lib
cp which php /jailpath/usr/bin
chmod -R 0755 /jailpath && chown -R root:root /jailpath && chmod 0000 /jailpath
Do note that this copies _all_ of your shared objects. There is one or two more libraries you have
top copy, but chroot will tell you about which one it is.
Hope this helped somehow.
----
Manual Page -- http://www.php.net/manual/en/function.shell-exec.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56411
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56411&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56411&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56411&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56411&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56411&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56411&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56411&report=yes
Search -- http://master.php.net/manage/user-notes.php