<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Streaky's Blog &#187; ddos mitigation</title>
	<atom:link href="http://mybrokenlogic.com/tag/ddos-mitigation/feed/" rel="self" type="application/rss+xml" />
	<link>http://mybrokenlogic.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 19 Jul 2010 21:50:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Running a Pastebin&#8230;</title>
		<link>http://mybrokenlogic.com/2009/11/09/running-a-pastebin/</link>
		<comments>http://mybrokenlogic.com/2009/11/09/running-a-pastebin/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 16:25:18 +0000</pubDate>
		<dc:creator>streaky</dc:creator>
				<category><![CDATA[Paste2.org]]></category>
		<category><![CDATA[ddos mitigation]]></category>
		<category><![CDATA[high load]]></category>
		<category><![CDATA[mirroring]]></category>

		<guid isPermaLink="false">http://mybrokenlogic.com/?p=24</guid>
		<description><![CDATA[Is hard work sometimes. Paste2.org&#8217;s code is written to be fast, the problem with doing that is if I leave it alone for a day it can take large amounts of traffic that isn&#8217;t legitimate without really notifying me because the load doesn&#8217;t go high enough for the server to start alerting me that things [...]]]></description>
			<content:encoded><![CDATA[<p>Is hard work sometimes.</p>
<p>Paste2.org&#8217;s code is written to be fast, the problem with doing that is if I leave it alone for a day it can take large amounts of traffic that isn&#8217;t legitimate without really notifying me because the load doesn&#8217;t go high enough for the server to start alerting me that things are going wrong.</p>
<p>Take last night for example, I just happened to look at munin and I saw the first spike of this (the part with the big red updates block in the graph):</p>
<p><a href="http://mybrokenlogic.com/wp-content/uploads/2009/11/crawl-fail.png"><img class="alignright size-full wp-image-25" title="Fail" src="http://mybrokenlogic.com/wp-content/uploads/2009/11/crawl-fail.png" alt="Fail" width="495" height="343" /></a>This event which peaked at almost 400 queries/second (and if I tell you paste2.org hardly does any SQL queries, you&#8217;ll get why I was pretty pissed off when I noticed this), was pretty massive traffic comming from a lot of different IPs &#8211; which a lot of people would assume is a DDoS attack, I&#8217;m pretty sure is somebody trying to mirror the site.</p>
<p>If I may slide slightly off-topic for a second it&#8217;s a bit of a win for the much-hated query cache &#8211; look at the numbers of cache hits &#8211; when your MySQL server is set up right and your code is asking the right questions.</p>
<p>You&#8217;ll notice that the number of queries drops off at around midnight, this is the point when I noticed something is amiss and did something about it.</p>
<p>I have a script that scours the access log and adds the IPs it pulls out to an IPTables Chain, which, naturally, stops all inbound connections.</p>
<p>The problem is until about 5 minutes ago it was all manually ran, because in the past people have got the idea after a few rounds of that.</p>
<p>Not this time, note what happens after midnight &#8211; it slowly picks up again until it&#8217;s just as bad as it was. Now the whole thing for the last few minutes has been completely automated.</p>
<p>In case you&#8217;re wondering, whilst it&#8217;s nice having the site load tested, there&#8217;s two main issues: firstly nobody has ever asked if they can have the paste files, or told me why they want them all, and secondly &#8211; as you&#8217;ll see from the first part with all the updates, they were triggering the code which determines if they&#8217;re a robot or not and decides if they should update the last viewed date &#8211; which in turn determines when old posts should be deleted. That&#8217;s probably the worst part of people doing stuff like this &#8211; that it screws up the reliability of a system which is essentially a spam removal process. Legit posts that people need will be visited and kept, spam won&#8217;t be visited and thus get deleted after a time &#8211; all these posts are now marked as updated last night and the 95% that will be actually spam, will survive in the site for another 60 days.</p>
<p>I wonder how long it will be until these clowns get the message. Anyways, I can go back to my day job now the script is chugging away on its own.</p>
]]></content:encoded>
			<wfw:commentRss>http://mybrokenlogic.com/2009/11/09/running-a-pastebin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
