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.

Block IP Addresses

Discussion in 'Security' started by JasMax, May 8, 2014.

  1. JasMax

    JasMax Member

    Joined:
    Jan 26, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    How to block incoming traffic for a domain on server ? for all services.
    Other domains should not affect.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Do you control the DNS for this domain name? If so, simply change it's name servers so that it does not resolve to your server.

    Thank you.
     
  3. JasMax

    JasMax Member

    Joined:
    Jan 26, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello Michael,

    Thank you, I have done the same thing, but I am facing problem with few bots like gate.php, cfg.bin.
    I have created mod-security rule also deleted files, but traffic is still coming to a domain, also tried to delete the apache entry for the domain, but then traffic comes to server (hostname)

    Looking forward to block traffic for problem files or domain.
     
  4. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    940
    Likes Received:
    55
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    What ModSecurity rule(s) are you using? You can block an entire domain with this rule:

    Code:
    SecRule SERVER_NAME "site-to-block.com" "deny,phase:1,nolog,id:2333897,status:406"
    Try it without 'nolog' first, and if that works, add 'nolog' to save the resources from logging all the blocks.

    Also set this in the sites main .htaccess to minimize response size:

    Code:
    errordocument 406 default
     
  5. JasMax

    JasMax Member

    Joined:
    Jan 26, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Dear quizknows,

    Thank you for answer, I am using same rule for domain and for files using code below.

    SecRule REQUEST_FILENAME "^/gate\.php$" "phase:2,deny,status:402,id:10124480,log,msg:'Bad File'"

    Still domain is using server bandwidth in 24 hours it has used 5 GB bandwidth.
     
  6. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    940
    Likes Received:
    55
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    Are you only trying to block the bad file(s)? Or do you want to completely block traffic to the domain?

    I also do like Michael's recommendation of changing the site's DNS record. If you don't need the site, set their DNS A record to something like 127.0.0.1 and the bots will send their traffic to themselves instead of your server.
     
Loading...

Share This Page