Skip to main content
Topic: Can I block a country? (Read 2912 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Can I block a country?

Do we have an add-on that would allow me to block traffic from specific countries?  With all the anti-spam features on, email registration verification, Bad Behavior, etc., I still get spammers from China.

Re: Can I block a country?

Reply #1

There is not really any good way to reliably block a country.
The only way is to block ranges of IP addresses that likely belong to a certain country. But I wouldn't do that from PHP, at least from htaccess or even better with some Apache module, for example with the old mod_geoip (now replaced by MaxMind DB as far as I understood).
Bugs creator.
Features destroyer.
Template killer.

Re: Can I block a country?

Reply #2

Thanks.

Re: Can I block a country?

Reply #3

If you have your own VPS then you can do it with the max-mind geoIP database ... this is updated monthly (generally).

Both Apache and Nginx have geoip modules that work with the max mind DB.  So when user visits, the IP location is determined and you can block or allow it on a per country basis.   Of course since IP's are dynamic you run a small chance of blocking the wrong folks until the DB is updated again.

If you do any of that be sure to have a cron job that refreshes those DB files one a month or so.

Re: Can I block a country?

Reply #4

^^ what they said.  Or if you have proper server control, you can install ConfigServer firewall.  It allows nation blocking as a feature.  CSF has several other really nice features as well.  Good luck!

http://www.configserver.com/cp/csf.html

Re: Can I block a country?

Reply #5

Quote from: badmonkey – ConfigServer firewall.  It allows nation blocking as a feature.  CSF has several other really nice features as well.  Good luck!

http://www.configserver.com/cp/csf.html
Cool .. had not seen that one before, may have to give it a whirl as it looks very complete.  I've always used a combo of UFW + Fail2Ban with just a handful of open ports.

Re: Can I block a country?

Reply #6

Virtualmin has CSF by default

Re: Can I block a country?

Reply #7

Does anybody know a good hoster that supports this CSF together with CPanel WHM and is not too expensive..So not more than 10 to 20 USD per month for hosting ?
I am mostly interested to block users who make too much traffic in the forum and try to download the whole forum..
How can these be blocked ?
Or is there a simple Website firewall available for Elkarte that can do this ?

Re: Can I block a country?

Reply #8

Is no point of blocking a country. Limiting access time should be fine though.