nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

How to jail php

This is a discussion on How to jail php within the Web servers forums, part of the Mastering Servers category; Hello, For security i need to put PHP in jail. How do i put or run PHP inside a chroot ...


Go Back   nixCraft Linux Forum > Mastering Servers > Web servers

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 01-18-2007, 04:14 AM
raj raj is offline
Contributors
User
 
Join Date: Jun 2005
Location: Hyderabad
Posts: 151
Rep Power: 4
raj is on a distinguished road
Default How to jail php

Hello,

For security i need to put PHP in jail. How do i put or run PHP inside a chroot jail ?

TIA
__________________
Raj
Linux rulz.
I have never turned back in my life ; I shall not do so today.. haha
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-25-2007, 04:06 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,061
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Assuming that your jail is located @ /jail

First copy PHP5 to jail

Code:
mkdir -p /jail/usr/bin
cp /usr/bin/php5-cgi /jail/usr/bin/
cp /usr/bin/php5 /jail/usr/bin/
Now copy shared libs; use this script http://www.cyberciti.biz/files/lighttpd/l2chroot.txt
Code:
cd /bin
wget http://www.cyberciti.biz/files/lighttpd/l2chroot.txt
mv l2chroot.txt l2chroot
chmod +x l2chroot
Open script and setup BASE="/webroot" variable:
Code:
BASE="/jail"
Now copy libs:
Code:
/bin/l2chroot /usr/bin/php5-cgi
/bin/l2chroot  /usr/bin/php5
i

Copy /etc/php.ini and other php config files to /jail/etc/ directory and restart Web server. See following url for detailed instructions
http://www.cyberciti.biz/tips/howto-...oted-jail.html
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +5.5. The time now is 08:11 AM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36