<?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; Equipment</title>
	<atom:link href="http://www.computermedic.org/?cat=3&#038;feed=rss2" 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>That&#8217;s a fine server, Anthony, a fine, fine server!</title>
		<link>http://www.computermedic.org/?p=161</link>
		<comments>http://www.computermedic.org/?p=161#comments</comments>
		<pubDate>Sun, 06 Jul 2014 23:58:21 +0000</pubDate>
		<dc:creator><![CDATA[computermedicorg]]></dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[Equipment]]></category>
		<category><![CDATA[Networks]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Status]]></category>

		<guid isPermaLink="false">http://www.computermedic.org/?p=161</guid>
		<description><![CDATA[July, 2014.  The internet is a secluded village, all controlled and terrorized by one boy&#8230; Meet Anthony, from the &#8216;It&#8217;s a Good Life&#8217; episode of The Twilight Zone (Nov. 1961).  Details over at imdb, or watch the whole episode (with modernized commercial/ad inserts) at hulu. We&#8217;ve hired Anthony, now in his 50s to do away [&#8230;]]]></description>
				<content:encoded><![CDATA[<div id="attachment_162" style="width: 210px" class="wp-caption alignright"><img class="wp-image-162 size-full" src="http://www.computermedic.org/wp-content/uploads/2014/07/tz_anthony_badman.jpg" alt="Twighlight Zone Good Life Anthony" width="200" height="161" /><p class="wp-caption-text">You&#8217;re a bad bot. I&#8217;m tired of playing with you. I&#8217;m going to make you dead now.</p></div>
<p>July, 2014.  The internet is a secluded village, all controlled and terrorized by one boy&#8230;</p>
<p>Meet Anthony, from the &#8216;It&#8217;s a Good Life&#8217; episode of The Twilight Zone (Nov. 1961).  Details over at <a title="TZ Ep 61 at IMDB" href="http://www.imdb.com/title/tt0734580/" target="_blank">imdb</a>, or watch the whole episode (with modernized commercial/ad inserts) at <a title="TZ Ep 61 at hulu" href="http://www.hulu.com/watch/440799" target="_blank">hulu</a>.</p>
<p>We&#8217;ve hired Anthony, now in his 50s to do away with spam, Zombie DNS DDoS Bots, and other such pests buzzing around and annoying or destroying everything and everyone in the internet play ground.  We should have thought of it earlier&#8230; Just <em>making bad things dead</em> or <em>wishing them into the cornfield</em>.</p>
<p>OK, not quite that easy, here&#8217;s what&#8217;s up in the fight against Spam-Nados and Zombie Bots&#8230;</p>
<p><span id="more-161"></span></p>
<p>[Thermal] Inversion Layers.  In the undersea world of submariners these separations between temperatures of water mask objects from sonar and/or, of course, thermal imaging.  What does that have to do with servers and DDoS attacks? Nothing.  Except the association is how we remember:</p>
<p>Inverse Tactics.  At some point around the Happy Holiday Season 2013-2014 (aka Christmas to normal people) a server manager woke from a horrible holiday dream &#8211; a dream of fail2ban memory leaks, dead sockets, out of memory errors and massive log files &#8211; with a vision of a less nightmarish future.  Simplicity was unmasked.  The fortune-cookie like note that comes from the bobble-head-devil fortune machine in that other episode of Twilight Zone:</p>
<p style="text-align: center;"><strong>Invert your tactics.</strong></p>
<p>Instead of trying to use fail2ban (perl/python/loosely interpreted regexs) to sift through everything and lock out the bad guys after they had been bad, and possibly then wrong because UDP sources are easily spoofed; use the &#8216;firewall&#8217; (compiled, close to the kernel, strict iptables) as a firewall.  Seems simple, use the firewall as the firewall. But that&#8217;s hind-sight.</p>
<p>So, simple, use the firewall, invert the tactics.  What does that mean?</p>
<p>It means: allow only certain things along the &#8216;port 53 chain&#8217; ~ only the domains that we truly are the authoritative host for.  And, since our little web-server is also a recursive-caching DNS server for itself and others; only do this filtration on the &#8216;net-facing&#8217; (public) adapter.  Confused? Good. Welcome to the Twilight Zone.</p>
<p>Inverted logic:<br />
&#8211; Old way: allow everything, find anything &#8216;known bad&#8217; and block that; ever growing list of &#8216;known bad&#8217; (because the bad-bot guys change what they query you to death with)<br />
&#8211; New way: allow only the domains we NS host to be allowed passed iptables to get to bind/named and furthermore to fail2ban; drop all other (not known good) DNS queries.  Yep; drop; no tarpit, no &#8216;channel[s] closed&#8217;, no loopback, no reply, no nothing, DEEeee-ROP. (Wish bad queries into the corn field.)</p>
<p>Simple. Smart. Effective.  Can&#8217;t find the notes to give credit to some very helpful websites/pages that helped us through this &#8220;seems simple (everything computer is supposed to be simple)&#8221; but was very, very complicated set of iptables rules. TODO for later: find the notes, give the credit.</p>
<p>Here&#8217;s the summary:<br />
&#8211; iptables does string matching (the * here is that iptables string matching on UDP sockets is very complicated, based on hex conversions of the strings, very strict, but very fast)<br />
&#8211; set up a new &#8216;table (chain)&#8217; and set of &#8216;RETURN&#8217; rules based on the domains we actually want to give answers to DNS queries for<br />
&#8211; set up the new &#8216;table (chain)&#8217; to default to DROP (not reject, not return) all others</p>
<p>Here&#8217;s the implementation, using the plain text matching of iptables instead of the complete domain.tld (the dots don&#8217;t translate so you have to use hex to match domain(special)tld):</p>
<pre>#!/bin/sh
#
# create the chain to drop everything we don't specifically know
if ! iptables -L netdnswash -n  &gt;/dev/null 2&gt;&amp;1 ; then
        #echo "debugging make the chain netdnswash"
        iptables -N netdnswash
fi
# flush it either way
iptables -F netdnswash
# default rule = DROP.  This is to stop trying to block badbots, only allow good stuff.
# This should also drop the '.' (single dot) query
iptables -A netdnswash -j DROP
### during build/testing return everything, watch the counters on the one-two test domains
### iptables -A netdnswash -j RETURN
# put the most common ones up top (e.g. computermedic.org since that's the name server, then down to the least busy)
# reverse order because inserts stack on top
iptables -I netdnswash -i eth1 -p udp -m udp --dport 53 -m string --algo bm --icase --to 255 --string 'mldragon' -m comment --comment "mldragon.com" -j RETURN
iptables -I netdnswash -i eth1 -p udp -m udp --dport 53 -m string --algo bm --icase --to 255 --string 'computermedic' -m comment --comment "computermedic.org always first" -j RETURN
# make sure this is first in the INPUT chain - returns to INPUT will allow fail2ban to catch crap.gooddomain.tld
# make sure that fail2ban (actions) build their rules at/after 2. More manual thinking for fail2ban (admins) but way less work
# make sure it doesn't already exists
if ! iptables -L INPUT -n | grep 'netdnswash' -c 2&gt;&amp;1 ; then
        #echo "debugging make the rule in INPUT"
        iptables -I INPUT 1 -i eth1 -p udp -m udp --dport 53 -j netdnswash
fi

</pre>
<p>Note 1: all chain creation prior to adding it to the INPUT chain rules.<br />
Note 2: only traffic on the &#8216;net-facing/public&#8217; adapter goes through here (at the bottom, &#8230;eth1&#8230;)<br />
Note 3: used inserts ( -I ) so what you want first you have to put last in the script (invert again)<br />
Note 4: once fully tested and put into operation: iptables-save &gt;/path/to/conf_file so that if the server restart iptables doesn&#8217;t have to be &#8216;re-made&#8217;.<br />
Note 5: change the fail2ban jail create/destroy commands to insert at 2, so fail2ban can be restarted without messing up the new iptables stuff.</p>
<p>Now, important, the lack of the complete domain.tld business.  If we had hundreds or thousands of Ns in our NS we would go through the trouble to use &#8216;hex string matching&#8217; to get the whole computermedic.org thing in there.  But the &#8220;less than hundreds&#8221; number of domains on this server lets us deal with the occasional bad bot playing computermedic.tld [other than org] games.  How do we deal with that?</p>
<p>fail2ban of course.  Now, much relaxed and under-loaded because no more rolling/spoofed-source DNS/DDoS querries.  Again, don&#8217;t want to tell the bad-guys how to defeat our newly created defensive systems, but suffice it to say: if you run 3 or more ddosasia.computermedic.org or www999, www998, www997 (the rolling ones we encountered) queries against the server fail2ban is going to shut you down (1st time for 2 hours, 2nd time for&#8230; drumroll&#8230; Evuh!).  First the cornfield for a reasonable timeout, then fail2bAnthony makes you dead.</p>
<p><strong>Less Spammy Inboxes version 14.7 (year.month versioning because there have been way too many versions)</strong></p>
<div id="attachment_175" style="width: 310px" class="wp-caption alignleft"><img class="size-medium wp-image-175" src="http://www.computermedic.org/wp-content/uploads/2014/07/tz_anthony_badman2-300x225.jpg" alt="TZ Anthony 2" width="300" height="225" /><p class="wp-caption-text">I hate anybody that doesn&#8217;t like me!</p></div>
<p>Now that fail2bAnthony has less DNS problems on his hands, lots of free memory and CPU cycles, has not gone to swap in at least 3 months it&#8217;s time to put fail2bAnthony on task of wishing spambots into the cornfield, and those dreaded three-headed-gophers (the guess your password bots that then use your email to send spam everywhere &#8216;authenticated&#8217;): Dead.</p>
<p>fail2ban was already working the &#8216;mail servers logfiles&#8217; to identify bad auth attempts and ban bad guys there.  However! We utilize an &#8216;Anti-Spam Relay/Filter Server&#8217; (or several) and a great many of the bad auth attempts were going to those.  A couple of new fail2ban filters and actions, done.  Send legit email if you want copies of the fail2ban files, not publishing those (x-th time: don&#8217;t give the bad-guys a &#8216;how we defend ourselves&#8217; map).  We&#8217;ll suffice it to say in this regard: had to get a few users new passwords, but &#8216;rejects&#8217;, bad server reputation points, and dictionary/rolling login attempts, junk in the mailq, against all mail systems are significantly decreased.  Will be even more decreased as time goes by because after certain re-bans, ips and whole ranges are banned for 1 year (all ports).  Cornfield, cornfield, dead.</p>
<p>A little over a year ago we said &#8216;Finally&#8230;&#8217; ( <a title="New Server" href="http://www.computermedic.org/?p=9">http://www.computermedic.org/?p=9</a> ).  Doing all of this iptables, fail2ban, named (forgot to mention above, no more spoofed/loop-back entries in named conf files because no more bad domains/tlds allowed through), mail/spam server tuning revealed a major problem in the spam filter/relay setup: SenderBase did not install last year.  &#8216;Hypothetically speaking&#8217; we could pretend that we use a certain Anti-Spam SMTP Proxy ( <a title="ASSP Sourceforge" href="http://sourceforge.net/projects/assp/" target="_blank">ASSP</a> ) and we &#8216;hypothetically&#8217; used their install/update scripts to get the thing moving.  Well, in those 12-18 days of extreme server configs and installs and the months of Zombie-Bot and DDoS-Nado wars after, the one little message in a log file seldom read about Net::SenderBase not being available was missed. Then there is the fact that ASSP &#8216;hypothetically&#8217; does not log (even if debug level logging is selected) anything about SenderBase if it was not available at startup.  Where the problem lies: in some nix distros the install/update scripts, and the howto pages, that say use MCPAN to <strong>install Net::SenderBase</strong> don&#8217;t warn you to watch the output carefully to make sure there wasn&#8217;t any error[s].  Here&#8217;s the deal, and a warning: Watch the output of install Net::SenderBase carefully!!  If there are errors (any error means no SenderBase, no filters, regex matching, country matching, scoring, based on SenderBase in ASSP, and nothing to let you know): <strong>force install Net::SenderBase</strong>.</p>
<p>Bam. Done, had to go back an re-tweak/un-tweak about 12,000 ASSP (hypothetically) settings, logs, regex-es, etc., that had been tweaked trying to figure out why so much wasn&#8217;t working, gave ASSP a full stop (/etc/init.d/assp stop), let it rest a minute, fired it back up (replace stop with start) and wah-lah! 79% blocked instead of 45-51%.  Less spammy inboxes.</p>
<p><strong>Updated wordpress to 3.9.1 today.</strong><br />
Not important but it works *great* in IE11.  Makes links correctly, which it did not.  Looks a little better.  Good job wordpress.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.computermedic.org/?feed=rss2&#038;p=161</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZombieBots Part 2 or&#8230;</title>
		<link>http://www.computermedic.org/?p=89</link>
		<comments>http://www.computermedic.org/?p=89#comments</comments>
		<pubDate>Sat, 13 Jul 2013 21:46:57 +0000</pubDate>
		<dc:creator><![CDATA[computermedicorg]]></dc:creator>
				<category><![CDATA[Equipment]]></category>
		<category><![CDATA[Networks]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Status]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[fail2ban]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[ram]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[sharknado]]></category>
		<category><![CDATA[zombie]]></category>

		<guid isPermaLink="false">http://www.computermedic.org/?p=89</guid>
		<description><![CDATA[Sharknado!  Equally exciting, terrifying, low-budget and prone to sequels. So bad it&#8217;s good movie lovers, click the link above and see if you can survive that whirlwind of bites. Server admins, stay right here and get ready for DNS-Zombie-Bots Two: More Tech-Talk and .configs Than You Can Stand!  (Or, &#8220;Bored To Death!&#8221; Or, &#8220;You can have the [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><a title="SHARKNADO at the imdb" href="http://www.imdb.com/title/tt2724064/" target="_blank">Sharknado!</a> <img class="alignright size-full wp-image-92" alt="sharknado" src="http://www.computermedic.org/wp-content/uploads/2013/07/sharknado.jpg" width="175" height="116" /></p>
<p>Equally exciting, terrifying, low-budget and prone to sequels.</p>
<p><em>So bad it&#8217;s good</em> movie lovers, click the link above and see if you can survive that whirlwind of bites.</p>
<p>Server admins, stay right here and get ready for DNS-Zombie-Bots Two: More Tech-Talk and .configs Than You Can Stand!  (Or, &#8220;Bored To Death!&#8221; Or, &#8220;You can have the whole seat, but you only need the edge!&#8221;)<span id="more-89"></span></p>
<p>Or, I had to document it so I can take it from server to server without trusting my memory, so I thought I would share.</p>
<p>It started with a &#8216;Hay Bay-Bay&#8217; &#8211; or a &#8216;clients-per-query&#8217; message.</p>
<p>Lots of tweaks, tunes, service this restart, /etc/init.d/that restart later: &#8216;clients-per-query&#8217; (increased/decreased) messages, lots of them.  (Somehow, sync&#8217;d between servers, trying to figure that BIND9 magic out would be like trying to reach into the mouth of one of those sharknado sharks and pull its heart out.  It is because it is, do the fixes you can do and worry about enigmatic synchronicity later.)</p>
<p>Here&#8217;s the setup again so when you try these things on a server with a point-zero-zero-one version difference you&#8217;ll know why it doesn&#8217;t work:<br />
~ <a href="http://www.centos.org/" target="_blank">CentOS</a> x86_64 6.4 (Installed, updated [yum update] June, 2013)<br />
~ <a href="http://www.isc.org/downloads/bind/" target="_blank">bind / named</a><br />
* <em># rndc status</em>: version: 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4<br />
* <em># yum list bind</em>: bind.x86_64 32:9.8.2-0.17.rc1.el6_4.4<br />
~ <a href="http://www.fail2ban.org" target="_blank">fail2ban</a><br />
* <em># yum list fail2ban</em>: fail2ban.noarch 0.8.8-3.el6 ( 0.8.10-1.el6 <em>available</em> )</p>
<p>Since last I wrote about it ( <a href="http://www.computermedic.org/?p=62" target="_blank">Killin Zombie Bots</a> ) some seemingly minor, but very important changes mainly to the bind/named and related conf files.<br />
<strong>/etc/resolv.conf: nameserver 127.0.0.1</strong><br />
~ all &#8216;in-server&#8217; services should ask &#8216;self&#8217; for DNS, when self doesn&#8217;t know it &#8220;recurses&#8221; (goes upstream) and caches so that for a time (cache TTLs and expirys) &#8216;self&#8217; does know the answer.<br />
<strong>/etc/named.conf</strong> (in the <em>options { }</em> block): <strong>querylog yes;</strong><br />
~ log at boot (that semi-colon &#8216;;&#8217; is very-necessary)<br />
<strong>/etc/fail2ban/jail.conf: ignoreip = 127.0.0.1/8</strong><br />
~ &#8216;confirmed&#8217; (it is the default in the [default] section) &#8211; <em>Self: don&#8217;t ban we</em>.</p>
<p style="text-align: center;"><strong><em>clients-per-query</em> groans the almost healed zombie server</strong></p>
<p>Ask the modern zombie-to-English interpreter ( <a href="http://www.google.com" target="_blank">google</a> ) what that means and the interpreter says:<br />
About 2,440,000 results  (0.33 seconds)</p>
<p>Go on an Injun vision quest and consult the shaman: <strong>add more RAM</strong>.</p>
<p>Don&#8217;t run down that 2.44-Million results rabbit hole.  Smack your head and think I should have thought of that when the light bulb turns on in there behind the sign that reads:</p>
<p>The cache of a caching DNS server on a moderate-to-heavy-load server can get quite large.</p>
<p>That&#8217;s RAM bay-bays, nothing else.  Don&#8217;t believe yourself, <strong># free</strong>. <em>@125MB of 2GB</em> left and look lower: <em>@105648[k] used Swap:</em>.  This is on the &#8216;dedicated&#8217; DNS server.  Pop-Nerd-Quiz: Going swap happens when?  Right, when &#8216;real memory&#8217; (RAM) is full.</p>
<p>Jump over to the we-have-it-no-matter-what-it-is-and-cheap shop of the new millennium ( <a href="http://www.ebay.com" target="_blank">eBay</a> ) and [Buy It Now] on 8GB of the wrong RAM for your server.  Smack your head again because everything is &#8216;the hard way&#8217; (like being the only seal in a Sharknado), put the wrong RAM up for sale and [Buy It Now-Now] on 8GB of hopefully the right RAM for your server.  When it shows up (it will be right this time!) hope that 8GBs is enough for a caching DNS server.</p>
<p>Summary: <strong>clients-per-query = add more RAM</strong>.</p>
<p>There is a nightmare-nado of other things you can try to tweak or tune or limit and shutdown -r now&#8230; or you can RAM-up and see all those Zombie-Language /var/log/ messages in your logs vanish.  If you are &#8216;flush with GB&#8217; and nothing in swap: <em>it&#8217;s 2.44 million curtains for you, tough guy (in 0.33 seconds)!</em></p>
<p style="text-align: center;"><strong>Z0mb13 t4Lk (or ID-10-T bot-writer cOdEs) and fail2ban</strong></p>
<p> 1rip, 1Rip, 1rIP, and so-on.  case-insensitive, or ignore-case. Sounds so easy.  So you try a little (?i) and a little \/\.IhateRegEx (interpreted through .py and other things depending on revision or build number) and pretty soon you are standing in the eye of a shark-icane with your <a href="http://www.imdb.com/title/tt0058331/" target="_blank">Mary Poppins </a>umbrella waiting for the winds to take you to a hopefully quick and not too painful shark-shutdown (in the air).</p>
<p>begin here (/etc/fail2ban/filter.d dir):<br />
[root@server filter.d]# cp named-flood.conf named-ignoretest.conf<br />
[root@server filter.d]# vim named-ignoretest.conf</p>
<p>It has now (sorry for the wordpress word-wrap):</p>
<pre>failregex = .* named\[.*\]: client &lt;HOST&gt;\#.*: query: (1rip\.com|isc\.org|\.) (IN|ANY) *</pre>
<p>Based on the only search result that made sense ( <a href="https://github.com/fail2ban/fail2ban/issues/48" target="_blank">https://github.com/fail2ban/fail2ban/issues/48</a> ) and ( <a href="http://www.tutorialspoint.com/python/python_reg_expressions.htm">http://www.tutorialspoint.com/python/python_reg_expressions.htm</a> ) [and about 100 trial-with-error failures] change it to:</p>
<pre> failregex = .* named\[.*\]: client &lt;HOST&gt;\#.*: query: ((?i)1rip|1rip\.com|isc\.org|\.) (IN|ANY) *</pre>
<p>The important thing here (besides this is not tested against any other versions): <strong>((?i)[pipe separated list])</strong>.  The &#8216;ignore-case&#8217; <strong>(?i)</strong> toggle is working on all of the entries in the <strong>[pipe separated list]</strong>.  Another thing: I didn&#8217;t test and don&#8217;t care if the case-insensitive compare carries over to the <strong>(IN|ANY)</strong>.</p>
<p>Because the only &#8216;spoof&#8217; in there is 1rip.com (now case does not matter) some of those isc.org queries are still getting answered, and the (space)1rip(space) [1rip without a domain extension] are still doing <em>something</em> (as yet unknown) to the cache and the upstream.  What is known about those is that they are now successfully triggering fail2ban to shut those servers/ips down after a couple of hits and send the rest of their millions of attempts to &gt;dev/null.</p>
<p>Doing packet/byte count watches ( <strong>#iptables -n -L -v &#8211;line-numbers</strong> ) reveals that once &#8216;dumped&#8217; into the &#8216;fail2ban filter table&#8217; the bad-zombie-bots (flooding w/requrests) are &#8216;dropping&#8217; many hundreds of thousands of requests (packets) and GBs of data per hour.</p>
<pre>2    3000K  864M fail2ban-dnsflood    all  -- *  *   0.0.0.0/0   0.0.0.0/0
3    1829K  792M fail2ban-maillogins  all  -- *  *   0.0.0.0/0   0.0.0.0/0</pre>
<p>&#8220;It&#8217;s only&#8221; 72MB (@10% by bytes), but fully 39% of all packet-traffic being killed by this fail2ban zombie-net &#8211; <em>on this one particular server</em>.  Not sure how to &#8216;math it out&#8217; but it is also a server-unload because that many (1171K = 1.2-Million) queries/requests are not being cache-pulled or sent upstream &#8211; <em>on this one particular server</em>.  (iptables numbers above were reset 60 minutes previous)</p>
<p style="text-align: center;"><strong>Slowly I turned, step by step, inch by inch</strong><br />
<strong>(shark by shark twisting in the wind)</strong></p>
<p>I ran off on a statistics tangent and never completed the fail2ban new-regex howto.</p>
<p>The new-est /etc/fail2ban/filter.d/named-flood.conf needs to be up-to-dated:<br />
<strong># vim /etc/fail2ban/filter.d/named-flood.conf</strong></p>
<pre>[Definition]
failregex = .* named\[.*\]: client &lt;HOST&gt;\#.*: query: ((?i)1rip|1rip\.com|isc\.org|\.) (IN|ANY) *
ignoreregex =</pre>
<p><strong>:wq</strong> (write and quit)</p>
<p>Make a test file:<br />
<strong>#vim /tmp/testfile.txt (press insert when it &#8216;loads: New File&#8217;)</strong></p>
<pre>Jul 11 05:40:22 server named[1301]: client 1.1.1.1#1: query: 1rip IN ANY +E ([ip of server])
Jul 11 05:40:22 server named[1301]: client 2.2.2.2#2: query: 1rip IN ANY +E ([ip of server])
Jul 11 05:40:23 server named[1301]: client 3.3.3.3#3: query: 1Rip IN ANY +E ([ip of server])
Jul 11 05:40:23 server named[1301]: client 4.4.4.4#4: query: 1rIp IN ANY +E ([ip of server])
Jul 11 05:40:24 server named[1301]: client 5.5.5.5#5: query: 1riP IN ANY +E ([ip of server])
Jul 11 05:40:24 server named[1301]: client 6.6.6.6#6: query: 1rip IN ANY +E ([ip of server])
Jul 11 05:40:24 server named[1301]: client 7.7.7.7#7: query: 1rip.com IN ANY +E ([ip of server])
Jul 11 05:40:24 server named[1301]: client 8.8.8.8#8: query: 1rIp.com IN ANY +E ([ip of server])
Jul 11 05:40:24 server named[1301]: client 9.9.9.9#9: query: linenine.com IN ANY +E ([ip of server])</pre>
<p><strong>:wq</strong> (write and quit)</p>
<p><strong>[root@server filter.d]# fail2ban-regex /tmp/testfile.txt named-flood.conf</strong></p>
<p>Should get 8 &#8220;number of match&#8221;</p>
<p>Compare to grep-ing (note the spaces and escaped .s inside the single quotes)<br />
grep -c -i &#8216; 1rip &#8216; /tmp/testfile.txt : 6<br />
grep -c -i &#8216; 1rip\.com &#8216;  /tmp/testfile.txt : 2<br />
grep -c -i &#8216; \. &#8216;  /tmp/testfile.txt : 0<br />
grep -c -i &#8216; isc\.org &#8216;  /tmp/testfile.txt : 0</p>
<p>Test and compare against the real thing:</p>
<p>Make a working copy:<strong><br />
[root@server filter.d]# cp /var/log/messages /tmp/x.txt</strong></p>
<p><strong>[root@server filter.d]# fail2ban-regex /tmp/x.txt named-flood.conf<br />
</strong>Takes a while on this server, then:<br />
<strong>Success, the total number of match is 106225</strong></p>
<p>Compare to grep-ing (note the spaces and escaped .s inside the single quotes)<br />
grep -c -i &#8216; 1rip &#8216; /tmp/x.txt : 81034<br />
grep -c -i &#8216; 1rip\.com &#8216;  /tmp/x.txt : 2977<br />
grep -c -i &#8216; \. &#8216;  /tmp/x.txt : 15917<br />
grep -c -i &#8216; isc\.org &#8216;  /tmp/x.txt : 6297<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; <strong>106225</strong> all added together</p>
<p>Sure looks like this is working, rm all those test files in /tmp/, then:</p>
<p># /etc/init.d/fail2ban restart</p>
<p>Because of the amount of sharks in this nado, you might (we have to) manually block some ip&#8217;s while fail2ban gets back in the race.  Once fail2ban is all caught up and ready to go up against the whirlwind of feeding-frenzied zombie-shark-bots, manually release those and let fail2ban do its thing.</p>
<p>One last piece of housekeeping in this bad movie: reset the counters.<br />
<strong>#iptables -Z</strong></p>
<p>About one minute later, late one Saturday afternoon:</p>
<pre><span style="color: #666666; font-family: Consolas;">num   pkts   bytes    target (rest snipped)
</span>1     2059    175K    fail2ban-dnsflood
2      352   66583    fail2ban-maillogins</pre>
<p>A whopping 17% of packet-traffic is NOT a DNS-DDoS-Flood packet.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.computermedic.org/?feed=rss2&#038;p=89</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>6.18.2013 Finally&#8230;</title>
		<link>http://www.computermedic.org/?p=9</link>
		<comments>http://www.computermedic.org/?p=9#comments</comments>
		<pubDate>Wed, 19 Jun 2013 01:30:43 +0000</pubDate>
		<dc:creator><![CDATA[computermedicorg]]></dc:creator>
				<category><![CDATA[Equipment]]></category>
		<category><![CDATA[Status]]></category>
		<category><![CDATA[equipment]]></category>
		<category><![CDATA[hard drive]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[operating system]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.computermedic.org/?p=9</guid>
		<description><![CDATA[Dear Diary: June 6, 2013: need a new website for a customer.  &#8220;Let&#8217;s do wordpress!&#8221;  Boom #1: wordpress needs newer php. June 6-8, 2013: Thinking, discussing, planning regarding: in-place updates never work.  &#8220;Just setup a new server all up to date and ready for wordpress.&#8221; June 9, 2013: Smart I.T. peoples backup on Sunday, run [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><em>Dear Diary:</em></p>
<p><strong>June 6, 2013:</strong> need a new website for a customer.  &#8220;Let&#8217;s do wordpress!&#8221;  Boom #1: wordpress needs newer php.</p>
<p><strong>June 6-8, 2013:</strong> Thinking, discussing, planning regarding: in-place updates never work.  &#8220;Just setup a new server all up to date and ready for wordpress.&#8221;</p>
<p><strong>June 9, 2013:</strong> Smart I.T. peoples backup on Sunday, run a full system backup&#8230; Boom #2: backup hard drives marked &#8220;read only&#8221; (usually means damage or imminent failure).</p>
<p><strong>June 9-16, 2013:</strong> 2 new (rebuild one, fire up and build the &#8220;backup equipment&#8221; been sitting idle since 2008 waiting for catastrophe) servers to dish DNS, one will be &#8220;live&#8221; server, one is a fall-back/backup.</p>
<p><strong>June 9-16, 2013:</strong> The endless cascade of computer junk.  One thing leads to one more thing that reveals that other problem and so-on and so-on.</p>
<p><strong>June 16, 2013 11:00PM:</strong> everything transferred from 3 servers onto/into the new pair.  Shutdown (shutdown -h now) &#8220;ninesix&#8221; (online since 1.2010) and &#8220;isp1100&#8243; (since 2006?? 2005?? earlier??).  Unplug this, plug in that, check this check that&#8230; &#8220;Tomorrow, let&#8217;s do wordpress!&#8221;</p>
<p><strong>June 17, 2013:</strong> Boom #3.  bind (DNS Server) SERVFAIL.  Zone file for MLD Computers ( mldragon.com, how cool is that ) marked with .err extension, all &#8216;other&#8217; domains working (sort of), but DNS errors for one cause DNS errors for many.  Finally got passed bind/DNS problems (delete the zones and re-create is the hind-sight how-to).  ns3 DNS ports lost in the shuffle (they say forwarding and accepted, poof no reply).</p>
<p><strong>June 17, 2013:</strong> Boom #4.  Lots of &#8220;little fixes&#8221; needed to make sites work/look like they used to.  All new server os and hosting software should not be mixed with all old web design.</p>
<p><strong>June 18, 2013: Finally&#8230;</strong><br />
All of this and that and the others settled down enough: &#8220;Let&#8217;s do wordpress!&#8221;</p>
<p>So, testing it out here before trying on the customer site that started this &#8216;mess&#8217; 12 days ago.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.computermedic.org/?feed=rss2&#038;p=9</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
