<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>The BFC Computing Weblog: Tracking Blog Spam</title>
    <link>http://blog.bfccomputing.com/articles/2007/03/30/tracking-blog-spam</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>My God, It's Full of Source!</description>
    <item>
      <title>Tracking Blog Spam</title>
      <description>&lt;p&gt;My blog is getting killed with spam,  greater than 300 per day.  Does anybody know how to implement CAPTCHA in typo?  Or make Akismet do a better job of ranking?&lt;/p&gt;

&lt;p&gt;In the meantime I&amp;#8217;ve taken to blocking IP addresses.  Here&amp;#8217;s a handy little script I worked up (regex from the Perl regex FAQ) to take a block of arbitrary text (copy &amp;#8216;n paste from my typo admin console&amp;#8217;s log of comments) and spit back iptables blockrules for any IP addresses found in the text:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/perl -w
use strict;
use warnings FATAL=&amp;gt;'all';

my (@addresses);
while (&amp;lt;&amp;gt;) {
    my $str = $_;
    if ($str =~ /\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}/)
    {  #{1,3} says find at least 1 and no more than 3 of \d.
        # we must escape the dots . which are normally wild cards
        # to make them match dots.
        # you might have notice already that $&amp;amp; contains the last match
        my $remoteHost = $&amp;amp;;
        push(@addresses,$remoteHost);
    }
}

foreach my $address (@addresses) {
    if ($address ne '127.0.0.1') {
        print "-A RH-Lokkit-0-50-INPUT -s $address -j DROP\n";
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now, this isn&amp;#8217;t the best strategy as of 789 spams, there were 189 unique hosts, so it&amp;#8217;s more distributed than I&amp;#8217;d like.  Perhaps it&amp;#8217;s a start, though.&lt;/p&gt;

&lt;p&gt;Update: I installed Typo 4.1 which has a feature called &amp;#8216;Enable Spam Protection&amp;#8217;, which looks at blacklists.&lt;/p&gt;</description>
      <pubDate>Fri, 30 Mar 2007 03:19:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:7fefb76e-5a43-45df-819a-428d804424ad</guid>
      <author>Bill McGonigle</author>
      <link>http://blog.bfccomputing.com/articles/2007/03/30/tracking-blog-spam</link>
      <category>BFC Computing</category>
      <category>Internet</category>
      <category>Security</category>
      <category>blog</category>
      <category>spam</category>
      <trackback:ping>http://blog.bfccomputing.com/articles/trackback/4627</trackback:ping>
    </item>
  </channel>
</rss>
