You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Grant Peel <gp...@thenetnow.com> on 2007/10/22 16:21:40 UTC

[users@httpd] php and suexec

Hi again all,

Has anyone on this had succees setting up php to use (apache) suexec?

If I am reading things right, it appears that php must be run as CGI and
then it will use the built in (Apache2) suexec wrapper in the same fassion
as perl does.

If the above is correct I am looking for a primer on how to set this all up.

TIA,

-Grant



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] php and suexec

Posted by Joshua Slive <jo...@slive.ca>.
On 10/24/07, Grant Peel <gp...@thenetnow.com> wrote:
>
>
> Joshua,
>
> Interesting, maybe I have always missunderstood  these (suexec) conditions (12 and 13 I think).
>
>
>     Is the directory within the Apache  webspace?
>
>
>
> If the request is for a regular portion of the server, is the    requested directory within suEXEC's document root? If the request is for a    UserDir, is the requested directory within the directory configured as    suEXEC's userdir (see suEXEC's    configuration options)?
> Is the directory NOT writable by anyone else?
>
> We don't want to open up the directory to others; only the    owner user may be able to alter this directories contents.
>

Those are restrictions about what kind of scripts suexec will launch.
Suexec is a simple suid launcher. Once the script is launched, suexec
no longer has any control over it.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] php and suexec

Posted by Grant Peel <gp...@thenetnow.com>.
Joshua,

Interesting, maybe I have always missunderstood these (suexec) conditions (12 and 13 I think).


    Is the directory within the Apache webspace? 
  1.. If the request is for a regular portion of the server, is the requested directory within suEXEC's document root? If the request is for a UserDir, is the requested directory within the directory configured as suEXEC's userdir (see suEXEC's configuration options)? 

  2.. Is the directory NOT writable by anyone else? 
  We don't want to open up the directory to others; only the owner user may be able to alter this directories contents. 

  ----- Original Message ----- 
  From: Joshua Slive 
  To: users@httpd.apache.org ; Grant Peel 
  Sent: Wednesday, October 24, 2007 9:45 AM
  Subject: Re: [users@httpd] php and suexec


  On 10/24/07, Grant Peel <gp...@thenetnow.com> wrote:
  >
  >
  > Understood,
  >
  > BUT suexec will not allow a script to be written to outside the users home directory ... right?
  >

  I have no idea what you mean with that sentence.

  Suexec is very strict about what scripts it will LAUNCH. But once a
  script is started, it is free to do anything that is allowed to its
  user.

  Joshua.

  ---------------------------------------------------------------------
  The official User-To-User support forum of the Apache HTTP Server Project.
  See <URL:http://httpd.apache.org/userslist.html> for more info.
  To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
  " from the digest: users-digest-unsubscribe@httpd.apache.org
  For additional commands, e-mail: users-help@httpd.apache.org


------------------------------------------------------------------------------
        Total Control Panel  Login  
        To: gpeel@thenetnow.com  Message Score:  50   High (60): Pass  
        From: users-return-76615-gpeel=thenetnow.com@httpd.apache.org  My Spam Blocking Level:  High  Medium (75): Pass  
             Low (90): Pass 
           Block messages from this sender (blacklist)    
          
        This message was delivered because the content filter score did not exceed your filter level.  

Re: [users@httpd] php and suexec

Posted by Joshua Slive <jo...@slive.ca>.
On 10/24/07, Grant Peel <gp...@thenetnow.com> wrote:
>
>
> Understood,
>
> BUT suexec will not allow a script to be written to  outside the users home directory ... right?
>

I have no idea what you mean with that sentence.

Suexec is very strict about what scripts it will LAUNCH. But once a
script is started, it is free to do anything that is allowed to its
user.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] php and suexec

Posted by Grant Peel <gp...@thenetnow.com>.
Understood,

BUT suexec will not allow a script to be written to outside the users home directory ... right?

-Grant
  ----- Original Message ----- 
  From: Joshua Slive 
  To: users@httpd.apache.org ; Grant Peel 
  Sent: Monday, October 22, 2007 11:12 AM
  Subject: Re: [users@httpd] php and suexec


  On 10/22/07, Grant Peel <gp...@thenetnow.com> wrote:
  >
  >
  > Hi Matthew,
  >
  >
  > Thanks for the speedy resonse. I actually am setting suphp on a test server right now, but one of the items I was looking for was to jail users from a php standpoint similar to what suexec does for perl, i.e. can't write outside the users docroot, etc etc.
  >
  > If I read suphp right, it does not do that. PLEASE correct me if I am wronge!
  >

  suexec doesn't do that either. This is no "jail", the scripts are
  simply subject to regular unix file permissions granted to the
  assigned user.

  Joshua.

  ---------------------------------------------------------------------
  The official User-To-User support forum of the Apache HTTP Server Project.
  See <URL:http://httpd.apache.org/userslist.html> for more info.
  To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
  " from the digest: users-digest-unsubscribe@httpd.apache.org
  For additional commands, e-mail: users-help@httpd.apache.org


------------------------------------------------------------------------------
        Total Control Panel  Login  
        To: gpeel@thenetnow.com  Message Score:  50   High (60): Pass  
        From: users-return-76555-gpeel=thenetnow.com@httpd.apache.org  My Spam Blocking Level:  High  Medium (75): Pass  
             Low (90): Pass 
           Block messages from this sender (blacklist)    
          
        This message was delivered because the content filter score did not exceed your filter level.  

Re: [users@httpd] php and suexec

Posted by Joshua Slive <jo...@slive.ca>.
On 10/22/07, Grant Peel <gp...@thenetnow.com> wrote:
>
>
> Hi Matthew,
>
>
> Thanks for the speedy resonse. I actually am  setting suphp on a test server right now, but one of the items I was looking for  was to jail users from a php standpoint similar to what suexec does for perl,  i.e. can't write outside the users docroot, etc etc.
>
> If I read suphp right, it does not do that. PLEASE  correct me if I am wronge!
>

suexec doesn't do that either. This is no "jail", the scripts are
simply subject to regular unix file permissions granted to the
assigned user.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] php and suexec

Posted by Grant Peel <gp...@thenetnow.com>.
Hi Matthew,


Thanks for the speedy resonse. I actually am setting suphp on a test server right now, but one of the items I was looking for was to jail users from a php standpoint similar to what suexec does for perl, i.e. can't write outside the users docroot, etc etc.

If I read suphp right, it does not do that. PLEASE correct me if I am wronge!

-Grant
  ----- Original Message ----- 
  From: Matthew A. Bockol 
  To: users@httpd.apache.org ; Grant Peel 
  Sent: Monday, October 22, 2007 10:29 AM
  Subject: Re: [users@httpd] php and suexec



  Hi Grant,

  You might also consider suPHP (http://www.suphp.org). I don't use it myself, but it should do what you want. Otherwise, php in CGI mode is pretty simple. 

  1. don't load the libphp module in httpd.conf (or disable php for the directory containing the scripts you want to cgi exec).

  2. Add .php to the AddHandler cgi-script line in httpd.conf 

  3. Make sure Options ExecCGI is enabled for the directory where you're storing the scripts.

  4. Make sure the scripts have a #!/path/to/bin/php line at the top (I know this works in *nix, not sure about win32).

  Matt



  ----- Original Message -----
  From: "Grant Peel" <gp...@thenetnow.com>
  To: users@httpd.apache.org
  Sent: Monday, October 22, 2007 9:21:40 AM (GMT-0600) America/Chicago
  Subject: [users@httpd] php and suexec

  Hi again all,

  Has anyone on this had succees setting up php to use (apache) suexec?

  If I am reading things right, it appears that php must be run as CGI and
  then it will use the built in (Apache2) suexec wrapper in the same fassion
  as perl does.

  If the above is correct I am looking for a primer on how to set this all up.

  TIA,

  -Grant



  ---------------------------------------------------------------------
  The official User-To-User support forum of the Apache HTTP Server Project.
  See <URL:http://httpd.apache.org/userslist.html> for more info.
  To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
  " from the digest: users-digest-unsubscribe@httpd.apache.org
  For additional commands, e-mail: users-help@httpd.apache.org



  ---------------------------------------------------------------------
  The official User-To-User support forum of the Apache HTTP Server Project.
  See <URL:http://httpd.apache.org/userslist.html> for more info.
  To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
  " from the digest: users-digest-unsubscribe@httpd.apache.org
  For additional commands, e-mail: users-help@httpd.apache.org


------------------------------------------------------------------------------
        Total Control Panel  Login  
        To: gpeel@thenetnow.com  Message Score:  50   High (60): Pass  
        From: users@httpd.apache.org  My Spam Blocking Level:  High  Medium (75): Pass  
             Low (90): Pass 
           Block messages from this sender (blacklist)    
          
        This message was delivered because the content filter score did not exceed your filter level.  

Re: [users@httpd] php and suexec

Posted by "Matthew A. Bockol" <mb...@carleton.edu>.
Hi Grant,

You might also consider suPHP (http://www.suphp.org). I don't use it myself, but it should do what you want. Otherwise, php in CGI mode is pretty simple. 

1. don't load the libphp module in httpd.conf (or disable php for the directory containing the scripts you want to cgi exec).

2. Add .php to the AddHandler cgi-script line in httpd.conf 

3. Make sure Options ExecCGI is enabled for the directory where you're storing the scripts.

4. Make sure the scripts have a #!/path/to/bin/php line at the top (I know this works in *nix, not sure about win32).

Matt



----- Original Message -----
From: "Grant Peel" <gp...@thenetnow.com>
To: users@httpd.apache.org
Sent: Monday, October 22, 2007 9:21:40 AM (GMT-0600) America/Chicago
Subject: [users@httpd] php and suexec

Hi again all,

Has anyone on this had succees setting up php to use (apache) suexec?

If I am reading things right, it appears that php must be run as CGI and
then it will use the built in (Apache2) suexec wrapper in the same fassion
as perl does.

If the above is correct I am looking for a primer on how to set this all up.

TIA,

-Grant



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org