Discussion in 'Feature Requests' started by zapyahoo, Nov 23, 2013.

  1. zapyahoo

    zapyahoo New Member


    Did a couple of searches and found 2 threads related to country ip blocking, mostly iptables.

    Many users are starting to request this feature to block countries like china, india, vietnam, etc. Can't really blame them, these visits generate absolutely nothing good, just spam or content ripoff.

    This would be a nice future feature to add to ispconfig3 and activated / enforced in each website apache directives. If on, countries to block.

    Meanwhile, any good tutorial on how to implement mod_geoip2 with ispconfig3?

  2. Wisdown

    Wisdown Member

    I use as workaround pfblock addon on my pfSense firewall

  3. suther

    suther Member

    Would love to see those geo-ip blocking implemented in ISPConfig.
  4. Nilpo

    Nilpo Member HowtoForge Supporter

    You can install mod_geoip2 per its instructions. Then add geoip.conf to your conf directory. On CentOS it's /etc/httpd/conf.d/

    LoadModule geoip_module modules/
    <IfModule mod_geoip.c>
      GeoIPEnable On
      GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
    You may need to correct the paths accordingly.

    I also add an Apache directive snippet to selectively disable it per website.

    You can also block traffic for each website using the optional Apache directive snippets.

    GeoIPEnable On
    GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
    SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
    SetEnvIf GEOIP_COUNTRY_CODE RU BlockCountry
    # ... place more countries here
    Deny from env=BlockCountry
    According to performance recommendations, you should use GeoIPEnable Off at the server and site level and enable it per page. I personally have not found it to be problem, but every server is different.
    Last edited: Dec 9, 2013
  5. Nilpo

    Nilpo Member HowtoForge Supporter

Share This Page