Rablat Global Network
16:49:23 up 266 days, 3:44, 2 users, load average: 0.00, 0.00, 0.00

Apache halfassed fusker referer cockblocking!

Here's a quick and dirty description of how I managed this in Apache. I can't remember the specific documentations I used but I do remember having to cobble together a mishmash of examples from different sources.

All in all, it's pretty easy and straightforward.

First off, make sure you have the rewrite module installed. It's load script will be in /etc/apache2/mods-available as 'rewrite.load' - put a symlink to this file in /etc/apache2/mods-enabled, using ln -s /etc/apache2/mods-available/rewrite.load rewrite.load in case you forgot how to use ln :)

Next, you need to figure out where to put the RewriteEngine parameters. I don't remember all the options and the specifics, unfortunately. For my use, I just put it in the config for the userdir module, so it encompassed ALL home directories.

I did this by modifying /etc/apache2/mods-enabled/userdir.conf and adding the following lines in between the <Directory (path) > header and its respective closing header:

	RewriteEngine on
	RewriteCond %{HTTP_referer} ^http://(www\.)?.*(-|.)fusker(-|.).*$ [OR]
	RewriteCond %{HTTP_referer} ^fusker+$ [NC]
	RewriteRule .* - [F,L]

The rewrite module is a very powerful tool in itself. Doing some reading, I found that you can use it for server load balancing, redirection, url correction, lots of things.

The first line tells Apache to turn the rewrite module on.

The RewriteCond lines take two parameters. The first being the pattern referenced to match to the second parameter, which is a regexp thinger. I have a very basic understanding of regular expressions. The first one I copied from another site that was doing blocking of porn referrals, and I substituded 'fusker' instead. The second one matches any referer URL that contains the word 'fusker,' making the first condition redundant.

The [OR] after the first RewriteCond line tells it "OR" the next line. You can have as many [OR] as you wish. The last, or only, line should have [NC] after it.

The final line ... at the moment I'm not sure exactly what it means specifically, but it redirects all requests that match the above expressions to either a URL or, in this case, a 403 forbidden message.

When I'm not so tired, I'll go back over this and make it a little clearer, but for now at least you have a quick and dirty way to block fusker sites if you use apache2. If you just rent space on a server, but have access to your apache2 config for your specific virtual server, you can add these directives almost anywhere apropriate, like in the virtualserver config. I just chose the userdir module because it will then only affect the users and not anything I put on the root page. If anyone has any information they'd like to add or correct me on, don't hesitate to email me (raven AT rablat DOT com)


Web Mail, Yo!

Site Stats

Various Information

Please read our updated Terms of Service if you haven't already.

To read a short article on blocking fusker rapage in apache2, click here

If you are having problems setting up SFTP, here's a guide.


Here are a few links to sites we host, and other interesting things.

shittywhipping.org - A site full of videos and other media involving some of our members doing silly, retarded, or just plain neat things. Also a forum.

Team Thicko - We're a member of Team Thicko in Stevens Point, WI's annual trivia contest... They have message boards.

Raven's Home - One of the webmasters' archive of previous home pages.

Get Firefox! www.cacert.org