Block all traffic from Russia to coming your site
Whether you want to say “no!” to Putin’s war or you just want to block Russian hackers from attacking your website, the solution is as easy as:
- Connect to your website via FTP and download current version for .htaccess file from there
- Make a copy of this file, just in case…
- Go to Country IP Blocks website
- Search for Russian Federation and check the checkbox next to it
- Scroll the page all the way up and make sure that Apache .htaccess Deny is selected
- Click Create ACL button and copy all the content from ACL Results list that will appear
- Paste it at the end of your .htaccess file and save the file
- Upload it back to your website via FTP overwriting the existing file
Sure, this is not the ultimate solution. Use of proxy servers, Tor networks, botnets and other techniques for spoofing actual IP address will get them through your “so called firewall”. Also, IP address assigmnets changes often, so Country IP Blocks database might already be out-dated (if fact, it is). But, hey!, it’s always something. As good for the start as anything else. And surely better than doing nothing.
When any visitor, using any IP address from the list you’ve just added to your .htaccess file will try to visit your website, they’ll hit the following error instead:
I have read on some Cisco forums that eve n with those 500 kB added to .htaccess file, pages serving latency drops down by just 1 millisecond. So this is fairly acceptable.
How to test it
Well the simplest and the most obvious method is to temporarily block yourself.
- Open any of your website to make sure it is still working
- Ask Google, what is your IP address and copy it
- Paste it at the end of .htaccess file, prepending it with
- Replace last part with
0/19to change single IP address into address block
- Upload updated file your FTP server
- Go back to your website and hit F5 to refresh it and check the results
Of course, don’t forget to revert this process after testing is completed! :)
Note that Country IP Blocks website is cited by many sources as very reliable source of IP addresses, but it list them without any relationship to any existing ISP. If you’d like to see Russian IP addresses split by ISP then you may consider this source (though it seems a bit old and outdated).