<?xml version="1.0" encoding="utf-8"?>

<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  xmlns:admin="http://webns.net/mvcb/"
  xmlns:cc="http://web.resource.org/cc/"
  xmlns="http://purl.org/rss/1.0/">

<channel rdf:about="http://mt-hacks.com/">
<title>MT AutoIPBlock - Reduce the Spam CPU Load</title>
<link>http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html</link>
<description>MT AutoIPBlock - Reduce the Spam CPU Load Discussion at MT-Hacks.com</description>
<dc:language>en-us</dc:language>
<dc:creator>Mark</dc:creator>
<dc:date>2004-12-15T13:31:04-05:00</dc:date>
<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=4.25b2-en" />

<cc:license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/1.0/" />


<items>
<rdf:Seq>
<rdf:li rdf:resource="http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html#067426" />

<rdf:li rdf:resource="http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html#158466" />

<rdf:li rdf:resource="http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html#158596" />
</rdf:Seq>
</items>

</channel>

<item rdf:about="http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html">
<title>MT AutoIPBlock - Reduce the Spam CPU Load</title>
<link>http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html</link>
<description><![CDATA[<p>This is a hack I began using recently, in an emergency situation.  Blog comment spam was creating a huge CPU load on my web server, to the point that it was causing server crashes and CPU restrcitions from my (now former) web host.  I have heard increasing report of web hosting banning the use of Movable Type on their hosting plans for the same reason.</p>

<p><em>This an MT-Blacklist hack that automatically blocks the IP address of someone trying to post commnent that matches your blacklist</em>.  It does this using htaccess, so repeated POSTs from that IP will <em>never reach the MT scripts</em>, thus saving your CPU.</p>

<p>First, let me be clear that I agree with <a href="http://www.jayallen.org/comment_spam/2004/05/mtb_20_and_ip_banning">Jay Allen</a> and <a href="http://kalsey.com/2004/02/why_ip_banning_is_useless/">Adam Kalsey's</a> comments about the drawbacks of IP blocking.  And I recommend that you read those posts linked to in the previous sentence, before using this hack.  I do disagree with the general notion that "IP banning is useless", because it can reduce the CPU load, and that it the <em>only</em> benefit of this hack.  <strong>This hack will not reduce your blog spam</strong>.  It may, however, reduce the CPU burden of MT and MT-Blacklist while spam is being checked against the (ever growing) blacklist and blocked accordingly.</p>

<p><strong>Requirements:</strong></p>

<p>MT 3.1+<br />
MT-Blacklist 2.0+<br />
Apache Web Server</p>

<p><strong>Installation:</strong></p>

<p>1.  If you haven't done so already, read the 2 posts that I linked to in the previous paragraph.  This hack is not perfect, and those posts do a job explaining some of the reasons why.</p>

<p>2.  Open Submission.pm for editing, found in /mt/plugins/Blacklist/lib/Blacklist/App/.</p>

<p>3.  Look for the following line:</p>

<p><q>$message = $app-&gttranslate("MT-Blacklist comment denial on '[_1]'.&ltbr /&gtAuthor: [_2]; Email: [_3]&ltbr /&gt[_4] matched: [_5]", MT::Util::encode_html($blog-&gtname), $com_author, $com_email, $item_type, '&lta href="'.$item_url.'"&gt'.$matches-&gt[0]-&gt{item}-&gttext.'&lt/a&gt');</q></p>

<p>For me this is on line 552. After this line, add:</p>

<p><q>### AutoIPBlock<br />
my $remote_ip = $app->remote_ip;<br />
my $htaccess = ".htaccess";<br />
open(DAT,">>$htaccess") || die("Cannot Open File");<br />
print DAT "deny from $remote_ip\n"; <br />
close(DAT);<br />
###</q></p>

<p>4. A few lines lower (now on line 561), find the following line:</p>

<p><q>$message = $app-&gttranslate("MT-Blacklist comment denial on '[_1]'.&ltbr /&gtAuthor: [_2]; Email: [_3]&ltbr /&gt[_4] blacklist items matched.", MT::Util::encode_html($blog-&gtname), $com_author, $com_email, scalar(@$matches));</q></p>

<p>After this line, add:</p>

<p><q>### AutoIPBlock<br />
my $remote_ip = $app->remote_ip;<br />
my $htaccess = ".htaccess";<br />
open(DAT,">>$htaccess") || die("Cannot Open File");<br />
print DAT "deny from $remote_ip\n"; <br />
close(DAT);<br />
###</q></p>

<p>5.  Another few lines down (now at line 579), find:</p>

<p><q>$message = $app-&gttranslate("MT-Blacklist ping denial on '[_1]'.&ltbr /&gtBlog: [_2]; URL: [_3]&ltbr /&gt[_4] matched: [_5]", MT::Util::encode_html($blog-&gtname), MT::Util::encode_html($remote_blog), MT::Util::encode_html($remote_url), $item_type, '&lta href="'.$item_url.'"&gt'.$matches-&gt[0]-&gt{item}-&gttext.'&lt/a&gt');</q></p>

<p>After this line, add:</p>

<p><q>### AutoIPBlock<br />
my $remote_ip = $app->remote_ip;<br />
my $htaccess = ".htaccess";<br />
open(DAT,">>$htaccess") || die("Cannot Open File");<br />
print DAT "deny from $remote_ip\n"; <br />
close(DAT);<br />
###</q></p>

<p>6.  Another few lines down (now at line 588 ) find:</p>

<p><q>$message = $app-&gttranslate("MT-Blacklist ping denial on '[_1]'.&ltbr /&gtBlog: [_2]; URL: [_3]&ltbr /&gt[_4] blacklist items matched.", MT::Util::encode_html($blog-&gtname), MT::Util::encode_html($remote_blog), MT::Util::encode_html($remote_url), scalar(@$matches));</q></p>

<p>After this line, add:</p>

<p><q>### AutoIPBlock<br />
my $remote_ip = $app->remote_ip;<br />
my $htaccess = ".htaccess";<br />
open(DAT,">>$htaccess") || die("Cannot Open File");<br />
print DAT "deny from $remote_ip\n"; <br />
close(DAT);<br />
###</q></p>

<p>Note: Steps 3 and 4 above are for comments, and steps 5 and 6 are for trackbacks.  If you nwat to enable this hack for only comments or trackbacks, you can skip steps accordingly.</p>

<p>7.  In your 'mt' directory (directory where your mt.cgi file lives), upload a blank file with the name of '.htaccess' (note the preceding '.')</p>

<p>8.  Test it by posting a comment with a string known to be on your blacklist.  If it works, you will be banned from posting.  It will also ban your IP from accessing the MT admin area, so you need to go in via FTP and remove your IP from the .htaccess file.</p>

<p>That's it.  This is a simple, very rudimentary hack, that should only be used in mergency situations, where CPU load has become an issue due to repeated spamming by spambots.  </p>

<p>Note:  I am not an expert when in comes to CPU load and such.  I don't know how much CPU cycles are saved by this hack.  I do know that it seems to help a lot when my old server was crashing frequently due to CPU load.</p>]]></description>
<dc:subject>Home</dc:subject>
<dc:creator>Mark</dc:creator>
<dc:date>2004-12-15T13:31:04-05:00</dc:date>
</item>


<item rdf:about="http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html">
<title>MT AutoIPBlock - Reduce the Spam CPU Load</title>
<link>http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html#067426</link>
<description><![CDATA[<p>Yeah, thatâ€™s great!<br />
But as an expert for online guerrilla I tell you: You can change your IP :-)<br />
Great idea, anyway!<br />
</p>]]></description>
<dc:subject>Home</dc:subject>
<dc:creator>Guerrillahase</dc:creator>
<dc:date>2004-12-24T04:58:52-05:00</dc:date>
</item>

<item rdf:about="http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html">
<title>MT AutoIPBlock - Reduce the Spam CPU Load</title>
<link>http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html#158466</link>
<description><![CDATA[<p>You might want to try <a href="http://blog.thought-mesh.net/solidwallofcode/mt_projects/autoban.php" rel="nofollow">AutoBan</a>, which does the same thing using 3.2 junk and does not require any modifications to MT.</p>

<p>My experience is that it does reduce junk on your weblog. It doesn't stop it, but it sure cuts down many of the floods to trickles.</p>]]></description>
<dc:subject>Home</dc:subject>
<dc:creator>Annoying Old Guy</dc:creator>
<dc:date>2006-04-02T21:03:27-05:00</dc:date>
</item>

<item rdf:about="http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html">
<title>MT AutoIPBlock - Reduce the Spam CPU Load</title>
<link>http://mt-hacks.com/20041215-mt-autoipblock-reduce-the-spam-cpu-load.html#158596</link>
<description><![CDATA[<p>Thanks, AOG.</p>

<p>I saw that you mention AutoBan on ProNet, and it sounds interesting.  Since I have many, many entries, spam floods often crash my (dedicated) server.  AutoBan sounds like it might help quite a bit.  Now if you can do the same thing, but add the offending IPs to iptables (linux firewall), that would be even better, as it would spare apache completely. ;)</p>]]></description>
<dc:subject>Home</dc:subject>
<dc:creator>Stan The Caddy</dc:creator>
<dc:date>2006-04-03T12:04:52-05:00</dc:date>
</item>


</rdf:RDF>