<?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>ComputerMedic (dotOrg) Web Servers &#187; rate</title>
	<atom:link href="http://www.computermedic.org/?feed=rss2&#038;tag=rate" rel="self" type="application/rss+xml" />
	<link>http://www.computermedic.org</link>
	<description>MLD Computers &#124; Computer Medic &#124; beagle host</description>
	<lastBuildDate>Fri, 22 Jul 2016 20:26:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.35</generator>
	<item>
		<title>Serious fail2ban!</title>
		<link>http://www.computermedic.org/?p=116</link>
		<comments>http://www.computermedic.org/?p=116#comments</comments>
		<pubDate>Tue, 13 Aug 2013 17:20:56 +0000</pubDate>
		<dc:creator><![CDATA[computermedicorg]]></dc:creator>
				<category><![CDATA[Networks]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Status]]></category>
		<category><![CDATA[already banned]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[conf]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[ddos]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[fail2ban]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[named]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[network security]]></category>
		<category><![CDATA[rate]]></category>
		<category><![CDATA[rate limit]]></category>
		<category><![CDATA[rsyslog]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[syslog]]></category>
		<category><![CDATA[system administration]]></category>
		<category><![CDATA[zombie]]></category>

		<guid isPermaLink="false">http://www.computermedic.org/?p=116</guid>
		<description><![CDATA[It reminds me of a level of Serious Sam &#8211; the one where 1,000s of those headless bomb-toting zombie-soldiers and screamers came pouring at you relentlessly, seemingly to infinity (and beyond). It was a backdraft. Or the eye of the Zombie-Nado-Cane. When the bad-bots got some air around August 5th &#8211; hak4umz.net DDoS or DNS Amplification [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-117" alt="Serious Sam Box Art" src="http://www.computermedic.org/wp-content/uploads/2013/08/SeriousSamBoxArt.jpg" width="300" height="339" />It reminds me of a level of <a title="Croteam - Serious Sam Games" href="http://croteam.com/" target="_blank">Serious Sam</a> &#8211; the one where 1,000s of those headless bomb-toting zombie-soldiers and screamers came pouring at you relentlessly, seemingly to infinity (and beyond).</p>
<p>It was a <a title="Backdraft Post" href="http://www.computermedic.org/?p=107">backdraft</a>. Or the eye of the Zombie-Nado-Cane. When the bad-bots got some air around August 5th &#8211; hak4umz.net DDoS or DNS Amplification &#8211; fail2ban (and the servers) got burned.</p>
<p>Even the &#8220;eye-dee-keff-kuh-may&#8221; (TammyBelle&#8217;s God Mode Code for DOOM][ ) cheat didn&#8217;t help.  fail2ban got clobbered&#8230; &#8216;already banned&#8217; every one second in the log and no more bans happening because 100s or 1000s of times per second from 100s or thousands of bots: bad requests.</p>
<p><span id="more-116"></span></p>
<p>Here is the <em><strong>Serious!</strong></em> problem when you put the fail2ban -vs- the entire globe death match together:</p>
<pre>2013-08-13 12:40:37,730 fail2ban.actions: INFO   [named-flood] &lt;ip&gt; already banned
2013-08-13 12:40:38,732 fail2ban.actions: INFO   [named-flood] &lt;ip&gt; already banned</pre>
<p>almost exactly one second apart, hundreds of times, and no new banning going on.<br />
Q: Why?<br />
A: fail2ban appears to have a &#8220;one second pulse/parse&#8221; clock built in to it.</p>
<p>Q: So?<br />
A: So, when 4,000 log entries appear in a log that fail2ban is reading within that one second, fail2ban &#8216;queues&#8217; (or spools or fifo&#8217;s) those 4,000 entries into an internal list and tries to de-queue them one-per-second.</p>
<p>Easier math: (&#8220;let&#8217;s say&#8221;) there are 10 &#8216;fail regex&#8217; entries pouring into your log per second. Trying to de-queue the messages from the first second takes fail2ban 9 seconds.  By the time it gets done, there are 90 more messages/fails waiting.  So every second that goes by (in this low number scenario) the problem gets 10-to-the-10th-power worse.  The problem being fail2ban over-run by those headless bomb-toting zombies.  The &#8220;real world&#8221; explanation: fail2ban lags out and becomes combat ineffective.  In cop-talk the radio call from Officer fail2ban would be: &#8220;Extended&#8221;</p>
<p>Now, a &#8220;server admin&#8221; must consider &#8211; besides &#8216;shutdown -h now&#8217; &#8211; is there a solution to the problem? First part of that: what &#8211; <em>exactly</em> &#8211; is the problem.  More Q/A (logic/reasoning):<br />
Q: Problem?<br />
A: fail2ban says &#8216;already banned&#8217; and is &#8216;lagged out'; can&#8217;t fight the good fight.</p>
<p>Q: Why?<br />
A: Too many log entries per second.  fail2ban reads logs and &#8216;actions&#8217; based on log entries.</p>
<p>Q: So, why don&#8217;t you server admins just limit the number of log entries? (Instead of trying to hyper-tune fail2ban, just give it less to do? Remember the old-old server used to say &#8216;&#8230;the previous message repeated ### times&#8230;&#8217;)<br />
A: Why didn&#8217;t I think of that.</p>
<p>The old-old server was a Gentoo box dragged across the millennium boundary by makes and make-installs.  It finally wore out (it still runs, it was just retired because it had done it&#8217;s duty) this year.  A little searching about &#8216;the previous message repeated&#8217; and was reminded that <em>that</em> is called: rate-limit-ing.  A modern Centos-6-x86_64 install (not a bunch of custom compiled stuff on a 32-bit Gentoo) uses an &#8216;out of the box&#8217; rsyslog and doesn&#8217;t say things like &#8216;&#8230;the previous message&#8230;&#8217;  The new stuff says:<br />
imuxsock begins to drop messages from pid 1228 due to rate-limiting</p>
<p>Very little more searching finds:<br />
<a href="http://www.rsyslog.com/tag/rate-limiting/">http://www.rsyslog.com/tag/rate-limiting/</a></p>
<p>The docs are a &#8216;little dated&#8217; (2010) but the essentials are there to solve the problem (problem being &#8216;too many log entries for poor old fail2ban&#8217;).</p>
<p><strong>vim /etc/rsyslog.conf</strong> (and add as the 2nd and 3rd uncommented lines):</p>
<pre>#### 8.12.13 - try to slow the message floods so fail2ban won't die so much ####
$SystemLogRateLimitInterval 1
$SystemLogRateLimitBurst 5</pre>
<p>[Esc]:wq (write and quit)</p>
<p>Now do a <strong>/etc/init.d/rsyslog restart</strong> or <strong>service rsyslog restart</strong> (<em>reload</em> does not work, I tried it) and&#8230;</p>
<p>Tah-dah!  fail2ban can keep up with the log.  Some of the abusers (firey screaming zombies with tater-bombs) get by for a few seconds until the rate-limit/fail2ban get Serious!; but, real-world they were getting by by the hundres-of-thousands before this fix (while poor old fail2ban was over-run or lag-back-buffered).</p>
<p>It may not be &#8216;iddqd&#8217; (god/degreelessness mode in &#8216;that other great fps&#8217;), but $SystemLogRateLimitInterval/$SystemLogRateLimitBurst is very close to TammyBelle&#8217;s &#8220;eye-dee-keff-kuh-may&#8221; (megaarmor, weapons and keys) for fail2ban.</p>
<p>Almost as good as Tangy-Bells for break-shishst.<br />
Very happy, ammo added.</p>
<p>*** A minor success/victory ***<br />
49 hours later&#8230; fail2ban chugging along ban/unban-ing, much smaller log files, no other services lagged out because of the packet attacks on port 53&#8230;.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.computermedic.org/?feed=rss2&#038;p=116</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
