Methods to ban whole countries on server level

September 11, 2008
Filed under Server Management

I already expressed my opinion about country bans in a previous post, now let’s see some methods of how to achieve country bans.
With IPTables, using a bash script:
Remember that this will work only under Linux and with IPTables working correctly.
Instead of looking up every IP and block, we ask APNIC about a country’s allocated IPs.
The [...]

Read the whole article »

Ban IP on server level after a number of unsuccessful logins

August 24, 2008
Filed under Linux, Server Management

This is a widely used function amongst the server managers. Depending on your system configuration, the server will ban the enforcer’s IP, either putting it in the firewall’s deny list or, on Linux servers with IPTables installed, will put the IP in the drop list.
To achieve this feature, the easiest way is [...]

Read the whole article »

Restrict access to directory or domain by IP, using .htaccess

August 2, 2008
Filed under .htaccess

I don’t blah too much on this subject.
Basically, you can restrict or allow who can connect to your site or who can access specific directories using .htaccess .
Here’s the code to block one specific IP, I use 192.168.0.1 to block, you replace it with the IP you want to deny.

order allow,deny
deny from 192.168.0.1
allow from [...]

Read the whole article »

Be Google’s friend: Make your URLs canonical with .htaccess

July 18, 2008
Filed under .htaccess, Apache, Server Management

This subject is… is… well
Every second site on the net has at least one article about this subject. But to be honest, it’s good to have so many articles about this, in a way. At least people recognize they should use it. Or not.
So, what’s the fuss around the URL canonicalization? One thing only: [...]

Read the whole article »

Hotlink Protection using .htaccess made easy

July 18, 2008
Filed under .htaccess, Apache, Server Management

This is one of the most used tricks by the webmasters who care about their allocated bandwidth. The code which controls what are domains where your images can show up is very short, 4 line that is.
As always, I provide the full code, then below it I explain everything.
To use this code, you have to [...]

Read the whole article »