Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Run apache as apache.apache not nobody

Discussion in 'Security' started by st0rm, Jul 12, 2014.

  1. st0rm

    st0rm Member

    Joined:
    Jun 27, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello all ,

    I know this is the default configuration for cPanel , running apache as nobody that is .
    And i also know that php is running under handler(in my case fscgi) and using suexec .

    i just want to run apache under apache.apache for firewalling reasons .

    could this be done ? and if so would it sustain updating ? do i have to reconfigure apache to run under apache.apache each time i update cPanel ?

    Thank you all for your time
     
  2. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    834
    Likes Received:
    28
    Trophy Points:
    178
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    The user/group is defined in /var/cpanel/conf/apache/main, but this file is overwritten when EA is run. So, you'd probably want to use a local template to override this:

    Code:
    cp /var/cpanel/templates/apache2/main.default /var/cpanel/templates/apache2/main.local
    
    Edit these lines and hardcode the user in so they are not pulled from the main template:

    Code:
    User [% main.user.item.user %]
    Group [% main.group.item.group %]
    
    Then:

    Code:
    /scripts/rebuildhttpdconf
    service httpd restart
    
    Not sure what other issues this may cause though.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. st0rm

    st0rm Member

    Joined:
    Jun 27, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thank you A LOT ....

    Do you have something in mind what this might cause problems to apache or other services running ?
     
  4. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    834
    Likes Received:
    28
    Trophy Points:
    178
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    cPanel expects the Apache user to be 'nobody'. It won't cause a problem with Apache, but there are some scripts cPanel uses that assume 'nobody' is the user. If you're running PHP in CGI mode, it's probably not as big of a deal.

    Why do you even need to do this? Are you not able to change your firewall rules to use 'nobody'?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. st0rm

    st0rm Member

    Joined:
    Jun 27, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    the problem is , i want to firewall the outbound of the server's connections

    by making firewall match the owner of the connection .. not to accept outbound connection unless it was from apache/exim/named/ftp/root .. that's how i want to configure it

    so if i ran apache as nobody how can i control this ? although yes i do run php in CGI mode , FSCGI to be exact

    any advice would be more than welcome :)

    Thank you for your time
     
  6. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    1,011
    Likes Received:
    88
    Trophy Points:
    78
    cPanel Access Level:
    DataCenter Provider
    "nobody" is still a username just like apache. You could still configure the firewall rules for that UID/GID.
     
  7. st0rm

    st0rm Member

    Joined:
    Jun 27, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Sure , but any one with username nobody will apply to the same firewall rules as apache ..

    hence the problem , he/she will have an outbound OK .. which is what i do not want ..
     
  8. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    1,011
    Likes Received:
    88
    Trophy Points:
    78
    cPanel Access Level:
    DataCenter Provider
    As far as I know the only things that use "nobody" on a cPanel server are Apache and sometimes the FTP server.

    Changing the username of the Apache processes from nobody to apache will change virtually nothing.
     
  9. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Are you positive the firewall rules are not configurable any other way besides changing the username used by Apache? It seems like it would be easier to just modify the firewall rules.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. st0rm

    st0rm Member

    Joined:
    Jun 27, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    So basically i can still run apache as nobody and configure firewall according to nobody ..

    Thank you all for your time
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice