Want to Ban China Traffic Via WHM

Discussion in 'Apache' started by sheree99, Sep 23, 2008.

  1. #1
    Have used .htaccess files at site level in the past but with 30 odd sites on the server too overhead intensive. Now have 1000 ip ranges loaded in ConfigServer Security & Firewall IP Deny file and that works well. 1000 is the limit - is there any other way to block more ip ranges at the front end? ta Sheree
     
    sheree99, Sep 23, 2008 IP
  2. guruguy

    guruguy Active Member

    Messages:
    553
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #2
    I would go to http://www.maxmind.com/app/mod_geoip and install the mod_geoip as it says on the website. You can then configure what countries to ban / redirect via server wide via the httpd.conf file. I implemented this today but via .htaccess to test it and so far it has blocked 99% of my chinese and Iranian traffic, and if all is good in a few days I will turn it on server wide. After much research, this is the most efficient way although installation is tricky if you don't know what you're doing.

    I don't think there is a decent solution via whm however I could be wrong
     
    guruguy, Sep 23, 2008 IP
  3. sheree99

    sheree99 Active Member

    Messages:
    154
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Thanks for that - could u poss share what u put on your httpd.conf file? ta Sheree
     
    sheree99, Sep 23, 2008 IP
  4. guruguy

    guruguy Active Member

    Messages:
    553
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I haven't placed it in httpd.conf yet. Although after installation I placed the following code in my htaccess file. According to the maxmind site, it should do the same job but sitewide by placing it in httpd.conf

    
    # This blocks traffic from China, Russia and Iran
    
    GeoIPEnable On
    GeoIPDBFile /usr/local/etc/GeoIP.dat
    #replace above line with path to geoip.dat. I couldn't get this right so I just commented the above line and it still seemed to work fine.
    
    SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
    SetEnvIf GEOIP_COUNTRY_CODE RU BlockCountry
    SetEnvIf GEOIP_COUNTRY_CODE IR BlockCountry
    # ... place more countries here
    
    Deny from env=BlockCountry
    
    # See http://httpd.apache.org/docs/1.3/mod/mod_access.html for more details
    
    Code (markup):
     
    guruguy, Sep 23, 2008 IP