Forum Moderators: phranque

Message Too Old, No Replies

Run Apache in a Chmoded JAIL, php problems

Run Apache in a Chmoded JAIL, php problems

         

Socceraccess

1:58 am on Jun 24, 2005 (gmt 0)

10+ Year Member



PHP Warning: main(): php_network_getaddresses: getaddrinfo failed: Name or service not known in

Dear Ev1 members

I use Plesk and I use Apache, CGI, MySQL and PHP

I was able to use mod-security, to use a Chroot directory, everything works ok, exept that in some sites I need to include CGI scripts

so the call will be like this:

@include("http://www.mysite.com/cgi-bin/coranto/shownews.cgi?id=DLSMSMEMLLFSOWLSF");

Whenever I run Apache with mod-security but WITHOUT the CHROOT option, everything works ok

When I run the Chroot option, everything works ok, exept that in PHP, I cannot fopen, include... external URLs

Seems like PHP isn't able to do reverse DNS or something similar

I went to the mod-security site, and read EVERYTHING, the first 3 chapters of the Apache Security book.

I've followed all the instructions, and I created a /chroot directory, with all the libraries copied into /chroot/lib

The libraries that are needed by /sbin/httpd and libphp4.so, I copied them all

I even copied the /chroot/etc/resolv.conf file, and the libraries needed by the /bin/host programs, along with the program itself

So right now I'm able to do this:

chroot /chroot /bin/host www.google.com

and it outputs:
www.google.com is an alias for xx.xx.xx.xx.

I restart apache, but still, I can't include the CGI script form my PHP script

I am trying to load a CGI script from www.mysite.com in a script located at the same site: www.mysite.com

I can't include it like this:

include("/var/www/site.com/cgi-bin/coranto/shownews.cgi?id=DLSMSMEMLLFSOWLSF");

because the cgi script won't run

Any suggestions will be highly appreciated

Regards

Xavier

jd01

3:15 am on Jun 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is not at all something I deal with, but I did run into a problem with includes on PHP once and had to change to a require with a $_SERVER full path, like this:

require $_SERVER['yoursite.com'] . '/var/www/site.com/cgi-bin/coranto/shownews.cgi?id=DLSMSMEMLLFSOWLSF';

Really, don't know if it will help, and I could be a thousand miles from the correct answer, but it may be worth a try... I don't remember off the top of my head why I had to switch from the include to require, but there was a good reason =)

Justin

Socceraccess

2:56 pm on Jun 25, 2005 (gmt 0)

10+ Year Member



Thanks for your answer
from what I know, require will stop running the rest of the script if something fails, I hope that works