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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Limit max number of php or apache processes per user

Discussion in 'Workarounds and Optimization' started by mathx, May 10, 2017.

Tags:
  1. mathx

    mathx Member

    Joined:
    Jan 16, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Toronto
    cPanel Access Level:
    DataCenter Provider
    Amazed this isnt a topic I could find at all with 10 google searches on the forums.

    Everyone knows xmlrpc.php is being hammered by botnets looking for ways into wordpress. Even with the file removed, we were getting heavily loaded by 404s being returned to the hacker. Luckily they were coming from one IP so we could firewall this time. Not so lucky if we get hit by a botnet with only one hit per IP.

    Ulimit doesnt seem to work for users' limits on # of processes total in the system, I figure because suexec is used by apache to execute as the user and isnt inheriting the ulimits.

    Is there a way to limit the # of php/apache processes per user?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  3. mathx

    mathx Member

    Joined:
    Jan 16, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Toronto
    cPanel Access Level:
    DataCenter Provider
    I worded my query wrong -- there is a general problem with any php that is being run that requires a username and password - even custom code. Botnets or hackers just keep hitting the login.php or equivalent in WP, Joomla, etc as well as custom code --

    We'd prefer to just limit the # of apache processes per user so the load doesnt climb beyond when email is delivered and the system is sluggish. 10 should be more than enough to serve many requests.

    So we need the generic solution, not the specific one for wordpress.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  5. mathx

    mathx Member

    Joined:
    Jan 16, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Toronto
    cPanel Access Level:
    DataCenter Provider
    or just use the darn hack of checking every 15 seconds to make sure there arent too many processes for a user, and killing the most recent/oldest/most cpu/some criteria. a short script works. kinda not elegant though.

    but easier than a whole OS reinstall.
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    15,765
    Likes Received:
    313
    Trophy Points:
    433
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You can convert an existing CentOS installation to CloudLinux, no need for a complete reinstall.

    CloudLinux Documentation
     
  7. mathx

    mathx Member

    Joined:
    Jan 16, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Toronto
    cPanel Access Level:
    DataCenter Provider
    aha! thanks. will investigate.
     
    Infopro likes this.
  8. Anoop P Alias

    Anoop P Alias Well-Known Member

    Joined:
    Mar 31, 2015
    Messages:
    76
    Likes Received:
    10
    Trophy Points:
    8
    Location:
    Kochi,Kerala,India
    cPanel Access Level:
    Root Administrator
    You can set an upper limit or max php process if you use PHP-FPM SAPI . But your idea is generally not good and when you are under attack,your entire website and real users will also get affected. The best way to deal with this is to use a nginx frontned and use config like Module ngx_http_limit_conn_module . You can limit the request to a particular URL like /xmlrpc.php for example with this without affecting other parts of your website.
     
Loading...

Share This Page