<?xml version="1.0"?><rss version="2.0"><channel><title>Comments on Block Referrer Spam (Updated) - ILoveJackDaniels.com</title><link>http://www.ilovejackdaniels.com/article/block-referrer-spam/</link><description>Latest comments on Block Referrer Spam (Updated) on ILoveJackDaniels.com</description><item><title>Comment on Block Referrer Spam (Updated)</title><link>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</link><guid>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</guid><description>Comment by Bill ( &lt;a href="http://freebsdrocks.net"&gt;http://freebsdrocks.net&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;I geta  TON of spams on my FAQ pages under comments. I have tried to implement this on my site but I can't seeing as how I use vhosts. Any way around this?</description></item><item><title>Comment on Block Referrer Spam (Updated)</title><link>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</link><guid>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</guid><description>Comment by Vasilii ( &lt;a href="Vasilii"&gt;Vasilii&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Sentimental and nostalgic. Great.</description></item><item><title>Comment on Block Referrer Spam (Updated)</title><link>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</link><guid>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</guid><description>Comment by Karma Debugger ( &lt;a href="http://www.linklog.org"&gt;http://www.linklog.org&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;I had a wrong link coming in from a wrong place. This technique was the cure.</description></item><item><title>Comment on Block Referrer Spam (Updated)</title><link>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</link><guid>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</guid><description>Comment by Rob ( &lt;a href="http://"&gt;http://&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;I though some folks might like to take a look at this site for referrer spam:&lt;br /&gt;http://unknowngenius.com/blog/wordpress/ref-karma/&lt;br /&gt;&lt;br /&gt;he wrote a neat php script to automate updating referrer blocks.</description></item><item><title>Comment on Block Referrer Spam (Updated)</title><link>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</link><guid>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</guid><description>Comment by Rob ( &lt;a href=""&gt;&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Hey folks, sorry for the spam here but i'm wondering how you can tell if this is working?  I found a couple sites referring to different ways to do what you're saying.  One is a .conf file in /path/to/conf.d/ where it works w/ apache and other is .htaccess.  What i'm seeing is a ton of referrer spam in our access logs which doesn't belong.  It's forged as it's asking for sites that our apache server doesn't host.  I would like to get this out of my log file and put the kabosh on the spamming offender by simply blocking their access (if possible).  Any suggestions here?</description></item><item><title>Comment on Block Referrer Spam (Updated)</title><link>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</link><guid>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</guid><description>Comment by CortalUX ( &lt;a href="http://cortalux.co.uk"&gt;http://cortalux.co.uk&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Dammit, I really hate spam.</description></item><item><title>Comment on Block Referrer Spam (Updated)</title><link>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</link><guid>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</guid><description>Comment by Julius ( &lt;a href="http://jult.net/txt/blocks"&gt;http://jult.net/txt/blocks&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;But still, how are you gonna catch ref.spam with just a list of descriptions? It's an endless road I'm travelling, and I'm getting quite fed up with these idiots doing this.&lt;br /&gt;&lt;br /&gt;# the biggest losers ever ( they can't even spell: )&lt;br /&gt;RewriteCond %{HTTP_REFERER} (-nude\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (abrianna\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (amanti\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (anali\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (burdizzo\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (bucetinhas\.) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (calcinha\.) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (cogidas\.) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (esibizioniste\.) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (fimosis\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (folladas\.) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (gotico\.) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (gozadas\.) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (hargitay\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (loredana\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (mamando\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (minifalda\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (plumprumps\.) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (porono\.) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (ramalan\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (stretched\.org) [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} (subsonica\.org) [NC,OR]</description></item><item><title>Comment on Block Referrer Spam (Updated)</title><link>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</link><guid>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</guid><description>Comment by Bruce ( &lt;a href="http://www.synysys.com"&gt;http://www.synysys.com&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;I've been running a somewhat modified system to what I documented in comment #31.  It's currently blocking 3208 IPs from people who have behaved badly on my system (mostly attempts at referrer spam, but that number also includes SSHD and misc script probes against my HTTPD)  The firewall easily handles this many blocks and my web server is much happier with the reduction in load.&lt;br /&gt;&lt;br /&gt;The system responds in real time to these attacks, gives them a custom 403 Error page and then blocks their IP.  The custom 403 Error page is for non-script users who may be blocked inadvertently.  It has a link to a recovery system which unblocks their IP and restores their access.  Of course a bot doesn't follow the on-screen instructions and even if it did, it would just get blocked when it started behaving badly.  All in all, it seems to be quite an effective solution.  &lt;br /&gt;&lt;br /&gt;For folks who don't have admin access to the firewall&lt;br /&gt;on their server, the system is still quite effective, but you will continue to see all of the attempts in your httpd logs.&lt;br /&gt;&lt;br /&gt;If anyone is interested in further details, I'd be more than happy to discuss this via chat or email.  You can contact me on www.synysys.com.  Anything that we can do to slow these idiots down is a step in the right direction.&lt;br /&gt;&lt;br /&gt;Bruce</description></item><item><title>Comment on Block Referrer Spam (Updated)</title><link>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</link><guid>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</guid><description>Comment by Srinath ( &lt;a href="http://www.srinath.info"&gt;http://www.srinath.info&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Thx ! was really useful !!! i had like 100 referrr spam daily. !!!</description></item><item><title>Comment on Block Referrer Spam (Updated)</title><link>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</link><guid>http://www.ilovejackdaniels.com/article/block-referrer-spam/comments/</guid><description>Comment by Bruce MacKay ( &lt;a href=""&gt;&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;My daughter maintained her robotics blog on my site (http://synysys.com/roboblog) for several months until the project came to conclusion and was eventually taken off line.  During it's life span, it fell to a bit of neglect and became the target of the referrer spam bots.  Today our site still gets over a thousand hits per day looking for the old exploit.  &lt;br /&gt;&lt;br /&gt;I know this is a bit like closing the barn door after the cows have all run off and perhaps in this case even part of the barn burned down, but I thought I'd share the solution I hacked together today.   I wasn't satisfied with a purely mod_rewrite solution since as others have noted, you still get a one line log entry in you access log.  Essentially my solution is a two pronged approach.  First it uses mod_rewrite to redirect the spammer back to their own machine.  Second it puts a DROP entry in my firewall so that they won't be coming back to visit again any time soon.  That way my logs aren't filling up with the same old rewrites over and over.  &lt;br /&gt;&lt;br /&gt;The entry in httpd.conf looks like this&lt;br /&gt;&lt;br /&gt;RewriteEngine on&lt;br /&gt;RewriteCond %{QUERY_STRING} disp=stats&lt;br /&gt;RewriteMap referer-deny prg:/etc/httpd/refererdeny.pl&lt;br /&gt;RewriteRule ^(.*)$ ${referer-deny:%&lt;br /&gt;       {REMOTE_ADDR}}/BITE_ME_SPAMMER? [R,L]&lt;br /&gt;&lt;br /&gt;In my case it was a particular query string that typified the bulk of the spam traffic, but you can add other patterns to the above rewrite conditions to suit your own needs.&lt;br /&gt;&lt;br /&gt;The PERL script looks like this&lt;br /&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;$| = 1; # Turn off buffering&lt;br /&gt;while (&lt;STDIN&gt;) {&lt;br /&gt;        print &quot;HTTP://&quot;,$_;&lt;br /&gt;        $b = (&quot;/sbin/iptables -A INPUT -j DROP -p tcp --destination-port 80 -s $_&quot;);&lt;br /&gt;        system ($b);&lt;br /&gt;        open (OUTFILE,&quot;&gt;&gt;/etc/httpd/referer.deny&quot;);&lt;br /&gt;        print OUTFILE (&quot;$b&quot;);&lt;br /&gt;        close (OUTFILE);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The referer.deny &quot;log&quot; looks like this&lt;br /&gt;&lt;br /&gt;/sbin/iptables -A INPUT -j DROP -p tcp --destination-port 80 -s 219.93.21.20&lt;br /&gt;/sbin/iptables -A INPUT -j DROP -p tcp --destination-port 80 -s 220.165.140.8&lt;br /&gt;/sbin/iptables -A INPUT -j DROP -p tcp --destination-port 80 -s 83.100.149.29&lt;br /&gt;&lt;br /&gt;So you could easily add #!/bin/sh to the head of it and run it as a shell script separately if you wanted.  However, before you do that, you should probably sort the file and remove any duplicate entries that may have crept in.  I have chosen to only block access to port 80.  You could easily add port 25 or even remove the destination-port all together and completely block them from your site.  Just be aware that some clever fool could forge your IP and potentially block you from your own site.  Of course you could reduce the output to the log file by substituting $_ for $b and just end up with a list of blocked IPs.&lt;br /&gt;&lt;br /&gt;I realize that not all site admins have root access to be able to run the firewall commands, so you might modify this to update a hosts.deny file that you've defined in your own .htaccess configuration.  The point is you don't really want to have to manually enter every IP or host name if you are really getting bombarded.  Again if you do this, you'll probably want to sort the file and remove dupes.  I'd also recommend that us the DB utility to speed your lookups if you end up with a significant number of blocked hosts.  You really don't want to bog down your site with lookups on account of these spammer fools.&lt;br /&gt;&lt;br /&gt;Of course one of the problems that I alluded to earlier is that you may end up with unwanted blocks defined in your system.  Most hosting environments offer CRON access.  You might choose to flush the firewall rules over some period.  Many of the spammers are running client based tools from dynamic IP pools on the ISP.  Over time you could end up blocking a significant number of IPs that were only used once against your system.  Since this system is automated, it's probably safer to clear it out periodically and let it repopulate itself with the bad apples that keep coming back.&lt;br /&gt;&lt;br /&gt;I hope this helps someone.  It seems to be working wonderfully for our site.  My daughter's robotics project was archived as a PDF for those who are looking for it and the spammers trying to exploit the referrer logs aren't stealing my bandwidth or chewing up file space with senseless logs any longer.&lt;br /&gt;&lt;br /&gt;Bruce</description></item></channel></rss>