<?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>systemBash &#187; System Administration</title>
	<atom:link href="http://systembash.com/tags/system-administration/feed/" rel="self" type="application/rss+xml" />
	<link>http://systembash.com</link>
	<description>Technology and System Administration</description>
	<lastBuildDate>Sat, 12 May 2012 13:13:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Simple Disk Benchmarking in Linux Using &#8216;dd&#8217;</title>
		<link>http://systembash.com/content/simple-disk-benchmarking-in-linux-using-dd/</link>
		<comments>http://systembash.com/content/simple-disk-benchmarking-in-linux-using-dd/#comments</comments>
		<pubDate>Wed, 21 Mar 2012 18:23:03 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[benchmarking]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=1256</guid>
		<description><![CDATA[A great way to do a real-world disk test on your linux system is with a program called dd. dd stands for data description and is used for copying data sources. A simple command to do real-world disk write test in linux is: 1dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync This creates a file named &#8216;test&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>A great way to do a real-world disk test on your linux system is with a program called dd.</p>
<p>dd stands for data description and is used for copying data sources. </p>
<p>A simple command to do real-world disk write test in linux is:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync</div></td></tr></tbody></table></div>
<p>This creates a file named &#8216;test&#8217; with all zeroes in it. The flag conv=fdatasync tells dd to sync the write to disk before it exits. Without this flag, dd will perform the write but some of it will remain in memory, not giving you an accurate picture of the true write performance of the disk. </p>
<p>A sample of the run is below, with a simple SATA disk:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[14:11][root@server:~]$ dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync<br />
512+0 records in<br />
512+0 records out<br />
536870912 bytes (537 MB) copied, 5.19611 s, 103 MB/s</div></td></tr></tbody></table></div>
<p>Now, there is a major caveat for using dd for disk benchmarking. The first is that it only tests filesystem access. Depending on your filesystem (I&#8217;m looking at your <a href="http://en.wikipedia.org/wiki/ZFS">ZFS</a>) the file write may itself just load into memory for writing later down the road. The same with a RAID controller on the system. </p>
<p>A <em>much more accurate</em> way of performing a disk benchmark is to use tools specifically geared towards this task. It will write much more data over a longer period of time. <a href="http://www.coker.com.au/bonnie++/">Bonnie++</a> is a particularly useful tool for this purpose. </p>
<p>Now don&#8217;t forget to remove that test file. </p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/simple-disk-benchmarking-in-linux-using-dd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Easy CIDR Cheatsheet</title>
		<link>http://systembash.com/content/cidr-cheatsheet/</link>
		<comments>http://systembash.com/content/cidr-cheatsheet/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 14:38:50 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Configurations]]></category>
		<category><![CDATA[Other Code]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[cheatsheet]]></category>
		<category><![CDATA[cidr]]></category>
		<category><![CDATA[Classless Inter-Domain Routing]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=1202</guid>
		<description><![CDATA[Even though I've been working with <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a> (henceforth known as CIDR) for years now, I always need a bit up a help remember how many addresses are in each block and how many sub-blocks fit into larger blocks. I have the following printed out for easy reference, and here it is for your geeky enjoyment:

<pre>CIDR        Total number    Network             Description:
Notation:   of addresses:   Mask:
--------------------------------------------------------------
/0          4,294,967,296   0.0.0.0             Every Address
/1          2,147,483,648   128.0.0.0           128 /8 nets
/2          1,073,741,824   192.0.0.0           64 /8 nets
/3          536,870,912     224.0.0.0           32 /8 nets
/4          268,435,456     240.0.0.0           16 /8 nets
/5          134,217,728     248.0.0.0           8 /8 nets
/6          67,108,864      252.0.0.0           4 /8 nets
/7          33,554,432      254.0.0.0           2 /8 nets
/8          16,777,214      255.0.0.0           1 /8 net (Class A)
--------------------------------------------------------------
/9          8,388,608       255.128.0.0         128 /16 nets
/10         4,194,304       255.192.0.0         64 /16 nets
/11         2,097,152       255.224.0.0         32 /16 nets
/12         1,048,576       255.240.0.0         16 /16 nets
/13         524,288         255.248.0.0         8 /16 nets
/14         262,144         255.252.0.0         4 /16 nets
/15         131.072         255.254.0.0         2 /16 nets
/16         65,536          255.255.0.0         1 /16 (Class B)
--------------------------------------------------------------
/17         32,768          255.255.128.0       128 /24 nets
/19         16,384          255.255.192.0       64 /24 nets
/19         8,192           255.255.224.0       32 /24 nets
/20         4,096           255.255.240.0       16 /24 nets
/21         2,048           255.255.248.0       8 /24 nets
/22         1,024           255.255.252.0       4 /24 nets
/23         512             255.255.254.0       2 /24 nets
/24         256             255.255.255.0       1 /24 (Class C)
--------------------------------------------------------------
/25         128             255.255.255.128     Half of a /24
/26         64              255.255.255.192     Fourth of a /24
/27         32              255.255.255.224     Eighth of a /24
/28         16              255.255.255.240     1/16th of a /24
/29         8               255.255.255.248     5 Usable addresses
/30         4               255.255.255.252     1 Usable address
/31         2               255.255.255.254     Unusable
/32         1               255.255.255.255     Single host
--------------------------------------------------------------
Reserved Space:
	0.0.0.0/8	
	127.0.0.0/8
	192.0.2.0/24
	10.0.0.0/8
	172.16.0.0/12
	192.168.0.0/16
	169.254.0.0/16</pre>]]></description>
			<content:encoded><![CDATA[<p>Even though I&#8217;ve been working with <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a> (henceforth known as CIDR) for years now, I always need a bit up a help remember how many addresses are in each block and how many sub-blocks fit into larger blocks. I have the following printed out for easy reference, and here it is for your geeky enjoyment:</p>
<pre>CIDR        Total number    Network             Description:
Notation:   of addresses:   Mask:
--------------------------------------------------------------
/0          4,294,967,296   0.0.0.0             Every Address
/1          2,147,483,648   128.0.0.0           128 /8 nets
/2          1,073,741,824   192.0.0.0           64 /8 nets
/3          536,870,912     224.0.0.0           32 /8 nets
/4          268,435,456     240.0.0.0           16 /8 nets
/5          134,217,728     248.0.0.0           8 /8 nets
/6          67,108,864      252.0.0.0           4 /8 nets
/7          33,554,432      254.0.0.0           2 /8 nets
/8          16,777,214      255.0.0.0           1 /8 net (Class A)
--------------------------------------------------------------
/9          8,388,608       255.128.0.0         128 /16 nets
/10         4,194,304       255.192.0.0         64 /16 nets
/11         2,097,152       255.224.0.0         32 /16 nets
/12         1,048,576       255.240.0.0         16 /16 nets
/13         524,288         255.248.0.0         8 /16 nets
/14         262,144         255.252.0.0         4 /16 nets
/15         131.072         255.254.0.0         2 /16 nets
/16         65,536          255.255.0.0         1 /16 (Class B)
--------------------------------------------------------------
/17         32,768          255.255.128.0       128 /24 nets
/19         16,384          255.255.192.0       64 /24 nets
/19         8,192           255.255.224.0       32 /24 nets
/20         4,096           255.255.240.0       16 /24 nets
/21         2,048           255.255.248.0       8 /24 nets
/22         1,024           255.255.252.0       4 /24 nets
/23         512             255.255.254.0       2 /24 nets
/24         256             255.255.255.0       1 /24 (Class C)
--------------------------------------------------------------
/25         128             255.255.255.128     Half of a /24
/26         64              255.255.255.192     Fourth of a /24
/27         32              255.255.255.224     Eighth of a /24
/28         16              255.255.255.240     1/16th of a /24
/29         8               255.255.255.248     5 Usable addresses
/30         4               255.255.255.252     1 Usable address
/31         2               255.255.255.254     Unusable
/32         1               255.255.255.255     Single host
--------------------------------------------------------------
Reserved Space:
	0.0.0.0/8
	127.0.0.0/8
	192.0.2.0/24
	10.0.0.0/8
	172.16.0.0/12
	192.168.0.0/16
	169.254.0.0/16</pre>
<p>Of course I&#8217;m not the first one to come up with this. Modified based on the cheat sheet from <a href="http://old.tamasrepus.hotnudiegirls.com/pages/IPv4+CIDR+notation+cheat+sheet">Samat Jain</a>. </p>
<p>Let me know if you have any improvements or suggestions. </p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/cidr-cheatsheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Dirty Little Secret About SSL Certificates</title>
		<link>http://systembash.com/content/the-dirty-little-secret-about-ssl-certificates/</link>
		<comments>http://systembash.com/content/the-dirty-little-secret-about-ssl-certificates/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 13:13:06 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[certificate-authority]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=1009</guid>
		<description><![CDATA[The dirty little secret about SSL certificates is that:

<center><em><strong>Anyone can become a certificate authority.</strong></em></center>

The tools to become a certificate authority, and therefore to publish your own SSL certificates, is included in a wide variety of systems - chances are if you have an Ubuntu or CentOS install you already have the capability of becoming an SSL certificate authority via <a href="http://www.openssl.org/">OpenSSL</a>. ]]></description>
			<content:encoded><![CDATA[<p>The dirty little secret about SSL certificates is that:</p>
<p><center><em><strong>Anyone can become a certificate authority.</strong></em></center></p>
<p>The tools to become a certificate authority, and therefore to publish your own SSL certificates, is included in a wide variety of systems &#8211; chances are if you have an Ubuntu or CentOS install you already have the capability of becoming an SSL certificate authority via <a href="http://www.openssl.org/">OpenSSL</a>.</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">openssl genrsa -des3 -out ca.key 4096<br />
openssl req -new -x509 -days 365 -key ca.key -out ca.crt</div></td></tr></tbody></table></div>
<p>The security, and by that I mean <strong>trust</strong>, that SSL certificates provide in major modern browsers is that only certificates that are signed by a limited number of authorities are trusted. <em>Currently there are about 50 trusted certificate authorities in the world.</em> [<a href="http://en.wikipedia.org/wiki/Certificate_authorities">Wikipedia</a>] If the certificate that is presented to your browser is signed by one of those CAs, then your browser trusts that it is a legitimate certificate.</p>
<p>Unfortunately in the real world, no computer system should be assumed safe. I would presume that all of the major CAs &#8211; Thawte, Comodo, DigiNotar and others have their private key under lock stock and barrel, but simply put, no computer system is safe from intrusion. </p>
<h2>The Difference Between Encryption and Trust</h2>
<p>SSL certificates play two roles in a browsing session &#8211; encryption and trust. </p>
<p>When you visit an SSL site on the HTTPS protocol, you are encrypting your session between two places. In a typical situation, the connection between your browser and server is encrypted, therefore any party which is trying to sniff your data in-between the two endpoints can not see your data.</p>
<p>Trust also occurs when you use an SSL certificate. When you visit mail.google.com, you assume that the certificate is only held by Google and therefore the data you are actually receiving is from mail.google.com, not mail.attacker.com. </p>
<h2>The Man-In-The-Middle Attack</h2>
<p>A man in the middle attack occurs when your internet connection has been intercepted and someone is playing an active role of sniffing your data in between the two connections. When traffic is unencrypted, this is trivial in nature. When it is encrypted, for example with an SSL certificate, it becomes much more difficult. If you are not planning on modifying the data and just want to see what is occurring between the two connections, it looks something like this:</p>
<p>MITM Intercepts traffic from legitimate HTTPS server -> MITM decodes the content and then re-encodes with its own SSL certificate -> MITM passes all traffic back and forth using the fake SSL certificate on the client&#8217;s side, while using the real SSL certificate on the server side.</p>
<p>This all relies on the client&#8217;s browser accepting the SSL certificate that the MITM presents. This is why the <a href="http://www.scmagazineus.com/iran-may-be-behind-yet-another-ssl-certificate-spoof/article/210824/">recent DigiNotar false SSL certificate in Iran</a> for *.google.com is so troubling. Once you have a &#8220;legitimate&#8221; SSL certificate then a MITM can decode the data without the client even knowing. This violates both the trust and encryption aspects of SSL certificates.</p>
<h2>What is being done to protect us against MITM attacks like this?</h2>
<p>Google is using its massive number of web crawlers to <a href="http://googleonlinesecurity.blogspot.com/2011/04/improving-ssl-certificate-security.html">take inventory of all SSL certificates it finds</a>. It no doubt includes this in its search rankings as well (because if a web site bothers to get an SSL certificate, it indicates it is probably a higher value site), but it can be used to increase the security of sites as well when integrated into Chrome. <a href="http://eff.org">EFF</a> also runs the <a href="https://www.eff.org/observatory/">SSL Certificate Observatory</a> which has a similar function. The way the *.google.com certificate was discovered was that Chrome gave an error when it noticed the serial number of the certificate did not match what Google had crawled previously. This is all well and good, but it does not work in all browsers and also still allows the site to load, and I doubt a non-technically savvy person would have caught it. </p>
<p><a href="http://www.apacheweek.com/features/crl">Revocation lists</a> help to recall bad certificates, but by the time a certificate is discovered and revoked the damage has already been done. </p>
<p>The problem is that <strong>the whole CA system is flawed</strong>. Putting trust into 50 or so companies really is a disservice for end users. Let&#8217;s say the US government puts pressure on one of the CAs to issue a similar certificate. Not to mention any hacker gaining access to the CA&#8217;s root private certificate. </p>
<p>There are also some at work on a <a href="https://datatracker.ietf.org/wg/dane/charter/">SSL certificate system mixed in with DNSSEC</a> <em>[Ed note: strangely enough, their certificate is currently expired]</em>. The problem again is that the root DNS servers hold a lot of power, and traffic can be spoofed. </p>
<p><a href="http://convergence.io/">Convergence</a> is another tool from <a href="http://twitter.com/moxie__">@moxie__</a> which is currently available as a Firefox plugin. It allows you to specify trust authorities which can then tell you when a certificate is insecure. I wasn&#8217;t able to try it as I&#8217;ve upgraded to Firefox 6.0 and it wasn&#8217;t compatible, but it appears to have promise. My concern is that Joe user doesn&#8217;t have enough sense to run any security plugins that require any type of input. Any final solution to the SSL CA problem will need to be standards-based and not solved as a plugin.</p>
<h2>What Can You Do To Help</h2>
<p>Support the <a href="http://www.ietf.org/">IETF</a> and other research into alternatives to the current SSL Certificate Authority system. <a href="https://www.eff.org/deeplinks/2011/08/iranian-man-middle-attack-against-google">The SSL CA system is broke</a>, and we need a replacement ASAP if we expect to keep our connections encrypted and private. </p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/the-dirty-little-secret-about-ssl-certificates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zalman ZM-VE200 Review &#8211; You Need This External Hard Drive Enclosure</title>
		<link>http://systembash.com/content/zalman-zm-ve200-review-you-need-this-external-hard-drive-enclosure/</link>
		<comments>http://systembash.com/content/zalman-zm-ve200-review-you-need-this-external-hard-drive-enclosure/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 14:03:20 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[external-drives]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=987</guid>
		<description><![CDATA[Fellow tech friends, I have a find for you. If you have a job, or hobby, or whatever where you find yourself meddling with a bunch of .iso files, whether to boot off of them or just to access the data on them, then I have the device for you. It all started after I [...]]]></description>
			<content:encoded><![CDATA[<p>Fellow tech friends, I have a find for you. If you have a job, or hobby, or whatever where you find yourself meddling with a bunch of .iso files, whether to boot off of them or just to access the data on them, <strong>then I have the device for you</strong>.</p>
<p>It all started after I backed the <a href="http://www.kickstarter.com/">Kickstarter</a> project for the <a href="http://www.kickstarter.com/projects/elegantinvention/isostick-the-optical-drive-in-a-usb-stick">isostick</a>. Having never heard of a device before that would accept .iso images on a filesystem and then present them to the computer as a disc drive, I thought this was (and is) a pretty cool idea. </p>
<p>When browsing through the comments, I saw folks mentioning that this is just like the <a href="http://www.zalman.com/eng/product/Product_Read.asp?idx=431">Zalman ZM-VE200</a> external hard drive enclosure. So of course I decided to do some research on this newly discovered gadget.</p>
<h2>Overview</h2>
<div id="attachment_997" class="wp-caption aligncenter" style="width: 610px"><a href="http://systembash.com/wp-content/uploads/2011/08/P10205421.jpg"><img src="http://systembash.com/wp-content/uploads/2011/08/P10205421-600x450.jpg" alt="ZM-VE200 Size Comparison" title="ZM-VE200 Size Comparison" width="600" height="450" class="size-large wp-image-997" /></a><p class="wp-caption-text">Size Comparison: ZM-VE200 on Lower Left, Normal External Drive on Top, External Disc Drive on Lower Right.</p></div>
<p>The Zalman ZM-VE200 at its core is an external sata hard drive enclosure. These have been around for a long time, allowing you to put your hard drive in an external enclosure and accessing the file system via a USB port. They are <em>great</em> for when you need to transfer a large amount of data and have an internet connection which isn&#8217;t up the the task in any reasonable amount of time. </p>
<p>This external enclosure can work just like that, an external USB drive. However, Zalman has added an extra layer of functionality on the enclosure by adding additional components which <strong>add features which I frankly haven&#8217;t seen anywhere else</strong>. </p>
<h2>Zalman&#8217;s Additional Hardware Magic</h2>
<p>The additional circuitry allows you to select an ISO which is present on the drive, and load it just as if it were a DVD or CDROM on the system. This means that instead of carrying around discs to install operating systems on, you simply put the ISOs on the drive and then select the correct ISO when you boot.</p>
<div id="attachment_1001" class="wp-caption aligncenter" style="width: 610px"><a href="http://systembash.com/wp-content/uploads/2011/08/P1020538.jpg"><img src="http://systembash.com/wp-content/uploads/2011/08/P1020538-600x422.jpg" alt="" title="The Zalman ZM-VE200 Screen" width="600" height="422" class="size-large wp-image-1001" /></a><p class="wp-caption-text">The Zalman ZM-VE200 Screen</p></div>
<p>When you boot/plug in the drive you actually have 3 modes available to you. Disc, Hard Drive or Dual. With Disc, files you place in the _ISO folder on the drive will be selectable via the wheel on the side of the device. As it was shipped the drive needs to be formatted as NTFS in order to show the ISO files, however with <a href="http://www.zalman.com/Eng/Contact/Download/SoftWare_List.asp?searchType=category&#038;CATEGORY_1=CAF17&#038;CATEGORY_2=CAS56&#038;SEARCHPROD=ZM-VE200">updated firmware</a> you can actually use with FAT or NTFS.</p>
<h2>Operation</h2>
<div id="attachment_990" class="wp-caption aligncenter" style="width: 600px"><a href="http://systembash.com/wp-content/uploads/2011/08/IMG_2531.jpg"><img src="http://systembash.com/wp-content/uploads/2011/08/IMG_2531-e1314107305207.jpg" alt="" title="Hard Drive Attached" width="590" height="456" class="size-full wp-image-990" /></a><p class="wp-caption-text">Plugging in the hard drive</p></div>
<p>First thing you need to do is to install a SATA drive into the enclosure. This is pretty much a no-brainer, it only plugs in one direction. Slide the drive and circuitry back into the case and use the attached screws to secure the case to the drive/circuitboard. The screws are hidden by little rubber seals on the edge of the case.</p>
<div id="attachment_1002" class="wp-caption aligncenter" style="width: 610px"><a href="http://systembash.com/wp-content/uploads/2011/08/P1020540.jpg"><img src="http://systembash.com/wp-content/uploads/2011/08/P1020540-600x450.jpg" alt="" title="Menu Wheel" width="600" height="450" class="size-large wp-image-1002" /></a><p class="wp-caption-text">The Menu Navigation Wheel</p></div>
<p>When plugging it into the system, you interact with the drive in a few ways. The initial scroll wheel position, when powered up, determines the mode:</p>
<ul>
<li>Hold <strong>Up</strong> to enter ODD or &#8220;Disc&#8221; mode</li>
<li>Hold <strong>Center</strong> to enter Dual mode (both HDD and ODD modes)</li>
<li>Hold <strong>Down</strong> to enter HDD only mode</li>
</ul>
<div id="attachment_1003" class="wp-caption aligncenter" style="width: 610px"><a href="http://systembash.com/wp-content/uploads/2011/08/P1020541.jpg"><img src="http://systembash.com/wp-content/uploads/2011/08/P1020541-600x450.jpg" alt="" title="eSATA Port XM-VE200" width="600" height="450" class="size-large wp-image-1003" /></a><p class="wp-caption-text">eSATA Port on the ZM-VE200</p></div>
<p>An <strong>eSATA port</strong> and cable are also supplied. I did not use this mode in my testing. It requires that you still plug in the USB cable for power requirements, and I would assume you would see faster transfer rates while in eSATA mode. </p>
<p>Finally there is a <strong>small switch that enables write-protect mode</strong>. This makes it so that you won&#8217;t be able to accidentally change the data on the drive. </p>
<p>The only problem I had with the drive was when I first plugged it into my system via a USB extension cable. The drive did not even turn on, it actually just clicked a little bit. I changed USB ports and then it seemed to work fine. Also I&#8217;ve run into a situation where I plugged in the drive to a system that was off and then booted it, and the screen lit up but stayed blank. I believe this is because this drive requires more power than some USB ports can deliver, so if you have problems with it, <strong>try another USB port first</strong> to see if that fixes your problem.</p>
<p>I also had some problems occasionally mounting the ISO file, usually booting into ODD mode (hold the scroll wheel &#8220;up&#8221;) seemed to fix this problem.</p>
<h2>Final Thoughts</h2>
<p>When installing operating systems from this drive, the process is notably faster. Meaning, the transfer speed you see off of the &#8220;disc&#8221; on the drive is much faster than a normal CD or DVD drive. While there were some technical hiccups and gotchas, the drive works very well. </p>
<p><strong>This &#8220;gadget&#8221; is a must-have tool for system technicians who find themselves constantly burning ISOs to discs.</strong> My co-worker who initially made fun of my fondness for new gadgets has since said I&#8217;ll have to pry this drive from his cold, dead hands. It is so useful that I am now recommending it to all of my sysadmin friends. At $50 it is a steal and you will even make your money back because you won&#8217;t be burning so many discs. </p>
<h3><a href="http://www.zalman.com/eng/product/Product_Read.asp?idx=431">Official Zalman ZM-VE200 Product Site</a></h3>
<h3><a href="http://www.amazon.com/gp/product/B007M56JHO/ref=as_li_ss_tl?ie=UTF8&#038;tag=systembash-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B007M56JHO">Buy From Amazon</a></h3>
<p><small>(Updated Amazon link to SE product on 5/12/2012 &#8211; Thanks Skip!)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/zalman-zm-ve200-review-you-need-this-external-hard-drive-enclosure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What a Resilver Looks Like in ZFS (and a Bug and/or Feature)</title>
		<link>http://systembash.com/content/what-a-resilver-looks-like-in-zfs/</link>
		<comments>http://systembash.com/content/what-a-resilver-looks-like-in-zfs/#comments</comments>
		<pubDate>Sun, 15 May 2011 12:16:08 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[RAID]]></category>
		<category><![CDATA[zfs]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=974</guid>
		<description><![CDATA[At home I have an (admittedly small) ZFS array set up to experiment with this neat newish raid technology. I think it has been around long enough that it can be used in production, but I'm still getting used to the little bugs/features, and here is one that I just found.

After figuring out that I had 2 out of 3 of my 1TB Seagate Barracuda hard drives fail, I had to give the array up for a loss and test out my backup strategy. Fortunately it worked and there was no data loss. After receiving the replacement drives in from RMA, I rebuilt the ZFS array (using raidz again) and went along my merry way. After 6 months or so, I started getting some funky results from my other drive. Thinking it might have some issue as with the others, I removed the drive and ran Seatools on it (by the way, Seatools doesn't offer a 64-bit Windows version - what year is this?).

The drive didn't show any signs of failure, so I decided to wipe it and add it back into the array to see what happens. That, of course, is easier said than done.]]></description>
			<content:encoded><![CDATA[<p>At home I have an (admittedly small) <a href="http://en.wikipedia.org/wiki/ZFS">ZFS</a> array set up to experiment with this awesome newish <a href="http://en.wikipedia.org/wiki/RAID">RAID</a> technology. I think it has been around long enough that it can now be used in production, but I&#8217;m still getting used to the little bugs/features, and here is one that I just found.</p>
<p>After figuring out that I had 2 out of 3 of my 1TB Seagate Barracuda hard drives in the array fail, I had to give the entire array up for a loss and test out my backup strategy. Fortunately it worked and there was no data loss. After receiving the replacement drives in from Seagate, I rebuilt the ZFS array (using <a href="http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide#Should_I_Configure_a_RAIDZ.2C_RAIDZ-2.2C_RAIDZ-3.2C_or_a_Mirrored_Storage_Pool.3F">raidz</a> again) and went along my merry way. After another 6 months or so, I started getting some funky results from my other drive. Thinking it might have some issue as with the others, I removed the drive and ran <a href="http://www.seagate.com/www/en-us/support/downloads/seatools">Seatools</a> on it (by the way, Seatools doesn&#8217;t offer a 64-bit Windows version &#8211; what year is this?).</p>
<p>The drive didn&#8217;t show any signs of failure, so I decided to wipe it and add it back into the array to see what happens. That, of course, is easier said than done.</p>
<p>One of the problems I ran into is that I am using <a href="http://www.ubuntu.com/">Ubuntu</a> and <a href="http://fuse.sourceforge.net/">fuse</a> to run zfs. Ubuntu has this nasty habit of changing around drive identifiers when USB devices are plugged in. So now when this drive is plugged in, it is on /dev/sde instead of /dev/sdd, which is now a USB attached drive. </p>
<p>No problem, I figure, I&#8217;ll offline the bad drive in the zpool and replace it with the new drive location. No such luck.</p>
<p>First I offlined the drive using <code class="codecolorer text mac-classic"><span class="text">zpool offline media /dev/sdd</span></code>:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">dave@cerberus:~$ sudo zpool status<br />
&nbsp; pool: media<br />
&nbsp;state: DEGRADED<br />
status: One or more devices has been taken offline by the administrator.<br />
&nbsp; &nbsp; &nbsp; &nbsp; Sufficient replicas exist for the pool to continue functioning in a<br />
&nbsp; &nbsp; &nbsp; &nbsp; degraded state.<br />
action: Online the device using 'zpool online' or replace the device with<br />
&nbsp; &nbsp; &nbsp; &nbsp; 'zpool replace'.<br />
&nbsp;scrub: none requested<br />
config:<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; NAME &nbsp; &nbsp; &nbsp; &nbsp;STATE &nbsp; &nbsp; READ WRITE CKSUM<br />
&nbsp; &nbsp; &nbsp; &nbsp; media &nbsp; &nbsp; &nbsp; DEGRADED &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raidz1-0 &nbsp;DEGRADED &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdd &nbsp; &nbsp; OFFLINE &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdb &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdc &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0</div></td></tr></tbody></table></div>
<p>Now that it&#8217;s offline, I thought you should be able to detach it. No such luck &#8211; since it is a &#8216;primary&#8217; device of the zpool it does not allow you to remove it.</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">dave@cerberus:~$ sudo zpool detach media /dev/sdd<br />
cannot detach /dev/sdd: only applicable to mirror and replacing vdevs</div></td></tr></tbody></table></div>
<p>What they <em>want</em> you to do is replace the drive with another drive. This drive (the same drive, with all info wiped from it) is now on /dev/sde. I try to replace it:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">dave@cerberus:~$ sudo zpool replace media /dev/sdd /dev/sde<br />
invalid vdev specification<br />
use '-f' to override the following errors:<br />
/dev/sde is part of active pool 'media'<br />
dave@cerberus:~$ sudo zpool replace -f media /dev/sdd /dev/sde<br />
invalid vdev specification<br />
the following errors must be manually repaired:<br />
/dev/sde is part of active pool 'media'</div></td></tr></tbody></table></div>
<p>Even with -f it doesn&#8217;t allow the replacement, because the system thinks that the drive is part of another pool.</p>
<p>So basically you are stuck if trying to test a replacement with a drive that already been used in the pool. I&#8217;m sure I could replace it with another 1TB disk but what is the point of that? </p>
<p>I ended up resolving the problem by removing the external USB drive, therefore putting the drive back into the original /dev/sdd slot. Without issuing any commands, the system now sees the drive as the old one, and starts resilvering the drive.</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root@cerberus:/home/dave# zpool status<br />
&nbsp; pool: media<br />
&nbsp;state: ONLINE<br />
status: One or more devices has experienced an unrecoverable error. &nbsp;An<br />
&nbsp; &nbsp; &nbsp; &nbsp; attempt was made to correct the error. &nbsp;Applications are unaffected.<br />
action: Determine if the device needs to be replaced, and clear the errors<br />
&nbsp; &nbsp; &nbsp; &nbsp; using 'zpool clear' or replace the device with 'zpool replace'.<br />
&nbsp; &nbsp;see: http://www.sun.com/msg/ZFS-8000-9P<br />
&nbsp;scrub: resilver in progress for 0h9m, 4.62% done, 3h18m to go<br />
config:<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; NAME &nbsp; &nbsp; &nbsp; &nbsp;STATE &nbsp; &nbsp; READ WRITE CKSUM<br />
&nbsp; &nbsp; &nbsp; &nbsp; media &nbsp; &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raidz1-0 &nbsp;ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdd &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp;13 &nbsp;30.2G resilvered<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdb &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdc &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0</div></td></tr></tbody></table></div>
<p>It is interesting to see what it looks like from an i/o perspective. The system reads from the two good drives and writes to the new (bad) one. Using <code class="codecolorer text mac-classic"><span class="text">iostat -x</span></code>:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">avg-cpu: &nbsp;%user &nbsp; %nice %system %iowait &nbsp;%steal &nbsp; %idle<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 29.77 &nbsp; &nbsp;0.00 &nbsp; 13.81 &nbsp; 32.81 &nbsp; &nbsp;0.00 &nbsp; 23.60<br />
<br />
Device: &nbsp; &nbsp; &nbsp; &nbsp; rrqm/s &nbsp; wrqm/s &nbsp; &nbsp; r/s &nbsp; &nbsp; w/s &nbsp; rsec/s &nbsp; wsec/s avgrq-sz avgqu-sz &nbsp; await &nbsp;svctm &nbsp;%util<br />
sda &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; 0.00 &nbsp; &nbsp;0.80 &nbsp; &nbsp;0.00 &nbsp; &nbsp;33.60 &nbsp; &nbsp; 0.00 &nbsp; &nbsp;42.00 &nbsp; &nbsp; 0.01 &nbsp; 15.00 &nbsp;15.00 &nbsp; 1.20<br />
sdb &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; 0.00 &nbsp;625.00 &nbsp; &nbsp;0.00 108033.20 &nbsp; &nbsp; 0.00 &nbsp; 172.85 &nbsp; &nbsp; 0.56 &nbsp; &nbsp;0.90 &nbsp; 0.49 &nbsp;30.80<br />
sdc &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; 0.00 &nbsp;624.20 &nbsp; &nbsp;0.00 107828.40 &nbsp; &nbsp; 0.00 &nbsp; 172.75 &nbsp; &nbsp; 0.50 &nbsp; &nbsp;0.81 &nbsp; 0.47 &nbsp;29.60<br />
sdd &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.00 &nbsp; &nbsp; 1.20 &nbsp; &nbsp;0.00 &nbsp;504.40 &nbsp; &nbsp; 0.00 107729.60 &nbsp; 213.58 &nbsp; &nbsp; 9.52 &nbsp; 18.85 &nbsp; 1.98 100.00</div></td></tr></tbody></table></div>
<p>It seems that ZFS is able to identify a hard drive by GID somehow but doesn&#8217;t automatically use it in the pool. This makes it so that you can&#8217;t test a drive by removing it, formatting it, and putting it into a new location. <strong>Basically, zfs assumes that your drives are always going to be in the same /dev location, which isn&#8217;t always true</strong>. As soon as you attach a USB drive in Ubuntu things are going to shift around.</p>
<p>After the resilver is complete, the zpool status is:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root@cerberus:/home/dave# zpool status<br />
&nbsp; pool: media<br />
&nbsp;state: ONLINE<br />
status: One or more devices has experienced an unrecoverable error. &nbsp;An<br />
&nbsp; &nbsp; &nbsp; &nbsp; attempt was made to correct the error. &nbsp;Applications are unaffected.<br />
action: Determine if the device needs to be replaced, and clear the errors<br />
&nbsp; &nbsp; &nbsp; &nbsp; using 'zpool clear' or replace the device with 'zpool replace'.<br />
&nbsp; &nbsp;see: http://www.sun.com/msg/ZFS-8000-9P<br />
&nbsp;scrub: resilver completed after 0h16m with 0 errors on Sun May 15 07:35:46 2011<br />
config:<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; NAME &nbsp; &nbsp; &nbsp; &nbsp;STATE &nbsp; &nbsp; READ WRITE CKSUM<br />
&nbsp; &nbsp; &nbsp; &nbsp; media &nbsp; &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raidz1-0 &nbsp;ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdd &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp;13 &nbsp;50.0G resilvered<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdb &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdc &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
<br />
errors: No known data errors</div></td></tr></tbody></table></div>
<p>You can now clear the error with:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root@cerberus:/home/dave# zpool clear media<br />
root@cerberus:/home/dave#</div></td></tr></tbody></table></div>
<p>Zpool status now shows no errors:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root@cerberus:/home/dave# zpool status<br />
&nbsp; pool: media<br />
&nbsp;state: ONLINE<br />
&nbsp;scrub: resilver completed after 0h16m with 0 errors on Sun May 15 07:35:46 2011<br />
config:<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; NAME &nbsp; &nbsp; &nbsp; &nbsp;STATE &nbsp; &nbsp; READ WRITE CKSUM<br />
&nbsp; &nbsp; &nbsp; &nbsp; media &nbsp; &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raidz1-0 &nbsp;ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdd &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp;50.0G resilvered<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdb &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sdc &nbsp; &nbsp; ONLINE &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0<br />
<br />
errors: No known data errors</div></td></tr></tbody></table></div>
<p>So now the question I have is this: <em>Are you able to manually update or remove the drive status somewhere in your system?</em> How did zfs know that this drive already had a pool installed on it? I zeroed the drive and verified with fdisk there were no partition on it. Is there a file somewhere on the system that stores this information, or is it written somewhere on the drive?</p>
<p>ZFS is great, but it still has some little issues like this that give me pause before using it in a production system. Then again, I suppose all massive disk array systems have their little quirks!</p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/what-a-resilver-looks-like-in-zfs/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Disabling The hald-addon-storage Service On CentOS/RedHat</title>
		<link>http://systembash.com/content/disabling-the-hald-addon-storage-service-on-centosredhat/</link>
		<comments>http://systembash.com/content/disabling-the-hald-addon-storage-service-on-centosredhat/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 16:13:53 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Configurations]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[hald]]></category>
		<category><![CDATA[hardware access layer]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=961</guid>
		<description><![CDATA[The hald &#8211; Hardware Access Layer Daemon &#8211; runs several processes in order to keep track of what hardware is installed on your system. This includes polling USB Drives and &#8216;hot-swap&#8217; devices to check for changes along with a host of other tasks. You might see it running on your system as follows: 12342474 ? [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://linux.die.net/man/8/hald">hald</a> &#8211; <em>Hardware Access Layer Daemon</em> &#8211; runs several processes in order to keep track of what hardware is installed on your system. This includes polling USB Drives and &#8216;hot-swap&#8217; devices to check for changes along with a host of other tasks. </p>
<p>You might see it running on your system as follows:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">2474 ? &nbsp; &nbsp; &nbsp; &nbsp;S &nbsp; &nbsp; &nbsp;0:00 &nbsp;\_ hald-runner<br />
2481 ? &nbsp; &nbsp; &nbsp; &nbsp;S &nbsp; &nbsp; &nbsp;0:00 &nbsp; &nbsp; &nbsp;\_ hald-addon-acpi: listening on acpid socket /var/run/acpid.socket<br />
2487 ? &nbsp; &nbsp; &nbsp; &nbsp;S &nbsp; &nbsp; &nbsp;0:00 &nbsp; &nbsp; &nbsp;\_ hald-addon-keyboard: listening on /dev/input/event0<br />
2495 ? &nbsp; &nbsp; &nbsp; &nbsp;S &nbsp; &nbsp; 41:47 &nbsp; &nbsp; &nbsp;\_ hald-addon-storage: polling /dev/hdc</div></td></tr></tbody></table></div>
<p>If your system is static and the devices do not change, you can actually disable this service using a policy entry. </p>
<p>Create a file in your policy directory, for example /etc/hal/fdi/policy/99-custom.fdi. Add the text:</p>
<div class="codecolorer-container xml mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;deviceinfo</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;0.2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;device<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;match</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;storage.removable&quot;</span> <span style="color: #000066;">bool</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;remove</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;info.addons&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;strlist&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>hald-addon-storage<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/remove<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/match<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/device<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/deviceinfo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></td></tr></tbody></table></div>
<p>Save and reload the hald using <code class="codecolorer text mac-classic"><span class="text">/etc/init.d/haldaemon restart</span></code>.</p>
<p>And you will find that service no longer is polling your hardware.</p>
<p>Of course to turn it back on, remove that policy entry and restart the haldaemon again, it will be back in service.</p>
<p><em>Solution Credit: <a href="http://www.linuxforums.org/forum/newbie/160675-solved-completely-disabling-hald-addon-storage-not-just-stop-polling.html">Linuxforums User cn77</a></em></p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/disabling-the-hald-addon-storage-service-on-centosredhat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Random Quotes to the Bash Login Screen</title>
		<link>http://systembash.com/content/adding-random-quotes-to-the-bash-login-screen/</link>
		<comments>http://systembash.com/content/adding-random-quotes-to-the-bash-login-screen/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 13:49:13 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Code Samples]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[quotes]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=873</guid>
		<description><![CDATA[According to &#8220;official&#8221; system administrator rules and guidelines you shouldn&#8217;t be adding so-called vain scripts to the login prompt &#8211; only utilities that will add something useful to the system (for example, current system load, memory and disk usage, etc). However I have some systems that I frequently connect to and thought it would be [...]]]></description>
			<content:encoded><![CDATA[<p>According to &#8220;official&#8221; system administrator rules and guidelines you shouldn&#8217;t be adding so-called vain scripts to the login prompt &#8211; only utilities that will add something useful to the system (for example, current system load, memory and disk usage, etc). However I have some systems that I frequently connect to and thought it would be neat to add a random quote script to my bash login. That being said, this should only be done on &#8216;non-production&#8217; systems and adds a security vector so please be careful where you use this. </p>
<p>The goal of this is to add a little quote, at random, every time you log into your system. My thoughts were to do it not only as a little source of inspiration but also to add perspective to what I&#8217;m doing sitting in front of the computer all of the time. </p>
<p>Originally I was going to try to write the script solely in bash since it is so flexible (and just as a proof of concept) but dealing with RSS in bash isn&#8217;t exactly pretty and I just wanted to get this together as quick as possible. PHP makes parsing XML easy, there are a number of ways to accomplish it. I chose to use the ready-made script at <a href="http://rssphp.net/">rssphp.net</a> to do this, if you are curious about how you can handle this yourself using SimpleXML check out <a href="http://www.pixel2life.com/publish/tutorials/102/xml_parsing_using_built_in_libraries_in_php5/">this tutorial</a> over at Pixel2Life. The end result of my solution is a bash script calling a php script to grab the quote.</p>
<h2>The Code</h2>
<p>First create a file named <code class="codecolorer text mac-classic"><span class="text">/etc/update-motd.d/10-quote</span></code>. The name does not matter much &#8211; the number will decide what order the script is called in of all the scripts in /etc/update-motd.d. Do an <code class="codecolorer text mac-classic"><span class="text">ls</span></code> on that directory to see what all is being called when you log in. Add the following lines to this file, assuming you are placing your scripts in /etc/scripts/:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span><br />
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>getquote.php<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span></div></td></tr></tbody></table></div>
<p><a href="http://rssphp.net/download/">Download v1 of rssphp</a> and extract it to the <code class="codecolorer text mac-classic"><span class="text">/etc/scripts/</span></code> directory. We will require that file in our php code.</p>
<p>Create the file <code class="codecolorer text mac-classic"><span class="text">/etc/scripts/getquote.php</span></code> and add the following:</p>
<div class="codecolorer-container php mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'rss_php.php'</span><span style="color: #339933;">;</span> &nbsp; &nbsp;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$rss</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> rss_php<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$rss</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://www.quotedb.com/quote/quote.php?action=random_quote_rss'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$rssitems</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$rss</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getItems</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$rssitems</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// print_r($rssitems);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$rssitems</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' :: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$rssitems</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>I am using the RSS source from <a href="http://www.quotedb.com">QuoteDB</a> as the source of my quotes. Of all the places I checked (and I checked a lot) they seemed to have the most appropriate ones for this use. Feel free to use any source you wish &#8211; as long as the XML fields title/description hold the quote you will be able to use it. The RSS url was not obvious from the site and I had to do some digging to find it, in the end I am using <code class="codecolorer text mac-classic"><span class="text">http://www.quotedb.com/quote/quote.php?action=random_quote_rss</span></code>.</p>
<p>We also add the <em>if</em> statement to allow it to degrade nicely in case you have no network connectivity to the server. After a short period &#8211; a second or two &#8211; it will time out and let you log in. </p>
<p>The end result is a pretty quote in our motd:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Linux vps01.[redacted].com 2.6.18-2-pve #1 SMP Mon Feb 1 10:45:26 CET 2010 x86_64 GNU/Linux<br />
Ubuntu 10.04.1 LTS<br />
<br />
&quot;The absence of alternatives clears the mind marvelously.&quot; :: Henry Kissinger<br />
<br />
root@vps01:~#</div></td></tr></tbody></table></div>
<p>It should be pretty strait forward; let me know if you run into any problems!</p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/adding-random-quotes-to-the-bash-login-screen/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Firesheep Should Be A Call To Arms For System, Network &amp; Web Admins</title>
		<link>http://systembash.com/content/firesheep-should-be-a-call-to-arms-for-system-network-web-admins/</link>
		<comments>http://systembash.com/content/firesheep-should-be-a-call-to-arms-for-system-network-web-admins/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 10:49:41 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=839</guid>
		<description><![CDATA[<a href="http://codebutler.com/firesheep">Firesheep</a> by Eric Butler has just been released to the world. This Firefox plugin does a few things that have already been fairly easy to do for a while, but rolled up in one easy to use package:

<img src="http://systembash.com/wp-content/uploads/2010/10/firesheep-e1288002757922.png" alt="" title="firesheep" width="600" height="362" class="aligncenter size-full wp-image-841" />


<ol><li>Sniffs data on unencrypted Wireless Networks</li>
<li>Looks for unencrypted login cookies sent to known popular insecure sites</li>
<li>Allows you to login to that account with 'One Click'</li>
</ol>

So what sites are impacted by default? Amazon.com, Basecamp, bit.ly, Cisco, CNET, Dropbox, Enom, Evernote, Facebook, Flickr, Github, Google, HackerNews, Harvest, Windows Live, NY Times, Pivotal Tracker, Slicehost, tumblr, Twitter, WordPress, Yahoo, and Yelp are among the few. A plugin system allows anyone to add their own sites (and cookie styles) to the plugin.

Yikes! It goes without saying that this is a major security problem for anyone who uses unencrypted wireless networks. Includes on this list are many universities and companies such as Starbucks. ]]></description>
			<content:encoded><![CDATA[<p><a href="http://codebutler.com/firesheep">Firesheep</a> by Eric Butler has just been released to the world. This Firefox plugin does a few things that have already been fairly easy to do for a while, but rolled up in one easy to use package:</p>
<p><img src="http://systembash.com/wp-content/uploads/2010/10/firesheep-e1288002757922.png" alt="" title="firesheep" width="600" height="362" class="aligncenter size-full wp-image-841" /></p>
<ol>
<li>Sniffs data on unencrypted Wireless Networks</li>
<li>Looks for unencrypted login cookies sent to known popular insecure sites</li>
<li>Allows you to login to that account with &#8216;One Click&#8217;</li>
</ol>
<p>So <strong>what sites are impacted</strong> by default? Amazon.com, Basecamp, bit.ly, Cisco, CNET, Dropbox, Enom, Evernote, Facebook, Flickr, Github, Google, HackerNews, Harvest, Windows Live, NY Times, Pivotal Tracker, Slicehost, tumblr, Twitter, WordPress, Yahoo, and Yelp are among the few. A plugin system allows anyone to add their own sites (and cookie styles) to the plugin.</p>
<p>Yikes! It goes without saying that this is a major security problem for anyone who uses unencrypted wireless networks. Includes on this list are many universities and companies such as Starbucks. </p>
<p>It is a bit funny, because just last night I was talking with my friend <a href="http://geeklad.com/">Jorge Sierra</a> about this very problem. My university in fact is one of those which uses unencrypted wifi. I installed the <a href="https://chrome.google.com/extensions/detail/mjpinemnkjlppmemjfabdaelpfgfjgkj">unencrypted password extension for Chrome</a> to let me know when I am submitted an unencrypted password to a site. I was surprised how often this little box was popping up!</p>
<h2>Why Open WiFi?</h2>
<p>I am not sure &#8211; my <a href="http://www.psu.edu">undergrad university</a> requires that any traffic going over wifi goes through their VPN which encrypts the traffic and prevents this program from working. Is open wifi still the <strong>&#8216;poison of choice&#8217;</strong> for network admins because setting up a VPN-style system is too much for some organizations? Maybe &#8211; but it is clearly the wrong answer. </p>
<p>The other clear reason is that it is easier to use, and this is a valid complaint from a user experience perspective. I&#8217;ve seen plenty of folks have a hard time even with a simple WPA password. A shared password makes it even harder for a user to sign in. Hotels and coffee houses across the world <strong>opt for open wifi because it is simply the easiest for consumers to use</strong>. This is a problem us tech people need to solve. </p>
<p>Even if it is encrypted via WEP or WPA (1) these are very insecure protocols and still can be hacked with relative ease. This plugin could in fact be modified to include the cracking as well and cover an even wider range of wireless networks. This brings me to my second point.</p>
<h2>Web Developers Must Encrypt All Login Forms</h2>
<p>If you run ANY consumer facing app you should be passing any and all login information via an SSL secured website. </p>
<p>For hosts on a static IP address you simply need to purchase an SSL certificate. They are <strong>seriously under $20</strong> these days (my cost as a reseller is $12) and are simple to install. Your code should be set up to always use this site and to never allow username and password to be sent unencrypted over the network. This is important not only at the end user&#8217;s connection (possibly over open wifi) but also for end-to-end encryption of this data.</p>
<p>Let&#8217;s say you are running a site on a shared IP address. You usually still have options. Most hosts I know of offer on SSL connection via the shared site &#8211; eg: https://server.name/~username/. This URL can be used to access your site&#8217;s information via an SSL certificate and it is normally included with the service. </p>
<p>Ideally every site would have an SSL certificate. But we need a few things for that to happen. People who buy web hosting are almost always looking for the cheapest deal. They will not be getting SSL at these bottom level prices. Hosting needs to have a paradigm shift so that people who run websites need to know that it is better to have people who know what they are doing from a security standpoint have configured and are running their servers, and that paying $10 a year for hosting isn&#8217;t sustainable. Some say that there is a significant overhead to running SSL on websites. It will, in fact, add some processing and bandwidth overhead. However <strong>this is necessary to provide security of services to the end users</strong>. </p>
<p>In my opinion, you either host your website on a large provider who use set up to have a secure infrastructure, or you pay more for an expert to host your website in a secure manner. </p>
<p>Another roadblock is the end of the free source of IPv4 address blocks. Web hosts need to move to IPv6 to free up IP addresses, and every website should be on its own IP address. That will allow SSL certificate installations much easier.</p>
<h2>Back to Reality</h2>
<p>What can you do, right now, about this problem? If you have to use an unencrypted wireless network, you should be running some sort of VPN to encrypt your traffic over the air as this is the most likely place it would be sniffed. You can get a cheap VPS at < $10 a month and <a href="http://systembash.com/content/a-poor-mans-vpn-proxy-web-connection-to-remote-server-via-ssh-and-tunnel/">proxy all of your traffic over SSH</a>. Not the fastest method, but it will secure your data. </p>
<p>You can also install the <a href="https://chrome.google.com/extensions/detail/mjpinemnkjlppmemjfabdaelpfgfjgkj">Chrome Extension</a> to warn you if you are about to submit form information via an unencrypted website. It isn&#8217;t the prettiest extension but it does get the job done.</p>
<p>Hopefully network, web and system administrators will get their acts together and push for a solution to this problem. It is a big one and one that isn&#8217;t apparent to the end user until their data, financial details and/or identity is stolen. We can fix this.</p>
<p><small>/via <a href="http://techmeme.com/">TechMeme</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/firesheep-should-be-a-call-to-arms-for-system-network-web-admins/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Fixing ip_conntrack Bottlenecks: The Tale Of The DNS Server With Many Tiny Connections</title>
		<link>http://systembash.com/content/fixing-ip_conntrack-bottlenecks-the-tale-of-the-dns-server-with-many-tiny-connections/</link>
		<comments>http://systembash.com/content/fixing-ip_conntrack-bottlenecks-the-tale-of-the-dns-server-with-many-tiny-connections/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 21:06:23 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[tcp/ip]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=822</guid>
		<description><![CDATA[I manage a server which has a sole purpose: serving DNS requests. We use <a href="http://www.powerdns.com">PowerDNS</a>, which has been great. It is a DNS server whose backend is SQL, making administration of large numbers of records very easy. It is also fast, easy to use, open source and did I mention it is free?

The server has been humming along for years now. The traffic graphs don't show a lot of data moving through it because it only serves DNS requests (plus MySQL replication) in the form of tiny UDP packets. 

Read on to follow my story of how I fixed this tricky problem. No kittens were harmed in the writing of this post. ]]></description>
			<content:encoded><![CDATA[<p>Server management is a funny thing. No matter how long you have been doing it, new interesting and unique challenges continue to pop up keeping you on your toes. This is a story about one of those challenges. </p>
<p>I manage a server which has a sole purpose: serving DNS requests. We use <a href="http://www.powerdns.com">PowerDNS</a>, which has been great. It is a DNS server whose backend is SQL, making administration of large numbers of records very easy. It is also fast, easy to use, open source and did I mention it is free?</p>
<p>The server has been humming along for years now. The traffic graphs don&#8217;t show a lot of data moving through it because it only serves DNS requests (plus MySQL replication) in the form of tiny UDP packets. </p>
<p><img src="http://systembash.com/wp-content/uploads/2010/10/servergraph.png" alt="" title="servergraph" width="507" height="355" class="aligncenter size-full wp-image-823" /></p>
<p>We started seeing these spikes in traffic but everything on the server seemed to be working properly. Test connections with <a href="http://linux.die.net/man/1/dig">dig</a> proved that the server was accurately responding to requests, but external tests showed the server going up and down. </p>
<h2>The First Clue</h2>
<p>I started going through logs to see if we were being DoSed or if it was some sort of configuration problem. Everything seemed to be running properly and the requests, while voluminous, seemed to be legit. Within the flood of messages I spied error messages such as this:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">printk: 2758 messages suppressed.<br />
ip_conntrack: table full, dropping packet.</div></td></tr></tbody></table></div>
<p>Ah ha! A clue! Let&#8217;s check the current numbers of ip_conntrack, which is a kernel function for the firewall which keeps tabs on packets heading into the system.</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@ns1 log]# head /proc/slabinfo<br />
slabinfo - version: 2.0<br />
# name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;active_objs&gt; &lt;num_objs&gt; &lt;objsize&gt; &lt;objperslab&gt; &lt;pagesperslab&gt; : tunables &lt;batchcount&gt; &lt;limit&gt; &lt;sharedfactor&gt; : slabdata &lt;active_slabs&gt; &lt;num_slabs&gt; &lt;sharedavail&gt;<br />
ip_conntrack_expect &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;192 &nbsp; 20 &nbsp; &nbsp;1 : tunables &nbsp;120 &nbsp; 60 &nbsp; &nbsp;8 : slabdata &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0<br />
ip_conntrack &nbsp; &nbsp; &nbsp; &nbsp;34543 &nbsp;34576 &nbsp; &nbsp;384 &nbsp; 10 &nbsp; &nbsp;1 : tunables &nbsp; 54 &nbsp; 27 &nbsp; &nbsp;8 : slabdata &nbsp; 1612 &nbsp; 1612 &nbsp; &nbsp;108<br />
fib6_nodes &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 &nbsp; &nbsp;119 &nbsp; &nbsp; 32 &nbsp;119 &nbsp; &nbsp;1 : tunables &nbsp;120 &nbsp; 60 &nbsp; &nbsp;8 : slabdata &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp;0<br />
ip6_dst_cache &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; 15 &nbsp; &nbsp;256 &nbsp; 15 &nbsp; &nbsp;1 : tunables &nbsp;120 &nbsp; 60 &nbsp; &nbsp;8 : slabdata &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp;0<br />
ndisc_cache &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; 20 &nbsp; &nbsp;192 &nbsp; 20 &nbsp; &nbsp;1 : tunables &nbsp;120 &nbsp; 60 &nbsp; &nbsp;8 : slabdata &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp;0<br />
rawv6_sock &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4 &nbsp; &nbsp; 11 &nbsp; &nbsp;704 &nbsp; 11 &nbsp; &nbsp;2 : tunables &nbsp; 54 &nbsp; 27 &nbsp; &nbsp;8 : slabdata &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp;0<br />
udpv6_sock &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;704 &nbsp; 11 &nbsp; &nbsp;2 : tunables &nbsp; 54 &nbsp; 27 &nbsp; &nbsp;8 : slabdata &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0<br />
tcpv6_sock &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 8 &nbsp; &nbsp; 12 &nbsp; 1216 &nbsp; &nbsp;3 &nbsp; &nbsp;1 : tunables &nbsp; 24 &nbsp; 12 &nbsp; &nbsp;8 : slabdata &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; &nbsp;0</div></td></tr></tbody></table></div>
<p>Continuing this line of logic, lets check our current value for this setting:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@ns1 log]# sysctl net.ipv4.netfilter.ip_conntrack_max<br />
net.ipv4.netfilter.ip_conntrack_max = 34576</div></td></tr></tbody></table></div>
<p>So it looks like we are hitting up against this limit. After the number of connections reaches this number, the kernel will simply drop the packet. It does this so that it will not overload and freeze up due to too many packets coming into it at once.</p>
<p>This system is running on CentOS 4.8, and since then newer versions of RHEL5 have the default set at 65536. For maximum efficiency we keep this number at multiples of 2. The top size depends on your memory, so just be careful as overloading it may cause you to run out of it.</p>
<h2>Fixing The ip_conntrack Bottleneck</h2>
<p>In my case I decided to go up 2 steps to 131072. To temporarily set it, use sysctl:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@ns1 log]# sysctl -w &nbsp;net.ipv4.netfilter.ip_conntrack_max=131072<br />
net.ipv4.netfilter.ip_conntrack_max = 131072</div></td></tr></tbody></table></div>
<p>Test everything out, if you have some problems with your network or system crashing, a reboot will set the value back to normal. To make the setting permanent on reboot, add the following line to your <code class="codecolorer text mac-classic"><span class="text">/etc/sysctl.conf</span></code> file:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># need to increase this due to volume of connections to the server<br />
net.ipv4.netfilter.ip_conntrack_max=131072</div></td></tr></tbody></table></div>
<p>My theory is that since the server was dropping packets, remote hosts were re-sending their DNS requests causing a &#8216;flood&#8217; of traffic to the server and the spikes you see in the traffic graph above whenever traffic was mildly elevated. The bandwidth spikes were caused by amplification of traffic due to resending of the requests. After increasing ip_conntrack_max I immediately saw the bandwidth resume to normal levels. </p>
<p>Your server should now be set against an onslaught of tiny packets, legitimate or not. If you have even more connections than what you can safely track with ip_conntrack you may need to move to the next level which involves hardware firewalls and other methods for packet inspection off-server on dedicated hardware.</p>
<p>Some resources used in my investigation of this problem:<br />
[1] <a href="http://wiki.khnet.info/index.php/Conntrack_tuning">http://wiki.khnet.info/index.php/Conntrack_tuning</a><br />
[2] <a href="http://serverfault.com/questions/111034/increasing-ip-conntrack-max-safely">http://serverfault.com/questions/111034/increasing-ip-conntrack-max-safely</a><br />
[3] <a href="http://www.linuxquestions.org/questions/red-hat-31/ip_conntrack-table-full-dropping-packet-615436/">http://www.linuxquestions.org/questions/red-hat-31/ip_conntrack-table-full-dropping-packet-615436/</a></p>
<p><small>The image of the kittens used for the featured image has nothing to do with this post. There are no known good photos of a &#8220;UDP Packet&#8221;, and I thought that everyone likes kittens, so there it is. Credit <a href="http://www.flickr.com/photos/mathias-erhart/2562106102/">flickr user mathias-erhart</a>.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/fixing-ip_conntrack-bottlenecks-the-tale-of-the-dns-server-with-many-tiny-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Stop an Apache DDoS Attack with mod_evasive</title>
		<link>http://systembash.com/content/how-to-stop-an-apache-ddos-attack-with-mod_evasive/</link>
		<comments>http://systembash.com/content/how-to-stop-an-apache-ddos-attack-with-mod_evasive/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 01:13:15 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[ddos]]></category>
		<category><![CDATA[mod_evasive]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=797</guid>
		<description><![CDATA[The first inkling that I had a problem with a DDoS (Distributed Denial of Service) attack was a note sent to my inbox:

<center><em>lfd on server1.myhostname.com: High 5 minute load average alert - 89.14</em></center>

<img src="http://systembash.com/wp-content/uploads/2010/10/server_ddos_2.png" alt="Apache DDoS " title="server_ddos_2" width="551" height="195" class="aligncenter size-full wp-image-804" />

My initial thought was that a site on my server was getting <a href="http://en.wikipedia.org/wiki/Slashdot_effect">Slashdotted</a> or encountering the Digg or Reddit effect. I run <a href="http://chartbeat.com">Chartbeat</a> on several sites where this occasionally happens and I will usually get an alert from them first. A quick look at the Extended status page from Apache showed that I had a much different kind of problem.]]></description>
			<content:encoded><![CDATA[<p>The first inkling that I had a problem with a DDoS (Distributed Denial of Service) attack was a note sent to my inbox:</p>
<p><center><em>lfd on server1.myhostname.com: High 5 minute load average alert &#8211; 89.14</em></center></p>
<p><img src="http://systembash.com/wp-content/uploads/2010/10/server_ddos_2.png" alt="Apache DDoS " title="server_ddos_2" width="551" height="195" class="aligncenter size-full wp-image-804" /></p>
<p>My initial thought was that a site on my server was getting <a href="http://en.wikipedia.org/wiki/Slashdot_effect">Slashdotted</a> or encountering the Digg or Reddit effect. I run <a href="http://chartbeat.com">Chartbeat</a> on several sites where this occasionally happens and I will usually get an alert from them first. A quick look at the Extended status page from Apache showed that I had a much different kind of problem.</p>
<p>If a site is getting a lot of &#8220;good&#8221; natural traffic you will see a few things:</p>
<ul>
<li>clients will be requesting all kinds of files from your site as a normal web browser would, and</li>
<li>the referring agent will show the link of the sending site, which you can verify.</li>
</ul>
<p>In my case I had about 400 or so IP addresses requesting &#8220;/&#8221; from a little trafficked site of mine. Fortunately my Apache is well-tuned enough that it did not take the server down, which was crucial for diagnosing this problem. Otherwise the entire server may down and your only option is to reboot and stop apache from starting on boot. My apache logs showed the requests:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">186.58.179.33 - - [21/Oct/2010:00:10:06 -0400] &quot;GET / HTTP/1.1&quot; 200 12474 &quot;-&quot; &quot;Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.21022; .NET <br />
CLR 3.5.30729; .NET CLR 3.0.30618)&quot;<br />
189.76.197.117 - - [21/Oct/2010:00:10:06 -0400] &quot;GET / HTTP/1.1&quot; 200 12474 &quot;-&quot; &quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.19) Gecko/20081201 Firefox/2.0.0.19&quot;<br />
186.58.179.33 - - [21/Oct/2010:00:10:06 -0400] &quot;GET / HTTP/1.1&quot; 200 12474 &quot;-&quot; &quot;Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.21022; .NET <br />
CLR 3.5.30729; .NET CLR 3.0.30618)&quot;<br />
186.6.168.11 - - [21/Oct/2010:00:10:07 -0400] &quot;GET / HTTP/1.1&quot; 200 12474 &quot;-&quot; &quot;Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.03 [en]&quot;<br />
197.0.165.121 - - [21/Oct/2010:00:10:07 -0400] &quot;GET / HTTP/1.1&quot; 200 12474 &quot;-&quot; &quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.4.154.25 Safari/525.19&quot;<br />
189.76.197.117 - - [21/Oct/2010:00:10:07 -0400] &quot;GET / HTTP/1.1&quot; 200 12474 &quot;-&quot; &quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.19) Gecko/20081201 Firefox/2.0.0.19&quot;<br />
197.0.165.121 - - [21/Oct/2010:00:10:07 -0400] &quot;GET / HTTP/1.1&quot; 200 12474 &quot;-&quot; &quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.4.154.25 Safari/525.19&quot;<br />
186.6.168.11 - - [21/Oct/2010:00:10:07 -0400] &quot;GET / HTTP/1.1&quot; 200 12474 &quot;-&quot; &quot;Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.03 [en]&quot;</div></td></tr></tbody></table></div>
<p>I found out this is from a type of DoS called a <a href="http://ha.ckers.org/slowloris/">sloworis attack</a>. In this attack, a HTTP request is made to the server and the connection is &#8216;held open&#8217;, making multiple requests. A compromised botnet is used to hammer the server from all over the world on many different connections and IP addresses. From the standpoint of Apache, these are legitimate connections despite the frequency of them. It simulates someone sitting at a browser and hitting the refresh command a few times a second. While not a devastating attack with regards to bandwidth, it ties up your server and rejects legitimate connections.</p>
<p>Fortunately after some asking around I found the <a href="http://www.zdziarski.com/blog/?page_id=442">mod_evasive</a> Apache module. This module is a very basic one that has a simple function: it will keep a hash table of IPs and pages requested and when a threshold is reached on a page or site it will &#8220;block&#8221; the IP with a 403 &#8220;Forbidden&#8221; error. </p>
<p>Installing the module is easy:</p>
<ol>
<li>Download the module onto your server:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;"># </span><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.zdziarski.com<span style="color: #000000; font-weight: bold;">/</span>blog<span style="color: #000000; font-weight: bold;">/</span>wp-content<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span><span style="color: #000000; font-weight: bold;">/</span>02<span style="color: #000000; font-weight: bold;">/</span>mod_evasive_1.10.1.tar.gz</div></td></tr></tbody></table></div>
</li>
<li>Run the apache apxs command on the module which will compile it install it into your httpd.conf file (for Apache 2.0 &#8211; you are running 2.0 aren&#8217;t you?):
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;"># </span><span style="color: #c20cb9; font-weight: bold;">apxs</span> <span style="color: #660033;">-cia</span> mod_evasive20.c</div></td></tr></tbody></table></div>
</li>
<li>Set up the configuration file. You can enter the following into your httpd.conf main server configuration (for Apache 2.0 again)
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;IfModule mod_evasive20.c&gt;<br />
DOSHashTableSize 3097<br />
DOSPageCount 3<br />
DOSSiteCount 100<br />
DOSPageInterval 3<br />
DOSSiteInterval 5<br />
DOSBlockingPeriod 300<br />
DOSLogDir &quot;/var/log/httpd/modevasive/&quot;<br />
DOSEmailNotify your@emailaddress.com<br />
&lt;/IfModule&gt;</div></td></tr></tbody></table></div>
</li>
</ol>
<p>Now this works great to throw a forbidden page to the client, but that client is still taking up a slot on your server. Once all of your slots are filled up, other requests are queue and therefore your server is lethargic to non-responsive to real requests. </p>
<p>To fix this problem the mod_evasive module has a <code class="codecolorer text mac-classic"><span class="text">DOSSystemCommand</span></code> option. Using this option you can have your server execute a command when a client trips the mod_evasive triggers. I use ConfigServerFirewall (csf) on my server, so I added the following command which specifies a 1 hour firewall ban on the IP, which effectively drops all of its traffic to the server:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">DOSSystemCommand <span style="color: #ff0000;">&quot;/usr/bin/sudo /usr/sbin/csf -td %s 3600&quot;</span></div></td></tr></tbody></table></div>
<p>But wait a second! Apache doesn&#8217;t have access to the firewall normally. This is my one reservation about this proceedure. You need to give Apache access to the firewall programs (as root) via sudo so that it can execute this firewall block. This has other security implications, especially if you are on a multitenant server. We use visudo to do this.</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;"># </span>visudo</div></td></tr></tbody></table></div>
<p>Add the following to the file:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">User_Alias &nbsp; &nbsp; &nbsp;APACHE = apache<br />
Cmnd_Alias &nbsp; &nbsp; &nbsp;FIREWALL = /sbin/iptables, /usr/sbin/csf, /sbin/ifconfig, /sbin/route<br />
APACHE &nbsp;ALL = (ALL) NOPASSWD: FIREWALL</div></td></tr></tbody></table></div>
<p>Where apache is the apache user (typically web, www, apache or httpd &#8211; this depends on the system) and the FIREWALL binaries are the ones used in the csf script. </p>
<p>Now my system watches for 3 or more connections to the same page in 3 seconds and not only serves a forbidden response to them but will drop their traffic completely via iptables. Within about 30 seconds my server load was back to normal, serving connections faithfully just like any other time. </p>
<p>This module worked great in my situation, but DDoS attacks come in many flavors and sizes. You may have luck with the <a href="http://mod-qos.sourceforge.net/">mod_qos</a> Apache module, where you can fine tune connections to certain pages. If an attack is bad enough, it is possible you will need to move to a hardware based solution because you can only do so much at the server level. A hardware firewall mixed with load balancers, caches like <a href="http://www.varnish-cache.org/">varnish</a>, and other tricks can help to mitigate these DoS attacks. </p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/how-to-stop-an-apache-ddos-attack-with-mod_evasive/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 13/22 queries in 0.006 seconds using disk: basic

Served from: systembash.com @ 2012-05-23 23:40:04 -->
