I put together a simple query page on my site that will list all the IP addresses of a given country.
The list can be used in programs like PeerBlock or within iptables (or ipset) to block whole countries from accessing a system. I currently use iptables/ipset (ipset thanks to a suggestion by Jasper) on my firewalls but used to run PeerBlock as a service protecting Windows systems. These lists allow me to select whole countries, such as China, and deny their access to my systems.
The current list of countries I am blocking is here. Sorry to all of the legitimate users from those countries, but the other guys just don’t make it worth my while to allow access. Go yell at them.
I also maintain a list of individuals that have attempted to break in using ssh. These hackers actively try to guess account and password combinations to gain illegal access to my systems. Sadly, all they do is populate my honeypot with a record of what they try. The data is automatically gathered and the list is available on this page.
What became apparent very quickly from that list was that China far and above any other country was responsible for the vast majority of the break-in attempts. Other countries, like the Russian Federation, Taiwan, Brazil and a few others followed quite a bit behind.
Even though I adore these countries, have traveled to China personally and respect their ancient and colorful traditions, the lack of respect and accountability shown by the people of China, the Russian Federation and others results in their just not being allowed to access my system anymore. And it’s not like getting access to my random blog posts is really worth their effort either.
Note: if you know the two letter country code (which you can get using the above pull-down list) then you can call my function directly to obtain the list of IP addresses for one country. For example, to obtain the list for Australia, you could use
- http://www.darrenpopham.com/geo/country.php?cc=AU for a Peerblock list
- http://www.darrenpopham.com/geo/country.php?cc=CA&f=iptables for an iptables list
- http://www.darrenpopham.com/geo/country.php?cc=IE&f=ipset for an ipset script
Also I offer this as a courtesy service. The server is not that fast, so please do not thrash it or otherwise overload the server or else I might be forced to look into moving the service somewhere else (or worse, if it is getting thrashed, I might need to turn it off or block the IP address in question……)