Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    7

    Default SuPHP problem

    Hello!
    I've got a new fresh cPanel install. I'v just compiled Apache + SuPHP ( "PHP Security" option at "EasyApache ( Apache Update )" ).
    Everything is working fine except for the restrictions.
    Simple PHP script, like "echo file_get_contents('/etc/passwd');", is able to read that file, which I'd rather avoid.
    Is it a normal behavior or did I do something wrong? Do I have to create customs php.ini files for every user with variable "open_basedir"?

    System: Centos 5.4 64bit
    Kernel: 2.6.18-164.11.1.el5
    cPanel: cPanel 11.25.0-R43473 - WHM 11.25.0

    Best Regards!
    Grzeg

  2. #2
    Registered User
    Join Date
    Jul 2004
    Posts
    7

    Default

    Alright, I will help you out

    In httpd.conf I've made a global conf to define php.ini file:
    suPHP_ConfigPath /usr/local/php

    Apache is reading this file only ( no custom php.ini files allowed ).

    In php.ini I set open_basedir restrictions:

    /home:/usr/lib/php:/usr/local/lib/php:/tmp

    Everything seems to be working fine, so I just want to ask you is it enough or is there enything else to change?
    PHP code can not access e.g. /etc/passwd file anymore, and can't access other users homedirs.

  3. #3
    Member
    Join Date
    Jul 2009
    Posts
    67

    Default

    Would be nice to get some input from cPanel here, is this a security threat?

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    7

    Default

    Quote Originally Posted by radeonpower View Post
    Would be nice to get some input from cPanel here, is this a security threat?
    Theoretically no, because passwd file is not a big secret ( no password is stored in that file ), but I don't like to share all the informations with my clients.
    Without "open_basedir" restriction users are allowed to read other dirs and files with global read permisson.

    Apparently, SuPHP is blocking scripts trying to read other users webroots ( like /home/other_user/public_html/file.html ), so it looks like my solution should work properly.

  5. #5
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Default

    Yes you covered the basics for doing that ....

    Be advised though that users could still override the restrictions
    with a custom PHP.INI unless you modified the code and manually
    recompiled or use function shadowing and do the same but what
    you listed is generally a good start in the right direction.

  6. #6
    Member
    Join Date
    Nov 2005
    Posts
    24

    Default Re: SuPHP problem

    Hi,

    I cant understand anything that Spiral said.

    Also, I dont see any cPanel moderator commenting on the seemingly excellent method posted by grzeg here. Is it safe to apply this technique only or one needs to do more or it simply does not work? I would like to guidance on this as all the other suggestions I have seen so far seem very tedious to maintain while this seems to do the job with very little maintenance.

    Please comment.

    Thank you,

    S

  7. #7
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,165
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: SuPHP problem

    You want to prevent users from overriding php.ini?
    Here's an older thread you might get some value from:
    http://forums.cpanel.net/f185/server...ini-78137.html

  8. #8
    Member
    Join Date
    Nov 2005
    Posts
    24

    Default Re: SuPHP problem

    That link does not help too! I am looking for some cPanel representative to comment here on what grzeg has recommended. Or please link me or guide me to a simple step by step way to secure a server with suPHP for existing and future accounts that requires less maintenance man hours of me to ensure security of the server. I am so confused about what is right being not so technical in these topics!

  9. #9
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,165
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: SuPHP problem

    You might do better to hire a professional to assist, or moved to managed hosting. That will surely Free up your man hours.
    Dev & Sys Admin Services « Application Catalog

  10. #10
    Member
    Join Date
    Nov 2005
    Posts
    24

    Default Re: SuPHP problem

    Actually I do have a managed hosting plan from SolarVPS and they say it is as it is and told me it is a hassle to maintain suPHP and go for DSO. However, since I find suPHP being recommended by cPanel and is provided as the default solution yet with security issues, I am looking for assistance here to how best resolve those security issues without too much of a maintenance aspect involved with about 200 existing and later on new accounts that will come onboard in the future.

  11. #11
    Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    300
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: SuPHP problem

    suPHP is certainly not a hassle to maintain. All our shared servers and all our customers's shared servers we manage are configured with suPHP with no problem at all and some servers are hosting up to 800 accounts.
    You only need to make sure that :
    1) Files and folders are owned by the user
    2) Folders permissions are no higher than 755 and files permissions 644
    3) .htaccess contain no php flag values

    Custom php.ini are controled with suPHP_ConfigPath and we have written a small script that helps our customers to easily create one for their customers who need a custom configuration.
    Marie - Co-Owner
    Need Further Assistance ? Here you go !
    English, french and spanish support

Similar Threads & Tags
Similar threads

  1. suPHP Problem
    By Technics in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 02-08-2012, 02:09 AM
  2. Catastrophic problem after switching to suPHP
    By konrath in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 09-08-2010, 11:02 AM
  3. SuPHP problem
    By grzeg in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 03-11-2010, 02:05 PM
  4. new suphp problem after EA3
    By jandafields in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-02-2007, 12:42 AM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube