<?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; memory</title>
	<atom:link href="http://www.computermedic.org/?feed=rss2&#038;tag=memory" 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>WordPress Woes Here in 2016</title>
		<link>http://www.computermedic.org/?p=244</link>
		<comments>http://www.computermedic.org/?p=244#comments</comments>
		<pubDate>Mon, 09 May 2016 01:06:00 +0000</pubDate>
		<dc:creator><![CDATA[computermedicorg]]></dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[Web Server]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[conf]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[equipment]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[operating system]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[system administration]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.computermedic.org/?p=244</guid>
		<description><![CDATA[Old (-ish) server equipment, old (very, no ish about it) PHP v5.3.xx and WordPress version 4.xx don&#8217;t work together.  Period.  Don&#8217;t believe us, net search for &#8220;wordpress image upload error&#8221;.  You&#8217;ll see.  Google says right now: About 1,310,000 results (0.59 seconds) This is not a new thing, it has been going on for years since [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Old (-ish) server equipment, old (very, no ish about it) PHP v5.3.xx and WordPress version 4.xx don&#8217;t work together.  Period.  Don&#8217;t believe us, net search for &#8220;wordpress image upload error&#8221;.  You&#8217;ll see.  Google says right now: About 1,310,000 results (0.59 seconds)</p>
<p><span id="more-244"></span>This is not a new thing, it has been going on for years since WordPress versions in the middle 3.xx-es.  It&#8217;s not a WordPress &#8220;bug&#8221; &#8211; it&#8217;s because PHP v5.3.xx went End Of Life almost 2 years ago (on 14 Aug 2014 &#8211; see: <a href="http://php.net/eol.php" target="_blank">http://php.net/eol.php</a> ).  And, see: <a href="https://wordpress.org/support/topic/wp-35-is-not-compatible-with-php-53-please-read" target="_blank">https://wordpress.org/support/topic/wp-35-is-not-compatible-with-php-53-please-read</a></p>
<p>Now, here&#8217;s the deal.  Computers are [supposedly] cheap these days.  Supposedly.  So, [supposedly] you just buy some awesome new quad-this-or-that x64 with at least 128GB RAM and some number of TBs of storage to&#8230; host your 20-30 MB WordPress sites.  Because images, that&#8217;s why.  Oh yeah, then manually migrate 100 or so websites, databases, all the associated &#8220;stuff&#8221; and spend &#8220;a few minutes each&#8221; changing all of the myriad of things you had to do to those sites and config files to make it work a couple-few years ago.</p>
<p>Or: keep what you&#8217;ve got and deal with it until the new V-Lab-Super-Box is online and your &#8220;team&#8221; starts pushing things around in their spare time.  Right.</p>
<p>If you did google-bar the above image issue you&#8217;ll have discovered that it has gotten progressively worse the more versions away from good olde EOL PHP 5.3.xx WordPress has gotten.  We experienced this.  This page is being written in WordPress 4.2.8, the site that went to pot today auto-magic-ly updated itself to 4.5.2.  That site was having dreaded the &#8220;http Error&#8221; problem with images for over a year.  Now, today, kaput!  No images, no PDFs, no nothing through the [Add Media] [Upload] section.  We finally got a PDF to upload and link in a page by angrily clicking refresh and doing the same thing over and over (Add media, library, upload&#8230; select&#8230; repeat).  Once upon a time we could size images to &#8220;web friendly&#8221; sizes and do the Angry-Repeat click-ery &#8211; no more.  Kaput!</p>
<p>&#8220;Well,&#8221; says google-bar, &#8220;didn&#8217;t you know about the Media From FTP plugin?&#8221;  <a href="https://wordpress.org/plugins/media-from-ftp/" target="_blank">https://wordpress.org/plugins/media-from-ftp/</a>  &#8220;No,&#8221; says us.  So, we give it a try and when you click [Activate] it happily tells you:  Only works with PHP version 5.4 or higher.</p>
<p>Then it happened, just before give-up-time, because: (1) had already uploaded via ftp the problem image; (2) had looked at the [Insert From URL] button hundreds of times today.  [Insert From Url] clicked, http://domainname.com/wp-content/uploads/2016/05/PictureName.jpg&#8230;  BAM! Done.</p>
<p>Now it doesn&#8217;t show up in the Library but it shows up in the page &#8211; and in Edit mode there&#8217;s the alignment stuff, room for a title and a caption, and the ability to make it a link to itself (full sized).  The only hang-up: it inserts the image with width and height set to it&#8217;s &#8220;real&#8221; values (giant in this case).  Last trick, get some server-side resizing done (on the fly stuff) and&#8230;  BAM! Done.</p>
<p>So, at long last, here is the long way around work-around for Great New WordPress on Great Olde Server[s] with incompatible PHP (and other things) versions.</p>
<ul>
<li>ftp upload your image (keep the WordPress method of folder naming in case you ever &#8220;migrate&#8221; the site to Great New Server[s])</li>
<li>In the page or post: [Add Media] and [Insert From URL]</li>
<li>In the page or post: [Edit] the image, make it a link to itself, add a caption, title and alignment if you wish.</li>
<li>[Preview changes] and use whatever you use to see the on-screen height-width numbers you need to stop the server from sending the full-sized image to that thumbnail-sized box.  (We did Print-Screen, Paint, Select on a Windows computer.)</li>
<li>Switch your WordPress Editor to [Text] (underlying HTML) and change the width and height properties of your IMG tag.  (We changed &#8211; width=&#8221;2592&#8243; height=&#8221;1944&#8243; &#8211; to &#8211; width=&#8221;662&#8243; height=&#8221;496&#8243;.)</li>
</ul>
<p>Finally, [Save] the page or post, and go shake that piggy-bank and see about that new high-speed quad or oct thing with all the latest of everything (including PHP).  Test runs on many devices and browsers: invisible server-side image resize and send (thanks, Apache) and post complete.  Not very &#8220;reflexive&#8221; but &#8220;good enough&#8221; for now.</p>
<p>Now that that is taken care of&#8230; a test&#8230; of WordPress 4.2.8</p>
<div id="attachment_246" style="width: 310px" class="wp-caption aligncenter"><a href="http://www.computermedic.org/wp-content/uploads/2016/05/IMG5368.jpg"><img class="wp-image-246 size-medium" src="http://www.computermedic.org/wp-content/uploads/2016/05/IMG5368-300x225.jpg" alt="IMG5368" width="300" height="225" /></a><p class="wp-caption-text">This file would not upload.</p></div>
<p>Above: try again, pig headed try again, try again&#8230; error, error, long slow progress bar &#8211; worked !  Not worth the trouble.</p>
<p>Last notes and link:  Thanks to WordPress ( <a href="http://www.wordpress.org" target="_blank">http://www.wordpress.org</a> ) for not updating us to death.  The new Quad is actually in place and in QA Testing mode &#8211; but, migration is not going to happen until a lot more testing is done.  Known bugs are better than unknown ones.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.computermedic.org/?feed=rss2&#038;p=244</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>
	</channel>
</rss>
