<?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>Looking for the paradigm</title>
	<atom:link href="http://www.evanhoffman.com/evan/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.evanhoffman.com/evan</link>
	<description>So I can pass it off</description>
	<lastBuildDate>Mon, 14 May 2012 13:21:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Back to WordPress 2011 Theme</title>
		<link>http://www.evanhoffman.com/evan/2012/05/14/back-to-wordpress-2011-theme/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=back-to-wordpress-2011-theme</link>
		<comments>http://www.evanhoffman.com/evan/2012/05/14/back-to-wordpress-2011-theme/#comments</comments>
		<pubDate>Mon, 14 May 2012 13:21:57 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1988</guid>
		<description><![CDATA[For a few months I&#8217;d been using the WooThemes &#8220;Mainstream&#8221; theme and really liked it. I made a point of always keeping it updated, as I do with everything WordPress. A few minutes ago, however, on a whim I did &#8230; <a href="http://www.evanhoffman.com/evan/2012/05/14/back-to-wordpress-2011-theme/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2012/05/14/back-to-wordpress-2011-theme/"></g:plusone></div><p>For a few months I&#8217;d been using the WooThemes &#8220;Mainstream&#8221; theme and really liked it.  I made a point of always keeping it updated, as I do with everything WordPress.  A few minutes ago, however, on a whim I did a
<pre>netstat -a</pre>
<p> on my webserver, and saw a bunch of connections from my server to setlinks.ru:http.  I quickly grepped the wordpress directory for &#8220;setlinks&#8221; and sure enough it looks like some trojaned code made it in.  Under my
<pre>/wp-content/themes/mainstream/cache/</pre>
<p> dir there are these directories:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">drwxr-xr-x <span style="color: #000000;">3</span> apache apache <span style="color: #000000;">4096</span> Dec <span style="color: #000000;">16</span> 00:07 setlinks_fa356<span style="color: #000000; font-weight: bold;">/</span>
drwxr-xr-x <span style="color: #000000;">3</span> apache apache <span style="color: #000000;">4096</span> Dec <span style="color: #000000;">16</span> 00:08 692ad897a15978e7cfd099ace86a56bf<span style="color: #000000; font-weight: bold;">/</span>
drwxr-xr-x <span style="color: #000000;">2</span> apache apache <span style="color: #000000;">4096</span> Dec <span style="color: #000000;">16</span> 00:08 12483e2d235715e4ad4c76c8cf04f0fd76c8c397<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Under 692ad897a15978e7cfd099ace86a56bf there are a bunch of PHP scripts, including sape.php, which has a bunch of crap in it linking to db.linkfeed.ru.</p>
<p>So anyway, rather than investigate fully right now I&#8217;m scrapping the WooTheme altogether.  So the site is going to look more boring, but oh well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2012/05/14/back-to-wordpress-2011-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My first month with the Canon T3i</title>
		<link>http://www.evanhoffman.com/evan/2012/03/31/my-first-month-with-the-canon-t3i/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=my-first-month-with-the-canon-t3i</link>
		<comments>http://www.evanhoffman.com/evan/2012/03/31/my-first-month-with-the-canon-t3i/#comments</comments>
		<pubDate>Sat, 31 Mar 2012 19:04:39 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[50mm]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[canon]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[t3i]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[zoom lens]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1958</guid>
		<description><![CDATA[About 6 years ago my mom gave me her Canon Digital Rebel (EOS 300D) and I loved it. Prior to that I&#8217;d only used point-and-shoots and the quality of pictures I got with the DSLR was amazing. After a few &#8230; <a href="http://www.evanhoffman.com/evan/2012/03/31/my-first-month-with-the-canon-t3i/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2012/03/31/my-first-month-with-the-canon-t3i/"></g:plusone></div><p>About 6 years ago my mom gave me her <a href="http://www.dpreview.com/reviews/canoneos300d">Canon Digital Rebel (EOS 300D)</a> and I loved it.  Prior to that I&#8217;d only used point-and-shoots and the quality of pictures I got with the DSLR was amazing.<br />
<span id="more-1958"></span><br />
After a few years I realized I really wasn&#8217;t able to take the photos I envisioned in my mind.  This was certainly due to having now idea how to <i>use</i> the camera and just relying on full auto to take pictures.  Finally, this past winter, I decided to try and teach myself how to take good photos, or at least ones that were closer to what I pictured in my mind.  A few people told me, &#8220;take a class!&#8221;  But who has time for a class?  I decided to use my good friend YouTube.  A couple of 10-minute videos were extremely helpful: this one on aperture:</p>
<div align="center"><iframe width="420" height="315" align="center" src="http://www.youtube.com/embed/3833CgvK7MU" frameborder="0" allowfullscreen></iframe>
</div>
<p>And this one on shutter speed:</p>
<div align="center"><iframe width="420" height="315" align="center" src="http://www.youtube.com/embed/b8cCnuTNaic" frameborder="0" allowfullscreen></iframe></div>
<p>Those two videos taught me enough to realize that the kit lens on my Canon Digital Rebel, the original 18-55mm f/4-5.6, was kind of a piece of crap.  I agonized for weeks over what kind of lens I should get, with the decision made for me by my wife getting me the <a href=http://www.amazon.com/gp/product/B0011NVMO8/ref=as_li_ss_tl?ie=UTF8&#038;tag=evanhoffmasho-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B0011NVMO8">Canon 55-250mm IS lens</a>, which I wanted for taking photos of my son&#8217;s soccer games, for Christmas.  </p>
<p>While the 55-250mm lens is fantastic, it&#8217;s really situational &#8211; not really useful for everyday shots.  I ordered the other one I wanted, the <a href="http://www.amazon.com/Canon-50mm-1-8-Camera-Lens/dp/B00007E7JU?tag=evanhoffmasho-20">Canon 50mm f/1.8</a>, a few days later.  After playing with the 50mm for a few days I regretted having waited so long to buy it.  It made taking photos a joy.  Being able to do have actual depth of field and interesting-looking photos with such an inexpensive lens was fantastic.</p>
<p>The Rebel was still showing its age, however.  Some of the major annoyances with it were its lack of USB 2.0 (which made copying photos off it very slow) and use of CF rather than SD card (which meant I couldn&#8217;t stick the memory card directly into the computer to copy them off).  I have a card reader, but it was still very inconvenience.  It also had a fairly long interval between taking photos.</p>
<p>After complaining about my camera for (literally) years, my lovely wife and my mom got me the <a href="http://www.amazon.com/Canon-T3i-Processor-Vari-Angle-Body/dp/B004M170YC?tag=evanhoffmasho-20">Canon T3i body</a> for my birthday this year.  I can say without reservation that it is the best gift I have ever received.  With the T3i and the new lenses I&#8217;ve been able to take some amazing photos.  While I still take plenty of lousy ones, I have been able to take some gems.  Some of my favorites from the past month or so are below.  I&#8217;m still a total amateur but the camera and lenses make it easy to take great shots.  None of these are edited except for some cropping on some of them.</p>
<p><embed type="application/x-shockwave-flash" src="https://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&#038;hl=en_US&#038;feat=flashalbum&#038;RGB=0x000000&#038;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fevandhoffman%2Falbumid%2F5726082143924222785%3Falt%3Drss%26kind%3Dphoto%26hl%3Den_US" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></p>
<p>Based on reviews on Amazon and Newegg, I opted for the <a href="http://www.amazon.com/Wintec-Filemate-Professional-Secure-Digital/dp/B0046TDJJK?tag=evanhoffmasho-20">Wintec FileMate 16 GB</a> SD card.  I have a 32 GB Class 10 Transcend card that I use in my Kodak Zx3 movie camera and I&#8217;ve tried both in the T3i and the Wintec card is significantly faster than the Transcend, despite both being labeled as Class 10.  I can hold the shutter button down on the camera and take 30-40 shots at maximum resolution &#038; JPEG quality without any buffering/lag.  Really a great card at a great price.</p>
<p>Now the proud owner of an awesome camera and 3 different lenses, I figured it was time to get a decent bag to hold it all.  After some more weeks of agonizing, I settled on the <a href="http://www.amazon.com/Case-Logic-SLRC-202-Medium-Camera/dp/B001TZWNF0?tag=evanhoffmasho-20">Case Logic SLRC-202</a> and so far I really like it.  It has a nifty &#8220;hammock&#8221; to support the camera body itself and two compartments for lenses.  I managed to cram the charger, USB cable and driver CD in as well, so I have everything I need all the time.  </p>
<p><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" id="Player_303099ac-04f5-44f1-a5bf-19d3d7fc0c5a"  WIDTH="600px" HEIGHT="200px"> <PARAM NAME="movie" VALUE="http://ws.amazon.com/widgets/q?rt=tf_cw&#038;ServiceVersion=20070822&#038;MarketPlace=US&#038;ID=V20070822%2FUS%2Fevanhoffmasho-20%2F8010%2F303099ac-04f5-44f1-a5bf-19d3d7fc0c5a&#038;Operation=GetDisplayTemplate"><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#FFFFFF"><PARAM NAME="allowscriptaccess" VALUE="always"><embed src="http://ws.amazon.com/widgets/q?rt=tf_cw&#038;ServiceVersion=20070822&#038;MarketPlace=US&#038;ID=V20070822%2FUS%2Fevanhoffmasho-20%2F8010%2F303099ac-04f5-44f1-a5bf-19d3d7fc0c5a&#038;Operation=GetDisplayTemplate" id="Player_303099ac-04f5-44f1-a5bf-19d3d7fc0c5a" quality="high" bgcolor="#ffffff" name="Player_303099ac-04f5-44f1-a5bf-19d3d7fc0c5a" allowscriptaccess="always"  type="application/x-shockwave-flash" align="middle" height="200px" width="600px"></embed></OBJECT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?rt=tf_cw&#038;ServiceVersion=20070822&#038;MarketPlace=US&#038;ID=V20070822%2FUS%2Fevanhoffmasho-20%2F8010%2F303099ac-04f5-44f1-a5bf-19d3d7fc0c5a&#038;Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT></p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2012/03/31/my-first-month-with-the-canon-t3i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When the admin of your online community dies</title>
		<link>http://www.evanhoffman.com/evan/2012/03/13/when-the-admin-of-your-online-community-dies/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=when-the-admin-of-your-online-community-dies</link>
		<comments>http://www.evanhoffman.com/evan/2012/03/13/when-the-admin-of-your-online-community-dies/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 18:57:05 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[everquest]]></category>
		<category><![CDATA[gaming]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[phpbb]]></category>
		<category><![CDATA[tarew marr]]></category>
		<category><![CDATA[wow]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1931</guid>
		<description><![CDATA[In 2000 or 2001 I started playing EverQuest. I was relatively late to the game, joining after the 3rd expansion (Luclin) was already out. I played it for a few years, at one point obsessively. In truth, I was never &#8230; <a href="http://www.evanhoffman.com/evan/2012/03/13/when-the-admin-of-your-online-community-dies/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2012/03/13/when-the-admin-of-your-online-community-dies/"></g:plusone></div><p>In 2000 or 2001 I started playing EverQuest.  I was relatively late to the game, joining after the 3rd expansion (Luclin) was already out.  I played it for a few years, at one point obsessively.  In truth, I was never really that good, but I was in a guild that I loved and for the most part we all had fun.  Like in other MMOs, when you start playing EverQuest you need to choose which server to play on.  Basically I picked a random one to create my character on: Tarew Marr (most servers in EQ were named after the deities in the game).<br />
<span id="more-1931"></span><br />
For anyone unfamiliar with MMO games (as I was at the time), your server choice affects almost every aspect of your gameplay experience.  Each game server is essentially a parallel universe with the same buildings, NPCs (characters), quests, and items, but completely different sets of actual human beings inhabiting them.  Servers develop their own personalities as a result of the players inhabiting them.  Like any community, there are nice people, morons, trolls, elite players, people who totally sucked at the game, grownups, children, racists and any other variety of person you can imagine.  This, of course, is exactly the appeal of any MMO.  You can play a single-player game in complete safety, but when you add 2000 random strangers in to the mix things get pretty interesting.  There was plenty of drama, and Tarew Marr was actually one of the crazier servers.</p>
<p>What&#8217;s probably unsurprising in 2012, but I found pretty strange in 2001, is that there was an &#8220;offline&#8221; community for Tarew Marr in the form of a phpBB message board.  Once again, I found the site pretty late but the forum was addictive.  Server goings-on were discussed there and other general topics were incorporated daily.  It was a self-selecting group of people with ages ranging from 15 to 50 (more or less) from all over the world whose only real commonality was playing Everquest on the same server.  People came and went but the community was relatively cohesive.  Eventually the phpBB forum became more interesting than the game it was created to serve.  As people stopped playing EQ and moved to other games (or just gave up gaming entirely), they kept their roots in the forum.  There was plenty of drama in the forum as well, with the requisite crazy people, trolls and idiots making life interesting for everybody.</p>
<p>When World of Warcraft came out, I too quit EverQuest.  I played WoW for a few years and eventually quit that as well, all the while regularly checking the forum, which had long since lost its gaming focus, and just became an &#8220;internet community&#8221; of unique people.  The site itself underwent several incarnations as the domain in one case was sold by the admin, and in another the subsequent admin got tired of running the site and shut it all down.  The most recent incarnation was hosted by a member of the community who acquired the MySQL dump of the DB from the previous admin.  Once everything was back up and running, it was nice to be &#8220;back.&#8221;  It&#8217;s hard having a community ripped away.</p>
<p>Things went ok for a few years.  The newest admin was a good guy who knew what he was doing.  In response to a flood of spam accounts that were created, he ended up disabling registrations (each account had to be manually approved by him).  Since our site was closed to the outside world (you had to be logged in to see anything) and the game that was the original focus of the site was <a href="http://www.google.com/insights/search/#q=everquest&#038;cmpt=q">basically dead</a>, this pretty much guaranteed we&#8217;d never have any new members in our community.  This was kind of sad, but there wasn&#8217;t really anything anyone could do about it.</p>
<p>Then one day last year I went to the site and it was down with a message from Hostgator saying &#8220;Hey, your account&#8217;s expired.&#8221;  It was like that for a few days.  Eventually people got concerned and after some digging, it was discovered  that the admin had killed himself.  Another member of the forum contacted Hostgator and paid to turn the site back on.  He tried to get admin access to the Hostgator account but apparently that requires the original user&#8217;s credit card info, so basically we were out of luck.  We all contributed via paypal and kept the site up indefinitely (in the now-deceased admin&#8217;s name) until we could hopefully get admin access to either phpBB or MySQL and get a mysqldump and move it to a new site.  </p>
<p>Unfortunately, this didn&#8217;t happen in time, and this morning the domain expired in Godaddy.  I don&#8217;t know if Godaddy will allow someone else to pay the bill, but I figured now was a good time to see if there was a way to download an archived version of the site.  That way, even if the site is gone forever, at least the history will exist somewhere.  I tried this a few months ago with some flags to <code>wget --mirror</code> but wget would get stuck in this endless loop appending new session IDs and save hundreds of copies of each page/post/topic.  </p>
<p>What I ended up doing that&#8217;s actually successful is iterating over the topic IDs starting at 1 up to the maximum (that I know of) and saving the output to disk.  My script for doing this is below.  It might not be ideal but it does get the job done for me.  </p>
<p>But on a more &#8220;meta&#8221; level, this is a really strange situation.  There&#8217;s a community of 30-40 people relatively used to each other.  We could move to another site, but many people didn&#8217;t want to do this because they didn&#8217;t want to lose the history.  Maybe now that I have the site archived, people will feel more comfortable moving.  I&#8217;m still able to access the site because, being the nerd that I am, I did a <code>dig</code> against Hostgator&#8217;s nameservers, which still had the correct IP address of the site, and like other shared hosting platforms you can access the site via <code>http://(ip address)/~(username)/ </code>, and that&#8217;s how my perl script is able to fetch the data.  But the other 30-40 people aren&#8217;t going to have any idea how to do that, so even if we move to a new site now, most people won&#8217;t know what that new site is.  I suppose we could buy an ad in AdWords so if people search for the old site name the new one comes up, but that seems like a mess.</p>
<p>What a strange 21st-century problem.  I imagine this has happened before in other online communities; the founder dies, or just leaves and the rest of the community is left just kind of drifting.  Anyway, here&#8217;s my script.  In order to fetch actual data as a logged-in user, I used <a href="https://addons.mozilla.org/en-US/firefox/addon/live-http-headers/">LiveHTTPHeaders</a> to see what headers my browser was actually sending and copied them directly into the script.  You&#8217;ll need at least your SID.  For whatever reason, when I logged in via IP address, my browser wasn&#8217;t sending any <code>Cookie:</code> headers, so those aren&#8217;t included in the script.  </p>
<p><script src="https://gist.github.com/2030469.js?file=fetch-phpbb.pl"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2012/03/13/when-the-admin-of-your-online-community-dies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Nginx as a caching proxy in front of WordPress</title>
		<link>http://www.evanhoffman.com/evan/2012/03/07/using-nginx-as-a-caching-proxy-in-front-of-wordpress/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-nginx-as-a-caching-proxy-in-front-of-wordpress</link>
		<comments>http://www.evanhoffman.com/evan/2012/03/07/using-nginx-as-a-caching-proxy-in-front-of-wordpress/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 21:43:28 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1920</guid>
		<description><![CDATA[Why you may want to use Nginx as a caching reverse-proxy in front of Apache for Wordpress, and config examples for doing so. <a href="http://www.evanhoffman.com/evan/2012/03/07/using-nginx-as-a-caching-proxy-in-front-of-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2012/03/07/using-nginx-as-a-caching-proxy-in-front-of-wordpress/"></g:plusone></div><p>When I first started monkeying around with Nginx about a year ago, I approached it as a typical Apache fanboy.  I&#8217;ve used Apache for 10+ years and it&#8217;s been a champ most of the time.  Anyone familiar with Apache knows that you can do just about anything with it.  It&#8217;s really the Swiss-army knife of webservers.<br />
<span id="more-1920"></span><br />
So it was with some skepticism that I installed nginx and started playing around with it.  The first thing that struck me was the simplicity of the configuration.  The second was the speed.  I read <a href="http://arstechnica.com/business/news/2011/11/a-faster-web-server-ripping-out-apache-for-nginx.ars">this story on Ars Technica</a> which detailed one guy&#8217;s experience replacing Apache with Nginx for serving zillions of static files &#8211; something at which Nginx excels.  The third thing that struck me about Nginx was the philosophy of the project.  From <a href="http://wiki.nginx.org/WhyUseIt">&#8220;Why Use It&#8221;</a></p>
<blockquote><p>Apache is like Microsoft Word, it has a million options but you only need six. Nginx does those six things, and it does five of them 50 times faster than Apache.</p>
<p>&#8211; Chris Lea </p></blockquote>
<p>So, to put in less pejorative terms, Apache is the Swiss-army knife while Nginx is an Xacto knife.</p>
<p>I quickly became a fan of Nginx, but I wasn&#8217;t going to dump Apache.  Apache&#8217;s still great, and sometimes it&#8217;s just not worth the effort to gut a site and rebuild it with Apache.  But after some more reading about Nginx features and use-cases, I started to realize I didn&#8217;t necessarily drop Apache to leverage some of Nginx&#8217;s awesomeness.  </p>
<p>One of the most common uses for Nginx is as a <a href="http://www.evanhoffman.com/evan/?p=1764">reverse-proxy</a>, sometimes as a load-balancer.  But Nginx also makes it really easy to use it as a caching reverse-proxy.  This is commonly done for caching static content in front of another webserver (sometimes Apache), letting you leverage the awesome performance of Nginx without losing any of Apache&#8217;s functionality.  This is what I really wanted to do&#8230; I had a couple of Apache-based sites that were getting swamped, in some cases apparently due to the volume of image requests &#8211; prime candidate for reverse-proxying.  Another was a WordPress blog on a severely underpowered server.</p>
<p>The config for caching reverse-proxy is really trivial; there are <a href="http://wiki.nginx.org/HttpProxyModule">examples</a> all over the internet, but here&#8217;s the gist:</p>

<div class="wp_syntax"><div class="code"><pre class="config" style="font-family:monospace;">proxy_cache_path  /var/lib/nginx/cache/staticfiles  levels=1:2   keys_zone=staticfilecache:60m inactive=90m  max_size=50m;
proxy_temp_path /var/lib/nginx/proxy;
proxy_connect_timeout 30;
proxy_read_timeout 120;
proxy_send_timeout 120;
&nbsp;
upstream blah {
        server  127.0.0.1:88;
}
&nbsp;
server {
 &lt;blah blah&gt;
        location ~* /evan/.+\.(jpg|png|gif|jpeg|css|js|mp3|wav|swf|mov|ico)$ {
                        proxy_cache_valid 200 120m;
                        expires 864000;
                        proxy_pass http://blah;
                        proxy_cache staticfilecache;
        }
}</pre></div></div>

<p>This instructs Nginx to cache static content (images, js, audio, video) requests that result in a 200 OK from the upstream for 120 minutes.  The <tt>proxy_cache_path</tt> directive describes the &#8220;caching area,&#8221; specifying the on-disk path for cached objects, how many objects to cache (60m), the maximum size of the cache (50 MB), and after how much inactivity to delete them (90 minutes).  That&#8217;s a whole lot of awesome in a couple of config lines.</p>
<p>So, this all works, but I wanted to cache the actual WordPress content pages as well, since each page requires hitting the MySQL DB, and most of the sites I manage are rarely updated.  I created another key zone (caching area) for PHP content and told it to cache for 20 minutes.  There were some problems with this though:</p>
<ol>
<li>I didn&#8217;t want to cache (or serve cached versions of) the WordPress admin pages.  It&#8217;s important to distinguish between caching (the temporary storage on the proxy of the content generated by the source server) and serving of cached content, since Nginx lets you specify settings for both actions independently.  The easiest workaround I found for this was putting a .htaccess file in the wp-admin directory with the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">SSLRequireSSL
Header <span style="color: #000000; font-weight: bold;">set</span> Cache-Control <span style="color: #ff0000;">&quot;no-cache&quot;</span>
Header <span style="color: #000000; font-weight: bold;">set</span> X-Accel-Expires <span style="color: #ff0000;">&quot;0&quot;</span>
Header <span style="color: #000000; font-weight: bold;">set</span> Expires <span style="color: #ff0000;">&quot;Wed, 1 Jun 2011 20:00:00 GMT&quot;</span></pre></div></div>

<p>Any of these headers should be enough to force Nginx not to cache the contents; I have them all in there just to be safe.  SSLRequireSSL forces https for admin.
</li>
<li>I didn&#8217;t want to cache (or serve cached versions of) any page while I was logged in.  When logged in, there&#8217;s a black bar at the top of the page with links to &#8220;edit post&#8221; or &#8220;go to dashboard,&#8221; and I wasn&#8217;t it them in some cases (I was being shown the non-logged-in cached page), and in some cases it would cache the logged-in version of the page, showing it to non-logged-in people, both bad situations.  Based on <a href="http://jeradbitner.com/blog/2012/02/09/nginx-do-not-cache-logged-in-drupal-or-wordpress-users/">this example</a>, I added this to my Nginx config:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">map <span style="color: #007800;">$http_cookie</span> <span style="color: #007800;">$logged_in</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    default <span style="color: #000000;">0</span>;
    ~wordpress_logged_in <span style="color: #000000;">1</span>; <span style="color: #666666; font-style: italic;"># Wordpress session cookie</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
server <span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>bla bla<span style="color: #000000; font-weight: bold;">&gt;</span>
        location <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
                proxy_pass http:<span style="color: #000000; font-weight: bold;">//</span>blah<span style="color: #000000; font-weight: bold;">/</span>;
                proxy_redirect  http:<span style="color: #000000; font-weight: bold;">//</span>blah<span style="color: #000000; font-weight: bold;">/</span>  http:<span style="color: #000000; font-weight: bold;">//</span><span style="color: #007800;">$host</span><span style="color: #000000; font-weight: bold;">/</span>;
&nbsp;
                proxy_cache_bypass <span style="color: #007800;">$logged_in</span>;
                proxy_no_cache <span style="color: #007800;">$logged_in</span>;
&nbsp;
                proxy_cache php;
                proxy_cache_valid <span style="color: #000000;">200</span> 30m;
                expires 5m;
        <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>If logged in, both proxy_cache_bypass and proxy_no_cache are set to &#8220;1&#8243;, so all my logged-in request bypass the cache entirely.
</li>
<li>I have the WPTouch plugin installed so iPhone users see a more iPhone-friendly version (rather than the regular site shrunk down to the iPhone&#8217;s screen size.  I didn&#8217;t want desktop users seeing cached iPhone versions of the pages, and vice versa.  To solve this, I set a $mobile var if &#8220;iphone&#8221; or &#8220;android&#8221; appear in $http_user_agent and incorporate that value into the proxy_cache_key.  This way every page is still cached, but mobile users see the mobile version, and desktop users see the desktop version:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">        <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">$mobile</span> <span style="color: #ff0000;">&quot;_not_mobile_&quot;</span>;
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$http_user_agent</span> ~<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #ff0000;">&quot;iPhone&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">$mobile</span> <span style="color: #ff0000;">&quot;mobile&quot;</span>;
        <span style="color: #7a0874; font-weight: bold;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$http_user_agent</span> ~<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #ff0000;">&quot;Android&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">$mobile</span> <span style="color: #ff0000;">&quot;mobile&quot;</span>;
        <span style="color: #7a0874; font-weight: bold;">&#125;</span>
        location <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
                proxy_pass http:<span style="color: #000000; font-weight: bold;">//</span>blah<span style="color: #000000; font-weight: bold;">/</span>;
                proxy_redirect  http:<span style="color: #000000; font-weight: bold;">//</span>blah<span style="color: #000000; font-weight: bold;">/</span>  http:<span style="color: #000000; font-weight: bold;">//</span><span style="color: #007800;">$host</span><span style="color: #000000; font-weight: bold;">/</span>;
&nbsp;
                proxy_cache_key <span style="color: #ff0000;">&quot;<span style="color: #007800;">$mobile</span>.<span style="color: #007800;">$scheme</span><span style="color: #007800;">$host</span><span style="color: #007800;">$request_uri</span>&quot;</span>;
&nbsp;
                proxy_cache_bypass <span style="color: #007800;">$logged_in</span>;
                proxy_no_cache <span style="color: #007800;">$logged_in</span>;
&nbsp;
                proxy_cache php;
                proxy_cache_valid <span style="color: #000000;">200</span> 30m;
                expires 5m;
        <span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

</li>
</ol>
<p>So far this config has been working out pretty well.  Uncached pages still load slow, but subsequent cached loads are pretty quick.  I tweak it regularly, but here&#8217;s what I have currently, with Apache listening on 8888:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
</pre></td><td class="code"><pre class="config" style="font-family:monospace;"># Wordpress reverse-proxy config
proxy_cache_path  /var/lib/nginx/cache/staticfiles  levels=1:2   keys_zone=staticfilecache:60m inactive=90m  max_size=50m;
proxy_cache_path  /var/lib/nginx/cache/php levels=2:2 keys_zone=php:30m inactive=60m max_size=50m;
proxy_temp_path /var/lib/nginx/proxy;
proxy_connect_timeout 30;
proxy_read_timeout 120;
proxy_send_timeout 120;
&nbsp;
proxy_cache_key &quot;$scheme$host$request_uri&quot;;
# http://wp-performance.com/2010/10/nginx-reverse-proxy-cache-wordpress-apache/
&nbsp;
map $http_cookie $logged_in {
    default 0;
    ~wordpress_logged_in 1; # Wordpress session cookie
}
&nbsp;
upstream apache {
        server  127.0.0.1:8888;
}
&nbsp;
server {
        proxy_cache_valid 200 20m;
&nbsp;
        listen 80 default_server;
        server_name _;
&nbsp;
        access_log  /var/log/nginx/combined-access.log combined;
&nbsp;
        proxy_set_header X-Real-IP  $remote_addr;
&nbsp;
        proxy_set_header Host $host;
&nbsp;
        proxy_set_header X-Forwarded-For $remote_addr;
&nbsp;
        proxy_set_header X-NginX-Proxy true;
&nbsp;
        set $mobile &quot;_not_mobile_&quot;;
        if ($http_user_agent ~* &quot;iPhone&quot;) {
                set $mobile &quot;iphone&quot;;
        }
        if ($http_user_agent ~* &quot;Android&quot;) {
                set $mobile &quot;android&quot;;
        }
&nbsp;
        location / {
                proxy_pass http://apache/;
                proxy_redirect  http://apache/  http://$host/;
        }
&nbsp;
        location /evan/ {
                proxy_pass http://apache/evan/;
                proxy_redirect  http://apache/  http://$host/;
&nbsp;
                proxy_cache_key &quot;$mobile.$scheme$host$request_uri&quot;;
&nbsp;
                proxy_cache_bypass $logged_in;
                proxy_no_cache $logged_in;
&nbsp;
                proxy_cache php;
                proxy_cache_valid 200 30m;
                expires 5m;
        }
&nbsp;
        location /evan/wp-admin/ {
                proxy_pass http://apache/evan/wp-admin/;
                proxy_redirect  http://apache/  http://$host/;
        }
&nbsp;
        location ~* /evan/.+\.(jpg|png|gif|jpeg|css|js|mp3|wav|swf|mov|ico)$ {
                        proxy_cache_valid 200 120m;
                        expires 864000;
                        proxy_pass http://apache;
                        proxy_cache staticfilecache;
        }
&nbsp;
        location = /50x.html {
                root   /var/www/nginx-default;
        }
&nbsp;
        # No access to .htaccess files.
        location ~ /\.ht {
                deny  all;
        }
&nbsp;
        }</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2012/03/07/using-nginx-as-a-caching-proxy-in-front-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reorganizing photos in 1 line with exiftool</title>
		<link>http://www.evanhoffman.com/evan/2012/03/02/reorganizing-photos-in-1-line-with-exiftool/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=reorganizing-photos-in-1-line-with-exiftool</link>
		<comments>http://www.evanhoffman.com/evan/2012/03/02/reorganizing-photos-in-1-line-with-exiftool/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 15:01:11 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[exif]]></category>
		<category><![CDATA[exiftool]]></category>
		<category><![CDATA[jpeg]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1869</guid>
		<description><![CDATA[A few years ago I wrote a utility in Java to find all JPG files in a directory and move them into a date-based directory structure like /YYYY/MM/DD/ based on the date the photo was taken, extracted from the exif &#8230; <a href="http://www.evanhoffman.com/evan/2012/03/02/reorganizing-photos-in-1-line-with-exiftool/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2012/03/02/reorganizing-photos-in-1-line-with-exiftool/"></g:plusone></div><p>A few years ago I wrote <a href="http://www.evanhoffman.com/evan/?p=34">a utility</a> in Java to find all JPG files in a directory and move them into a date-based directory structure like /YYYY/MM/DD/<file> based on the date the photo was taken, extracted from the exif metadata in the file.  Well, apparently that was a huge waste of time, as I just discovered that <code>exiftool</code>, an awesome perl utility I&#8217;ve used for years to edit/extract the metadata on the command line, can also do this natively.  So my entire program can be replaced with this simple command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ exiftool <span style="color: #660033;">-r</span> <span style="color: #ff0000;">'-FileName&lt;CreateDate'</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>targetDir<span style="color: #000000; font-weight: bold;">/%</span>Y<span style="color: #000000; font-weight: bold;">/%</span>Y-<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">/%</span>Y-<span style="color: #000000; font-weight: bold;">%</span>m-<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #000000; font-weight: bold;">/%</span>Y-<span style="color: #000000; font-weight: bold;">%</span>m-<span style="color: #000000; font-weight: bold;">%</span>d.<span style="color: #000000; font-weight: bold;">%%</span>f.<span style="color: #000000; font-weight: bold;">%%</span>e <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>EOS_DIGITAL<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>This will copy the files directly off the SD card mounted at /media/EOS_DIGITAL/ into the proper structure in /targetDir/.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2012/03/02/reorganizing-photos-in-1-line-with-exiftool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slow HTTP downloads through Cisco ASA 5500</title>
		<link>http://www.evanhoffman.com/evan/2012/02/28/slow-http-downloads-through-cisco-asa-5500/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=slow-http-downloads-through-cisco-asa-5500</link>
		<comments>http://www.evanhoffman.com/evan/2012/02/28/slow-http-downloads-through-cisco-asa-5500/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 21:15:20 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[5500]]></category>
		<category><![CDATA[asa]]></category>
		<category><![CDATA[cisco]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[inspect]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[slow]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1856</guid>
		<description><![CDATA[Recently we noticed weird behavior downloading files from certain sites. The transfer would start out fast (around 10 MB/s), then after a couple of seconds it would plummet to around 9 KB/s. It didn&#8217;t happen for every file or every &#8230; <a href="http://www.evanhoffman.com/evan/2012/02/28/slow-http-downloads-through-cisco-asa-5500/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2012/02/28/slow-http-downloads-through-cisco-asa-5500/"></g:plusone></div><p>Recently we noticed weird behavior downloading files from certain sites.  The transfer would start out fast (around 10 MB/s), then after a couple of seconds it would plummet to around 9 KB/s.  It didn&#8217;t happen for every file or every site: downloads from S3 buckets were still particularly fast.  But some files that I remember being particularly fast were now showing this weird fast/slow/fast/slow behavior, for example the <a href="http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-i586-rpm.bin">Sun JDK</a> and ISOs from <a href="http://mirrors.rit.edu/centos/6/isos/x86_64/">rit.edu</a> that used to saturate our pipe were now getting all cRAzY.</p>
<p>After some poking around I decided to test HTTP versus FTP to see if it could be an application/protocol-level issue.  The easiest way to do this was to find a file available via both FTP and HTTP and download it via both protocols.  This is where mirrors.rit.edu came in handy.  I used cURL to download it and noticed that via HTTP it was much slower than over FTP:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>evan<span style="color: #000000; font-weight: bold;">@</span>boba <span style="color: #000000;">16</span>:07:03 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ curl <span style="color: #660033;">-O</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>mirrors.rit.edu<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>centos<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">6</span><span style="color: #000000; font-weight: bold;">/</span>isos<span style="color: #000000; font-weight: bold;">/</span>x86_64<span style="color: #000000; font-weight: bold;">/</span>CentOS-<span style="color: #000000;">6.2</span>-x86_64-netinstall.iso
  <span style="color: #000000; font-weight: bold;">%</span> Total    <span style="color: #000000; font-weight: bold;">%</span> Received <span style="color: #000000; font-weight: bold;">%</span> Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
<span style="color: #000000;">100</span>  227M  <span style="color: #000000;">100</span>  227M    <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>   9.8M      <span style="color: #000000;">0</span>  <span style="color: #000000;">0</span>:00:<span style="color: #000000;">22</span>  <span style="color: #000000;">0</span>:00:<span style="color: #000000;">22</span> --:--:-- 7816k
<span style="color: #7a0874; font-weight: bold;">&#91;</span>evan<span style="color: #000000; font-weight: bold;">@</span>boba <span style="color: #000000;">16</span>:07:<span style="color: #000000;">33</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">rm</span> CentOS-<span style="color: #000000;">6.2</span>-x86_64-netinstall.iso 
<span style="color: #7a0874; font-weight: bold;">&#91;</span>evan<span style="color: #000000; font-weight: bold;">@</span>boba <span style="color: #000000;">16</span>:07:<span style="color: #000000;">39</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ curl <span style="color: #660033;">-O</span> http:<span style="color: #000000; font-weight: bold;">//</span>mirrors.rit.edu<span style="color: #000000; font-weight: bold;">/</span>centos<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">6</span><span style="color: #000000; font-weight: bold;">/</span>isos<span style="color: #000000; font-weight: bold;">/</span>x86_64<span style="color: #000000; font-weight: bold;">/</span>CentOS-<span style="color: #000000;">6.2</span>-x86_64-netinstall.iso
  <span style="color: #000000; font-weight: bold;">%</span> Total    <span style="color: #000000; font-weight: bold;">%</span> Received <span style="color: #000000; font-weight: bold;">%</span> Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
<span style="color: #000000;">100</span>  227M  <span style="color: #000000;">100</span>  227M    <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>  5686k      <span style="color: #000000;">0</span>  <span style="color: #000000;">0</span>:00:<span style="color: #000000;">40</span>  <span style="color: #000000;">0</span>:00:<span style="color: #000000;">40</span> --:--:-- 6269k</pre></div></div>

<p>22 seconds via FTP at 9.8MB/s average, 40 seconds over HTTP at 5.6 MB/s average (which was one of the better HTTP runs).</p>
<p>This was affecting all machines on our network, and had nothing to do with the per-machine iptables rules (verified by flushing all rules).  The only thing I could think of that might affect all machines, but only HTTP and not FTP would be something like packet inspection.  Well, turns out that <a href="http://www.cisco.com/en/US/docs/security/asa/asa82/configuration/guide/inspect_basic.html#wp1514315">http packet inspection</a> is on by default on the ASA.  So I disabled it as described <a href="http://www.cisco.com/en/US/products/hw/vpndevc/ps2030/products_tech_note09186a008085283d.shtml#disab">here</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Zeus<span style="color: #7a0874; font-weight: bold;">&#40;</span>config<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #666666; font-style: italic;"># conf t</span>
Zeus<span style="color: #7a0874; font-weight: bold;">&#40;</span>config<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #666666; font-style: italic;"># policy-map global_policy</span>
Zeus<span style="color: #7a0874; font-weight: bold;">&#40;</span>config-pmap<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #666666; font-style: italic;"># class inspection_default</span>
Zeus<span style="color: #7a0874; font-weight: bold;">&#40;</span>config-pmap-c<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #666666; font-style: italic;"># no inspect http</span>
Zeus<span style="color: #7a0874; font-weight: bold;">&#40;</span>config-pmap-c<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #666666; font-style: italic;"># write mem</span>
Building configuration...</pre></div></div>

<p>Since then HTTP transfers have been consistently fast.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2012/02/28/slow-http-downloads-through-cisco-asa-5500/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using rrdtool to generate server load &amp; bandwidth graphs</title>
		<link>http://www.evanhoffman.com/evan/2012/02/17/using-rrdtool-to-generate-server-load-bandwidth-graphs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-rrdtool-to-generate-server-load-bandwidth-graphs</link>
		<comments>http://www.evanhoffman.com/evan/2012/02/17/using-rrdtool-to-generate-server-load-bandwidth-graphs/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 20:32:25 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[graphs]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[load]]></category>
		<category><![CDATA[mrtg]]></category>
		<category><![CDATA[rrdtool]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1842</guid>
		<description><![CDATA[I&#8217;ve been using MRTG and routers2.cgi for years to graph the various aspects of a server that warrant monitoring. I&#8217;ve long known that they used something called rrdtool to do&#8230; well, something, but never had a need or desire to &#8230; <a href="http://www.evanhoffman.com/evan/2012/02/17/using-rrdtool-to-generate-server-load-bandwidth-graphs/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2012/02/17/using-rrdtool-to-generate-server-load-bandwidth-graphs/"></g:plusone></div><p>I&#8217;ve been using MRTG and routers2.cgi for years to graph the various aspects of a server that warrant monitoring.  I&#8217;ve long known that they used something called rrdtool to do&#8230; well, something, but never had a need or desire to figure out exactly what that was.</p>
<p>But, having just moved my site to a new server, I was curious how the server would handle the load.  Rather than setting up some behemoth like Nagios or Zabbix, which are full monitoring/alerting suites, I just wanted graphing.  As I said, in the past I&#8217;ve used MRTG or routers2.cgi for this but both of them were overkill for me in this case.  Since both of them used rrdtool, I figured that was a good place to look.</p>
<p>The two metrics I want to record are server load and in/out bandwidth.  The first step is to create the RRDs (round robin databases).  This was done via these commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># rrdtool create /mrtg/load.rrd --start N DS:load1:GAUGE:600:0:100 DS:load5:GAUGE:600:0:100 DS:load15:GAUGE:600:0:100 RRA:AVERAGE:0.5:2:800</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># rrdtool create /mrtg/eth1.rrd --start N DS:in:COUNTER:600:0:10000000000 DS:out:COUNTER:600:0:10000000000 RRA:AVERAGE:0.5:2:800</span></pre></div></div>

<p>A good explanation of what these various fields mean is <a href="http://silverwraith.com/papers/freebsd-snmp.php">here</a>.  In short, each &#8220;<tt>DS:</tt>&#8221; section defines a &#8220;column&#8221; (for fellow RDBMS users) in the database.  The first one has 3 &#8220;columns,&#8221; named load1, load5, load15, each of which will contain GAUGE data.  The second one contains two COUNTER fields, representing the bytes in/out for interface eth1.</p>
<p>To actually get the data I poll snmpd via this bash script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
rrdupdate <span style="color: #000000; font-weight: bold;">/</span>mrtg<span style="color: #000000; font-weight: bold;">/</span>load.rrd N:\
<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>snmpget <span style="color: #660033;">-v</span> 2c <span style="color: #660033;">-c</span> public <span style="color: #660033;">-Oqv</span> localhost laLoad.1<span style="color: #000000; font-weight: bold;">`</span>:\
<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>snmpget <span style="color: #660033;">-v</span> 2c <span style="color: #660033;">-c</span> public <span style="color: #660033;">-Oqv</span> localhost laLoad.2<span style="color: #000000; font-weight: bold;">`</span>:\
<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>snmpget <span style="color: #660033;">-v</span> 2c <span style="color: #660033;">-c</span> public <span style="color: #660033;">-Oqv</span> localhost laLoad.3<span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
rrdupdate <span style="color: #000000; font-weight: bold;">/</span>mrtg<span style="color: #000000; font-weight: bold;">/</span>eth1.rrd N:\
<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>snmpget <span style="color: #660033;">-v</span> 2c <span style="color: #660033;">-c</span> public <span style="color: #660033;">-Oqv</span> localhost ifInOctets.3<span style="color: #000000; font-weight: bold;">`</span>:\
<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>snmpget <span style="color: #660033;">-v</span> 2c <span style="color: #660033;">-c</span> public <span style="color: #660033;">-Oqv</span> localhost ifOutOctets.3<span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p>I have that run every 5 minutes via cron.  Then to generate the actual graph, I run this script via cron:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
rrdtool graph <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>load.png \
        <span style="color: #660033;">-N</span> \
        <span style="color: #660033;">-E</span> \
        <span style="color: #660033;">--start</span> now-30hours \
        <span style="color: #660033;">--title</span> <span style="color: #ff0000;">&quot;Load Averages&quot;</span> \
        <span style="color: #660033;">--width</span> <span style="color: #000000;">300</span>\
         <span style="color: #660033;">--x-grid</span> MINUTE:<span style="color: #000000;">60</span>:HOUR:<span style="color: #000000;">2</span>:HOUR:<span style="color: #000000;">4</span>:<span style="color: #000000;">0</span>:<span style="color: #000000; font-weight: bold;">%</span>H\
        <span style="color: #660033;">--height</span> <span style="color: #000000;">200</span> \
        <span style="color: #660033;">-u</span> <span style="color: #000000;">1.0</span> \
        <span style="color: #660033;">--lower-limit</span> <span style="color: #000000;">0</span>\
        <span style="color: #660033;">--vertical-label</span> <span style="color: #ff0000;">&quot;Load Avg&quot;</span> \
        <span style="color: #660033;">--full-size-mode</span> \
<span style="color: #660033;">-a</span> PNG <span style="color: #660033;">--title</span>=<span style="color: #ff0000;">&quot;Load Avg&quot;</span> \
<span style="color: #ff0000;">'DEF:load1=/mrtg/load.rrd:load1:AVERAGE'</span> \
<span style="color: #ff0000;">'VDEF:load1last=load1,LAST'</span> \
<span style="color: #ff0000;">'DEF:load5=/mrtg/load.rrd:load5:AVERAGE'</span> \
<span style="color: #ff0000;">'DEF:load15=/mrtg/load.rrd:load15:AVERAGE'</span> \
<span style="color: #ff0000;">'AREA:load15#33CC33:15 Min Load Avg '</span> \
<span style="color: #ff0000;">'LINE1:load1#0000ff:1 Min Load Avg '</span> \
<span style="color: #ff0000;">'GPRINT:load1:AVERAGE:&quot;Load1 Avg\:%3.2lf&quot;'</span> \
<span style="color: #ff0000;">'GPRINT:load1last:Drawn at %Y-%m-%d, %H\:%M:strftime'</span> 
<span style="color: #666666; font-style: italic;">#'LINE1:load5#ff00ff:5 Min Load Avg ' \</span>
&nbsp;
&nbsp;
rrdtool graph <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>eth1.png \
        <span style="color: #660033;">-N</span> \
        <span style="color: #660033;">-E</span> \
        <span style="color: #660033;">--start</span> now-30hours \
        <span style="color: #660033;">--title</span> <span style="color: #ff0000;">&quot;eth1 traffic&quot;</span> \
        <span style="color: #660033;">--width</span> <span style="color: #000000;">300</span>\
         <span style="color: #660033;">--x-grid</span> MINUTE:<span style="color: #000000;">60</span>:HOUR:<span style="color: #000000;">2</span>:HOUR:<span style="color: #000000;">4</span>:<span style="color: #000000;">0</span>:<span style="color: #000000; font-weight: bold;">%</span>H\
        <span style="color: #660033;">--height</span> <span style="color: #000000;">200</span> \
        <span style="color: #660033;">-u</span> <span style="color: #000000;">1000000</span> \
        <span style="color: #660033;">--lower-limit</span> <span style="color: #000000;">0</span>\
        <span style="color: #660033;">--vertical-label</span> <span style="color: #ff0000;">&quot;bps&quot;</span> \
        <span style="color: #660033;">--full-size-mode</span> \
<span style="color: #660033;">-a</span> PNG <span style="color: #660033;">--title</span>=<span style="color: #ff0000;">&quot;eth1 traffic&quot;</span> \
<span style="color: #ff0000;">'DEF:eth1in=/mrtg/eth1.rrd:in:AVERAGE'</span> \
<span style="color: #ff0000;">'CDEF:eth1inbits=eth1in,8,*'</span> \
<span style="color: #ff0000;">'VDEF:eth1last=eth1in,LAST'</span> \
<span style="color: #ff0000;">'DEF:eth1out=/mrtg/eth1.rrd:out:AVERAGE'</span> \
<span style="color: #ff0000;">'CDEF:eth1outbits=eth1out,8,*'</span> \
<span style="color: #ff0000;">'AREA:eth1inbits#33CC33:eth1 in '</span> \
<span style="color: #ff0000;">'LINE1:eth1outbits#0000ff:eth1 out'</span> \
<span style="color: #ff0000;">'GPRINT:eth1last:Drawn at %Y-%m-%d, %H\:%M:strftime'</span></pre></div></div>

<p>The final graphs look decent, though not very fancy, but I&#8217;ll play around with it a bit more:</p>
<div id="attachment_1850" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.evanhoffman.com/evan/2012/02/17/using-rrdtool-to-generate-server-load-bandwidth-graphs/eth1-2/" rel="attachment wp-att-1850"><img src="http://www.evanhoffman.com/evan/wp-content/uploads/2012/02/eth1.png" alt="eth1 graph" title="eth1 graph" width="300" height="200" class="size-full wp-image-1850" /></a><p class="wp-caption-text">eth1 graph</p></div>
<div id="attachment_1851" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.evanhoffman.com/evan/2012/02/17/using-rrdtool-to-generate-server-load-bandwidth-graphs/load-2/" rel="attachment wp-att-1851"><img src="http://www.evanhoffman.com/evan/wp-content/uploads/2012/02/load.png" alt="load graph" title="load graph" width="300" height="200" class="size-full wp-image-1851" /></a><p class="wp-caption-text">load graph</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2012/02/17/using-rrdtool-to-generate-server-load-bandwidth-graphs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upcoming downtime</title>
		<link>http://www.evanhoffman.com/evan/2012/02/14/upcoming-downtime/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=upcoming-downtime</link>
		<comments>http://www.evanhoffman.com/evan/2012/02/14/upcoming-downtime/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 16:33:57 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[downtime]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[justhost]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[money]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1838</guid>
		<description><![CDATA[I&#8217;ll be moving this site to a new hosting provider over the next few days, so there will likely be some downtime. Not that this site gets that many repeat visitors, but figured I&#8217;d give a heads-up so Google can &#8230; <a href="http://www.evanhoffman.com/evan/2012/02/14/upcoming-downtime/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2012/02/14/upcoming-downtime/"></g:plusone></div><p>I&#8217;ll be moving this site to a new hosting provider over the next few days, so there will likely be some downtime.  Not that this site gets that many repeat visitors, but figured I&#8217;d give a heads-up so Google can cache this ahead of time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2012/02/14/upcoming-downtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Load balancing in EC2 with Nginx and HAProxy</title>
		<link>http://www.evanhoffman.com/evan/2012/01/09/load-balancing-in-ec2-with-nginx-and-haproxy/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=load-balancing-in-ec2-with-nginx-and-haproxy</link>
		<comments>http://www.evanhoffman.com/evan/2012/01/09/load-balancing-in-ec2-with-nginx-and-haproxy/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 22:00:22 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[elastic loadbalancer]]></category>
		<category><![CDATA[elb]]></category>
		<category><![CDATA[gslb]]></category>
		<category><![CDATA[haproxy]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[load balancer]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[reverse proxy]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1764</guid>
		<description><![CDATA[We wanted to setup a loadbalanced web cluster in AWS for expansion. My first inclination was to use ELB for this, but I soon learned that ELB doesn&#8217;t let you allocate a static IP, requiring you to refer to it &#8230; <a href="http://www.evanhoffman.com/evan/2012/01/09/load-balancing-in-ec2-with-nginx-and-haproxy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2012/01/09/load-balancing-in-ec2-with-nginx-and-haproxy/"></g:plusone></div><p>We wanted to setup a loadbalanced web cluster in AWS for expansion.  My first inclination was to use <a href="http://aws.amazon.com/elasticloadbalancing/">ELB</a> for this, but I soon learned that ELB doesn&#8217;t let you allocate a static IP, requiring you to refer to it only by DNS name.  This would be OK except for the fact that our current DNS provider, <a href="http://dyn.com/dns/dynect-managed-dns/">Dyn</a>, requires IP addresses when using their GSLB (geo-based load balancer) service.</p>
<p>Rather than let this derail the whole project, I decided to look into the software options available for loadbalancing in EC2.  I&#8217;ve been a fan of hardware load balancers for a while, sort of looking down at software-based solutions without any real rationale, but in this case I really had no choice so I figured I&#8217;d give it a try.</p>
<p>My first stop was Nginx.  I&#8217;ve used it before in a reverse-proxy scenario and like it.  The problem I had with it was that it doesn&#8217;t support active polling of nodes &#8211; the ability to send requests to the webserver and mark the node as up or down based on the response.  As far as I can tell, using <a href="http://wiki.nginx.org/HttpUpstreamModule">multiple upstream servers</a> in Nginx allows you to specify <tt>max_fails</tt> and <tt>fail_timeout</tt>, however a &#8220;fail&#8221; is determined when a real request comes in.  I don&#8217;t want to risk losing a real request &#8211; I like active polling.<br />
<span id="more-1764"></span><br />
This led me to HAProxy.  I&#8217;d never used HAProxy before but it seemed to be ideally suited to this (since it&#8217;s exclusively a load balancer).  The <tt>option httpchk</tt> even allows for active polling of nodes &#8211; yay!</p>
<p>Unfortunately, HAProxy doesn&#8217;t support SSL.  From <a href="http://haproxy.1wt.eu/">the HAProxy site</a>:</p>
<blockquote><p>People often ask for SSL and Keep-Alive support. Both features will complicate the code and render it fragile for several releases. By the way, both features have a negative impact on performance :</p>
<p>    Having SSL in the load balancer itself means that it becomes the bottleneck. When the load balancer&#8217;s CPU is saturated, the overall response times will increase and the only solution will be to multiply the load balancer with another load balancer in front of them. the only scalable solution is to have an SSL/Cache layer between the clients and the load balancer. Anyway for small sites it still makes sense to embed SSL, and it&#8217;s currently being studied. There has been some work on the CyaSSL library to ease integration with HAProxy, as it appears to be the only one out there to let you manage your memory yourself. </p></blockquote>
<p>Poop!  I figured out a workaround however, by using both Nginx and HAProxy on the same instance.  HAProxy listens on port 80 and 8443 (so that it can relay decrypted SSL traffic to the nodes on a separate port, so that the nodes are aware that it was originally SSL traffic).  Nginx is configured as a reverse proxy, listens on port 443 only, and has the SSL cert &#038; key.  The upstream for the Nginx is just localhost:8443 &#8211; HAProxy.  </p>
<p>This was pretty easy to setup and works very well.  I benchmarked HAProxy on an EC2 t1.micro instance (in front of two m1.large instances running our webapp) using <tt>ab -n 5000 -c 50 -t 60</tt> and found it actually performed better than one of our hardware load balancers.  That was pretty eye-opening (and sad).</p>
<p>The HAProxy and Nginx configs are below, in the hopes that it helps someone.  The main warning I&#8217;d give is that using this will cause the logs on your nodes to interpret all requests as coming from the IP of the load balancer.  I had to rewrite some code to have the app use the X-Forwarded-For address rather than the <a href="http://docs.oracle.com/javaee/5/api/javax/servlet/ServletRequest.html#getRemoteAddr%28%29">REMOTE_ADDR</a>, but other than that this has been working out pretty well.</p>
<p>/etc/nginx/nginx.conf<br />
Main thing is to make sure the server isn&#8217;t listening on port 80 (since HAProxy needs to).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
</pre></td><td class="code"><pre class="txt" style="font-family:monospace;">user              nginx;
worker_processes  1;
&nbsp;
error_log  /var/log/nginx/error.log;
&nbsp;
pid        /var/run/nginx.pid;
&nbsp;
events {
    worker_connections  1024;
}
&nbsp;
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
&nbsp;
    log_format  main  '$remote_addr - $remote_user [$time_local] &quot;$request&quot; '
                      '$status $body_bytes_sent &quot;$http_referer&quot; '
                      '&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;';
&nbsp;
    access_log  /var/log/nginx/access.log  main;
&nbsp;
    sendfile        on;
    keepalive_timeout  65;
&nbsp;
    #
    # The default server
    #
    server {
        listen       81;
        server_name  _;
&nbsp;
        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }
&nbsp;
        error_page  404              /404.html;
        location = /404.html {
            root   /usr/share/nginx/html;
        }
&nbsp;
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
&nbsp;
    }
&nbsp;
    # Load config files from the /etc/nginx/conf.d directory
    include /etc/nginx/conf.d/*.conf;
&nbsp;
}</pre></td></tr></table></div>

<p>/etc/nginx/conf.d/ssl-offloader.conf</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="txt" style="font-family:monospace;">upstream haproxy {
        server localhost:8443 ;
}
&nbsp;
server {
        listen       443;
        server_name f.q.d.n 1.2.3.4 ; # I put the FQDN and IP here, but maybe &quot;_&quot; will work too
#  server_name  _;
&nbsp;
        ssl                  on;
        ssl_certificate      /etc/nginx/ssl-cert/cert.pem;
        ssl_certificate_key  /etc/nginx/ssl-cert/cert.key;
&nbsp;
        ssl_session_timeout  5m;
&nbsp;
        ssl_protocols  SSLv3 TLSv1;
        ssl_ciphers     ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM;
        ssl_prefer_server_ciphers   on;
&nbsp;
        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_set_header X-NginX-Proxy true;
&nbsp;
                proxy_pass http://haproxy/;
                proxy_redirect default;
                proxy_redirect http://$host/ https://$host/;
                proxy_redirect http://hostname/ https://$host/;
&nbsp;
                proxy_read_timeout 15s;
                proxy_connect_timeout 15s;
        }
&nbsp;
}</pre></td></tr></table></div>

<p>/etc/haproxy/haproxy.cfg</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
</pre></td><td class="code"><pre class="txt" style="font-family:monospace;">#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    log         127.0.0.1 local2
&nbsp;
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon
&nbsp;
    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats
&nbsp;
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    3s
    timeout queue           1m
    timeout connect         2s
    timeout client          5s
    timeout server          5s
    timeout http-keep-alive 1s
    timeout check           10s
    maxconn                 3000
&nbsp;
       stats enable
       stats auth evan:change_me_brother
&nbsp;
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend  main_http *:80
        option forwardfor except 127.0.0.1  
        option httpclose
        default_backend         web_http
&nbsp;
frontend main_https *:8443
        option forwardfor except 127.0.0.1  
        option httpclose
        default_backend         web_https
&nbsp;
#---------------------------------------------------------------------
# round robin balancing between the various backends
#---------------------------------------------------------------------
backend web_http
    balance     roundrobin
#       option httpchk GET / HTTP/1.1\r\nHost:\ host.com
        option httpchk
    server  node1 192.168.1.20:80 check port 80
    server  node2 192.168.1.30:80 check port 80
    server  node3 192.168.1.40:80 check port 80
&nbsp;
&nbsp;
backend web_https
    balance     roundrobin
#       option httpchk GET / HTTP/1.1\r\nHost:\ host.com
        option httpchk
    server  node1 192.168.1.20:8443 check port 8443
    server  node2 192.168.1.30:8443 check port 8443
    server  node3 192.168.1.40:8443 check port 8443</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2012/01/09/load-balancing-in-ec2-with-nginx-and-haproxy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iPad drops WiFi connection to Verizon FiOS Actiontec Router</title>
		<link>http://www.evanhoffman.com/evan/2012/01/01/ipad-drops-wifi-connection-to-verizon-fios-actiontec-router/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ipad-drops-wifi-connection-to-verizon-fios-actiontec-router</link>
		<comments>http://www.evanhoffman.com/evan/2012/01/01/ipad-drops-wifi-connection-to-verizon-fios-actiontec-router/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 04:19:08 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actiontec]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[drop]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[MI424WR]]></category>
		<category><![CDATA[MI424WR-GEN2]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[wifi]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1770</guid>
		<description><![CDATA[I got my wife an iPad 2 for Christmas and she soon started complaining about the Wifi dropping its connection. I suggested she try turning off the &#8220;auto join&#8221; wifi setting, but that didn&#8217;t help. She&#8217;d be doing something and &#8230; <a href="http://www.evanhoffman.com/evan/2012/01/01/ipad-drops-wifi-connection-to-verizon-fios-actiontec-router/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2012/01/01/ipad-drops-wifi-connection-to-verizon-fios-actiontec-router/"></g:plusone></div><p>I got my wife an iPad 2 for Christmas and she soon started complaining about the Wifi dropping its connection.  I suggested she try turning off the &#8220;auto join&#8221; wifi setting, but that didn&#8217;t help.  She&#8217;d be doing something and get the &#8220;Sorry, there&#8217;s no internet connection&#8221; error every 5-10 minutes.  We&#8217;ve had FiOS for quite a while and we have 8 or 9 other devices connected (including Macs &#038; iPhones) to the router without issue, so this seemed weird.  I was starting to think it was a problem with the iPad, but we went to a friend&#8217;s house and used his wifi (with a Netgear router) and the iPad had no issues.  </p>
<p>Back home, I logged into the router and tried assigning her iPad a static IP through DHCP.  I had her release and renew and she got the new IP but the problem continued.  Since we ruled out a problem with the iPad and I knew there was nothing &#8220;wrong&#8221; with the router, I figured I&#8217;d check and see if there are any reported issues with iPads and the Verizon router.  Sure enough, there are.  The first thing I clicked on, <a href="http://appletoolbox.com/2010/04/fix-for-verizon-fios-vs-ipad-wi-fi-issues/">Fix for Verizon FIOS vs. iPad Wi-Fi Issues</a>, suggested changing the wifi channel from &#8220;Automatic&#8221; to &#8220;6&#8243; (it also suggests switching from WEP to WPA2-PSK, which I&#8217;ve always been using).  I did that and it hasn&#8217;t dropped the wifi connection at all in the past 3 hours.  Very odd issue.  If I could get into the Actiontec (or the iPad for that matter) I&#8217;d like to check the logs and see what&#8217;s actually happening, but a win&#8217;s a win.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2012/01/01/ipad-drops-wifi-connection-to-verizon-fios-actiontec-router/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compellent &#8220;future proof?&#8221; Not so much.</title>
		<link>http://www.evanhoffman.com/evan/2011/12/21/compellent-future-proof-not-so-much/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=compellent-future-proof-not-so-much</link>
		<comments>http://www.evanhoffman.com/evan/2011/12/21/compellent-future-proof-not-so-much/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 04:39:33 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[compellent]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[iscsi]]></category>
		<category><![CDATA[money]]></category>
		<category><![CDATA[pci]]></category>
		<category><![CDATA[pci-e]]></category>
		<category><![CDATA[pci-x]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[sas]]></category>
		<category><![CDATA[stopwhining]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1761</guid>
		<description><![CDATA[So, I&#8217;ve written about Compellent a few times from a price perspective, mostly on the disk side. I was recently contacted by our vendor with quotes for two new Compellent controllers. &#8220;What&#8217;s this all about?&#8221; I asked. &#8220;Why don&#8217;t we &#8230; <a href="http://www.evanhoffman.com/evan/2011/12/21/compellent-future-proof-not-so-much/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2011/12/21/compellent-future-proof-not-so-much/"></g:plusone></div><p>So, I&#8217;ve written about Compellent a few times from a price perspective, mostly on the disk side.  I was recently contacted by our vendor with quotes for two new Compellent controllers.  &#8220;What&#8217;s this all about?&#8221; I asked.  &#8220;Why don&#8217;t we have a call with Compellent to discuss?&#8221; he replied.  I rolled my eyes a little but figured it was worth hearing them out, since our Compellent SAN is at the heart of our infrastructure.</p>
<p>We currently have two controllers setup in failover mode.  The first was bought in 2008 and the other in 2010 to add redundancy.  Earlier this year we upgraded to the latest software version in preparation for moving our production DB onto the SAN, to allow us a nice window before we had to perform another upgrade (which would now risk DB downtime&#8230; I like failover but I don&#8217;t trust it enough to have a DB up during a failover), so I was kind of skeptical about any sort of upgrade to begin with.  </p>
<p>On the call, the Compellent reps explained that they&#8217;ve dropped Fibre Channel connectivity between the controller and the disk enclosure, and the purpose of the upgrade is to give us SAS.  In addition, they no longer sell SATA (!).  I asked why we couldn&#8217;t simply add SAS cards to our existing controllers and was told that our current controllers are PCI-X, so can only support up to 3Gb/s SAS, while the new controllers have PCI-e and support 6Gb/s.  And they want to ensure that we have the best possible performance.  Pretty sure someone said the new controllers &#8220;have the future built in&#8221; to them.</p>
<p>One of the features we really liked about Compellent from the beginning was the fact that it was basically a software solution on top of commodity hardware.  They stressed this point repeatedly.  &#8220;When new technology comes out, we can just add a new card into your existing controller.&#8221;  I think the example at the time was 10-gig Ethernet, but it seems like the same logic would apply to SAS.  I understand that PCI-X doesn&#8217;t support 6Gb/s SAS, but it&#8217;s a tough pill to swallow that if we want to expand our SAN at all now, on top of whatever the actual expansion costs, we&#8217;re going to need to plunk down some serious money to upgrade the controllers, which really seems like a net-zero for us.  We&#8217;re not going to ditch our existing FC enclosures so we&#8217;re going to be limited to 4Gb/s anyway.  If they&#8217;re only selling SAS, well, that sucks for us, but ok.  But why can&#8217;t we just throw a $500 PCI-X 3Gb/s card in to expand?  So we&#8217;re not running at peak performance.  I doubt that would be our performance bottleneck anyway.  Plus, swapping out controllers is a huge operation for us.</p>
<p>I know at some point we&#8217;re going to have to bite the bullet and do this upgrade, but it just irks me.  On the bright side, I guess, we don&#8217;t have to do a &#8220;forklift upgrade,&#8221; and the disks/enclosures will all still work.  But we have a long way to grow before we need to expand, so fortunately I can put this off for a while.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2011/12/21/compellent-future-proof-not-so-much/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Graphing SSH dictionary attacks with HighCharts</title>
		<link>http://www.evanhoffman.com/evan/2011/11/18/graphing-ssh-dictionary-attacks-with-highcharts/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=graphing-ssh-dictionary-attacks-with-highcharts</link>
		<comments>http://www.evanhoffman.com/evan/2011/11/18/graphing-ssh-dictionary-attacks-with-highcharts/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 19:06:03 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[geo ip]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[maxmind]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[secure]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1682</guid>
		<description><![CDATA[After my 10-year-old basement Linux server died this week from a power outage, I took the sad step of giving up on it. It&#8217;s died before and I&#8217;ve patched it back together with a new power supply here or an &#8230; <a href="http://www.evanhoffman.com/evan/2011/11/18/graphing-ssh-dictionary-attacks-with-highcharts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2011/11/18/graphing-ssh-dictionary-attacks-with-highcharts/"></g:plusone></div><p>After my 10-year-old basement Linux server died this week from a power outage, I took the sad step of giving up on it.  It&#8217;s died before and I&#8217;ve patched it back together with a new power supply here or an addon PCI SATA card there, but I finally decided to throw in the towel since I had a newer old computer that had been idle for several years.  The one that died was an Athlon K7 750 MHz with 512 MB ram.  The new one is an Athlon 2 GHz (3200+) with 1 gig.  For my uses, specs don&#8217;t really matter that much, but it&#8217;s nice to have more power for free.</p>
<p>I put CentOS 6 on it and configured Samba and copied all the data off the old machine and was back up and running within a few hours.  Since I forward ports through my FiOS router to this box I did my standard lockdown procedure, including adding myself to the AllowUsers in sshd_config.  Afterwards I took a look in /var/log/secure and saw the typical flood of dictionary attacks trying to get in as root or bob or tfeldman or jweisz.  I have iptables configured to rate-limit SSH connections to 2 per 5 seconds per IP so the box doesn&#8217;t get DoSed out of existence, but some stuff does make it through to sshd.  </p>
<p>Looking through /var/log/secure, I got to thinking it would be interesting if there was some way to visualize the attacks in a handy graph.  Then I remembered, oh, wait, I can do that.</p>
<p>I wrote a perl script to parse out the attacks from /var/log/secure and insert them into a Postgres DB.  This turned out to be pretty easy.  Then I thought it would be more interesting to tie the IP of each attack to its originating country.  I&#8217;ve used <a href="http://www.maxmind.com/">MaxMind&#8217;s</a> GeoIP DB pretty extensively before, but I was looking something free.  That&#8217;s when I remembered that MaxMind has a free GeoIP DB: <a href="http://www.maxmind.com/app/geolitecity">GeoLiteCity</a>.  I grabbed it and yum-installed the <a href="http://search.cpan.org/~borisz/Geo-IP-1.40/lib/Geo/IP.pm">Perl lib</a> and added the geo data to the attack DB.  Rather than worry about normalizing the schema I just shoved the info into the same table.  Life is easier this way, and it&#8217;s just a for-fun project.</p>
<p>So I got that all working and parsed it against the existing /var/log/secures via</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>lunix2011 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># zcat /var/log/secure-20111117.gz | perl parse-secure.pl</span></pre></div></div>

<p>I wrote <a href="https://github.com/evandhoffman/parse-secure/blob/master/php/ssh.php">ssh.php</a> to see what&#8217;s in the table:</p>
<div id="attachment_1684" class="wp-caption aligncenter" style="width: 410px"><a href="http://www.evanhoffman.com/evan/2011/11/18/graphing-ssh-dictionary-attacks-with-highcharts/screen-shot-2011-11-18-at-1-38-07-pm/" rel="attachment wp-att-1684"><img src="http://www.evanhoffman.com/evan/wp-content/uploads/2011/11/Screen-shot-2011-11-18-at-1.38.07-PM.png" alt="ssh.php list of hacking attempts" title="ssh.php list of hacking attempts" width="300" class="size-full wp-image-1684" /></a><p class="wp-caption-text">ssh.php list of hacking attempts</p></div>
<p>So now that the data was all in place, time to move on to the graphs, which is what I really wanted to do.  Last time I wanted to graph data programmatically I used <a href="http://jpgraph.net/">JPGraph</a>, which does everything in PHP and is super versatile.  But I wanted something&#8230; cooler.  Maybe something interactive.  A little Googling turned up <a href="http://www.highcharts.com/">Highcharts</a> which is absolutely awesome, and does everything in JavaScript.  I basically modified some of their example charts and pumped my data into them and got the charts below.</p>
<p>Pie chart of attacks grouped by country for the past 30 days:</p>
<div id="attachment_1687" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.evanhoffman.com/evan/2011/11/18/graphing-ssh-dictionary-attacks-with-highcharts/screen-shot-2011-11-18-at-2-01-46-pm/" rel="attachment wp-att-1687"><img src="http://www.evanhoffman.com/evan/wp-content/uploads/2011/11/Screen-shot-2011-11-18-at-2.01.46-PM.png" alt="Pie chart by country" title="Pie chart by country" width="300"  class="size-full wp-image-1687" /></a><p class="wp-caption-text">Pie chart by country</p></div>
<p>Bar graph of attacks per day:</p>
<div id="attachment_1688" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.evanhoffman.com/evan/2011/11/18/graphing-ssh-dictionary-attacks-with-highcharts/screen-shot-2011-11-18-at-2-01-30-pm/" rel="attachment wp-att-1688"><img src="http://www.evanhoffman.com/evan/wp-content/uploads/2011/11/Screen-shot-2011-11-18-at-2.01.30-PM.png" alt="Bar graph of daily attacks" title="Bar graph of daily attacks" width="300"  class="size-full wp-image-1688" /></a><p class="wp-caption-text">Bar graph of daily attacks</p></div>
<p>So, that&#8217;s that.  Code is in <a href="https://github.com/evandhoffman/parse-secure">github</a> if anyone wants to play around with it.  I&#8217;ve cronned <a href="https://github.com/evandhoffman/parse-secure/blob/master/perl/parse-secure.pl">parse-secure.pl</a> to run every 5 minutes so the data gets updated automatically.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2011/11/18/graphing-ssh-dictionary-attacks-with-highcharts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Sun (Oracle) JDK 1.5 on an EC2 instance</title>
		<link>http://www.evanhoffman.com/evan/2011/11/16/installing-sun-oracle-jdk-1-5-on-an-ec2-instance/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=installing-sun-oracle-jdk-1-5-on-an-ec2-instance</link>
		<comments>http://www.evanhoffman.com/evan/2011/11/16/installing-sun-oracle-jdk-1-5-on-an-ec2-instance/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 16:52:55 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[1.5]]></category>
		<category><![CDATA[alternatives]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JAVA_HOME]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sun]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[x86_64]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1675</guid>
		<description><![CDATA[I&#8217;m currently working on moving a Tomcat-based application into EC2. The code was written for Java 5.0. While Java 6 would probably work, I&#8217;d like to keep everything as &#8220;same&#8221; as possible, since EC2 presents its own challenges. I spun &#8230; <a href="http://www.evanhoffman.com/evan/2011/11/16/installing-sun-oracle-jdk-1-5-on-an-ec2-instance/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2011/11/16/installing-sun-oracle-jdk-1-5-on-an-ec2-instance/"></g:plusone></div><p>I&#8217;m currently working on moving a Tomcat-based application into EC2. The code was written for Java 5.0. While Java 6 would probably work, I&#8217;d like to keep everything as &#8220;same&#8221; as possible, since EC2 presents its own challenges. I spun up a couple of t1.micro instances and copied everything over, including the Java 5 JDK, <tt><a href="http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase5-419410.html#jdk-1.5.0_22-oth-JPR">jdk-1_5_0_22-linux-amd64.rpm</a></tt>. Installing from RPM was easy, but the EC2 instance defaults to using OpenJDK 1.6:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>ec2 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># java -version</span>
java version <span style="color: #ff0000;">&quot;1.6.0_20&quot;</span>
OpenJDK Runtime Environment <span style="color: #7a0874; font-weight: bold;">&#40;</span>IcedTea6 1.9.10<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>amazon-52.1.9.10.40.amzn1-x86_64<span style="color: #7a0874; font-weight: bold;">&#41;</span>
OpenJDK <span style="color: #000000;">64</span>-Bit Server VM <span style="color: #7a0874; font-weight: bold;">&#40;</span>build <span style="color: #000000;">19.0</span>-b09, mixed mode<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>There were a couple of things I had to do to get the system to accept the Sun JDK as its &#8220;real&#8221; java.</p>
<h3>Alternatives</h3>
<p>Red Hat&#8217;s &#8220;alternatives&#8221; system is designed to allow a system to have multiple versions of a program installed and make it easy to choose which one you want to run.  Unfortunately I&#8217;ve found the syntax a bit strange and always have to Google it, so I figured I&#8217;d document it here for posterity.</p>
<p>So here&#8217;s the default:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>ec2 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># alternatives --config java</span>
&nbsp;
There is <span style="color: #000000;">1</span> program that provides <span style="color: #ff0000;">'java'</span>.
&nbsp;
  Selection    Command
<span style="color: #660033;">-----------------------------------------------</span>
<span style="color: #000000; font-weight: bold;">*</span>+ <span style="color: #000000;">1</span>           <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>jre-1.6.0-openjdk.x86_64<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java
&nbsp;
Enter to keep the current selection<span style="color: #7a0874; font-weight: bold;">&#91;</span>+<span style="color: #7a0874; font-weight: bold;">&#93;</span>, or <span style="color: #7a0874; font-weight: bold;">type</span> selection number:</pre></div></div>

<p>Here&#8217;s how to add Sun java, assuming the java binary is in <tt>/usr/java/jdk1.5.0_22/jre/bin/java</tt> (where the RPM puts it).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>ec2 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># alternatives --install /usr/bin/java java /usr/java/jdk1.5.0_22/jre/bin/java 1</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>ec2 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># alternatives --config java</span>
There are <span style="color: #000000;">2</span> programs <span style="color: #c20cb9; font-weight: bold;">which</span> provide <span style="color: #ff0000;">'java'</span>.
&nbsp;
  Selection    Command
<span style="color: #660033;">-----------------------------------------------</span>
<span style="color: #000000; font-weight: bold;">*</span>+ <span style="color: #000000;">1</span>           <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>jre-1.6.0-openjdk.x86_64<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java
   <span style="color: #000000;">2</span>           <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>jdk1.5.0_22<span style="color: #000000; font-weight: bold;">/</span>jre<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java
&nbsp;
Enter to keep the current selection<span style="color: #7a0874; font-weight: bold;">&#91;</span>+<span style="color: #7a0874; font-weight: bold;">&#93;</span>, or <span style="color: #7a0874; font-weight: bold;">type</span> selection number: <span style="color: #000000;">2</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>ec2 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># java -version</span>
java version <span style="color: #ff0000;">&quot;1.5.0_22&quot;</span>
Java<span style="color: #7a0874; font-weight: bold;">&#40;</span>TM<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">2</span> Runtime Environment, Standard Edition <span style="color: #7a0874; font-weight: bold;">&#40;</span>build 1.5.0_22-b03<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Java HotSpot<span style="color: #7a0874; font-weight: bold;">&#40;</span>TM<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">64</span>-Bit Server VM <span style="color: #7a0874; font-weight: bold;">&#40;</span>build 1.5.0_22-b03, mixed mode<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>Yay!  Unfortunately this doesn&#8217;t help with the other problem I had with Tomcat, which was that EC2 instances set the JAVA_HOME var to OpenJDK as well (<tt>/usr/lib/jvm/jre</tt>).  Fortunately this is an easy fix as well.</p>
<h3>Setting JAVA_HOME</h3>
<p>The JAVA_HOME var is set in <tt>/etc/profile.d/aws-apitools-common.sh</tt>.  Comment out this line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">JAVA_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>jre</pre></div></div>

<p>Create a new file, <tt>/etc/profile.d/sun-java.sh</tt>, and put this in it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">JAVA_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>jdk1.5.0_22<span style="color: #000000; font-weight: bold;">/</span>jre</pre></div></div>

<p>Also in that file I added the following to instruct the JVM to process all dates in America/New_York, since that&#8217;s the timezone all of our other servers use, and it makes reading log files easier when all dates are in the same tz:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">TZ</span>=America<span style="color: #000000; font-weight: bold;">/</span>New_York</pre></div></div>

<p>(I found I had to do this even after pointing /etc/localtime to the correct zoneinfo &#8211; Java was stuck on UTC even after the rest of the system was using America/New_York.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2011/11/16/installing-sun-oracle-jdk-1-5-on-an-ec2-instance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The little man who follows me</title>
		<link>http://www.evanhoffman.com/evan/2011/11/12/the-little-man-who-follows-me/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-little-man-who-follows-me</link>
		<comments>http://www.evanhoffman.com/evan/2011/11/12/the-little-man-who-follows-me/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 04:46:16 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[personal]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1667</guid>
		<description><![CDATA[I&#8217;m not usually one for introspection, but I found this a few years ago and it&#8217;s stuck with me. A careful man I want to be; A little fellow follows me. I do not dare to go astray For fear &#8230; <a href="http://www.evanhoffman.com/evan/2011/11/12/the-little-man-who-follows-me/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2011/11/12/the-little-man-who-follows-me/"></g:plusone></div><p>I&#8217;m not usually one for introspection, but I found this a few years ago and it&#8217;s stuck with me.<br />
<span id="more-1667"></span></p>
<blockquote><p>A careful man I want to be;<br />
A little fellow follows me.<br />
I do not dare to go astray<br />
For fear he&#8217;ll go the self same way.</p>
<p>I cannot once escape his eyes,<br />
Whate&#8217;er he sees me do, he tries.<br />
Like me he says he&#8217;s going to be;<br />
The little chap who follows me.</p>
<p>He thinks that I&#8217;m so very fine,<br />
Believes in every word of mine.<br />
The base in me he must not see;<br />
The little chap who follows me.</p>
<p>I must remember as I go<br />
Through summer&#8217;s sun and winter&#8217;s snow,<br />
I&#8217;m building for the years to be;<br />
The little chap who follows me.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2011/11/12/the-little-man-who-follows-me/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Rescan SATA bus (aka hot-adding a SATA disk on a Linux guest in VMware without rebooting)</title>
		<link>http://www.evanhoffman.com/evan/2011/10/24/rescan-sata-bus-aka-hot-adding-a-sata-disk-on-a-linux-guest-in-vmware-without-rebooting/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rescan-sata-bus-aka-hot-adding-a-sata-disk-on-a-linux-guest-in-vmware-without-rebooting</link>
		<comments>http://www.evanhoffman.com/evan/2011/10/24/rescan-sata-bus-aka-hot-adding-a-sata-disk-on-a-linux-guest-in-vmware-without-rebooting/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 19:20:51 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bus]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[dmesg]]></category>
		<category><![CDATA[hot-add]]></category>
		<category><![CDATA[hot-plug]]></category>
		<category><![CDATA[hotadd]]></category>
		<category><![CDATA[hotplug]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[rescan]]></category>
		<category><![CDATA[sata]]></category>
		<category><![CDATA[scsi]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1655</guid>
		<description><![CDATA[Linux supports hot-adding disks but whenever I add a new vdisk in VMware the new disk doesn&#8217;t show up unless I reboot, which defeats the purpose of hot-add. This command forces a rescan of the bus: echo &#34;- - -&#34; &#8230; <a href="http://www.evanhoffman.com/evan/2011/10/24/rescan-sata-bus-aka-hot-adding-a-sata-disk-on-a-linux-guest-in-vmware-without-rebooting/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2011/10/24/rescan-sata-bus-aka-hot-adding-a-sata-disk-on-a-linux-guest-in-vmware-without-rebooting/"></g:plusone></div><p>Linux supports hot-adding disks but whenever I add a new vdisk in VMware the new disk doesn&#8217;t show up unless I reboot, which defeats the purpose of hot-add.  This command forces a rescan of the bus:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;- - -&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>scsi_host<span style="color: #000000; font-weight: bold;">/</span>host0<span style="color: #000000; font-weight: bold;">/</span>scan</pre></div></div>

<p><tt>dmesg</tt> shows the new disk has been found:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  Vendor: VMware    Model: Virtual disk      Rev: <span style="color: #000000;">1.0</span> 
  Type:   Direct-Access                      ANSI SCSI revision: 02
 target0:<span style="color: #000000;">0</span>:<span style="color: #000000;">2</span>: Beginning Domain Validation
 target0:<span style="color: #000000;">0</span>:<span style="color: #000000;">2</span>: Domain Validation skipping <span style="color: #c20cb9; font-weight: bold;">write</span> tests
 target0:<span style="color: #000000;">0</span>:<span style="color: #000000;">2</span>: Ending Domain Validation
 target0:<span style="color: #000000;">0</span>:<span style="color: #000000;">2</span>: FAST-<span style="color: #000000;">40</span> WIDE SCSI <span style="color: #000000;">80.0</span> MB<span style="color: #000000; font-weight: bold;">/</span>s ST <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">25</span> ns, offset <span style="color: #000000;">127</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
SCSI device sdd: <span style="color: #000000;">1048576000</span> <span style="color: #000000;">512</span>-byte hdwr sectors <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">536871</span> MB<span style="color: #7a0874; font-weight: bold;">&#41;</span>
sdd: Write Protect is off
sdd: Mode Sense: 03 00 00 00
sdd: cache data unavailable
sdd: assuming drive cache: <span style="color: #c20cb9; font-weight: bold;">write</span> through
SCSI device sdd: <span style="color: #000000;">1048576000</span> <span style="color: #000000;">512</span>-byte hdwr sectors <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">536871</span> MB<span style="color: #7a0874; font-weight: bold;">&#41;</span>
sdd: Write Protect is off
sdd: Mode Sense: 03 00 00 00
sdd: cache data unavailable
sdd: assuming drive cache: <span style="color: #c20cb9; font-weight: bold;">write</span> through
 sdd: unknown partition table
sd <span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">2</span>:<span style="color: #000000;">0</span>: Attached scsi disk sdd
sd <span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">2</span>:<span style="color: #000000;">0</span>: Attached scsi generic sg3 <span style="color: #7a0874; font-weight: bold;">type</span> <span style="color: #000000;">0</span></pre></div></div>

<p>Now, why there&#8217;s no &#8220;rescan_sata&#8221; command is something I can&#8217;t fathom, but that&#8217;s Linux for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2011/10/24/rescan-sata-bus-aka-hot-adding-a-sata-disk-on-a-linux-guest-in-vmware-without-rebooting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying currently-playing iTunes track in the Mac menu bar</title>
		<link>http://www.evanhoffman.com/evan/2011/10/21/displaying-currently-playing-itunes-track-in-the-mac-menu-bar/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=displaying-currently-playing-itunes-track-in-the-mac-menu-bar</link>
		<comments>http://www.evanhoffman.com/evan/2011/10/21/displaying-currently-playing-itunes-track-in-the-mac-menu-bar/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:48:42 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[current track]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[menulet]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[whine]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1641</guid>
		<description><![CDATA[In an attempt to teach myself Objective C, and because I couldn&#8217;t find anything that did what I wanted, I wrote a little utility to display the currently-playing iTunes track in the Mac taskbar. Originally I had it display the &#8230; <a href="http://www.evanhoffman.com/evan/2011/10/21/displaying-currently-playing-itunes-track-in-the-mac-menu-bar/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2011/10/21/displaying-currently-playing-itunes-track-in-the-mac-menu-bar/"></g:plusone></div><p>In an attempt to teach myself Objective C, and because I couldn&#8217;t find anything that did what I wanted, I wrote a little utility to display the currently-playing iTunes track in the Mac taskbar.  Originally I had it display the full track name right in the taskbar but it was too much text for such a small space (especially on a 1440&#215;900 screen), so now you click a little musical note and it shows you the info in a menu.  </p>
<p>Here&#8217;s a screenshot:</p>
<p><a href="http://www.evanhoffman.com/evan/2011/10/21/displaying-currently-playing-itunes-track-in-the-mac-menu-bar/screen-shot-2011-10-20-at-8-54-49-pm/" rel="attachment wp-att-1642"><img src="http://www.evanhoffman.com/evan/wp-content/uploads/2011/10/Screen-shot-2011-10-20-at-8.54.49-PM.png" alt="" title="Screen shot 2011-10-20 at 8.54.49 PM" width="365" height="416" class="aligncenter size-full wp-image-1642" /></a></p>
<p>The code is all in <a href="https://github.com/evandhoffman/iTunes-Song-Title">github</a>.  If you&#8217;re looking for a similar utility, and are brave enough to try my first-ever Obj-C app, you can download it  <a href='http://www.evanhoffman.com/evan/2011/10/21/displaying-currently-playing-itunes-track-in-the-mac-menu-bar/itunes-current-track-app/' rel='attachment wp-att-1646'>here.</a>  But the freshest version will probably be in the github project.  </p>
<p>As an aside, I was surprised at how easy it was to cobble this together having never written ObjC before.  I found some good examples that I mostly ripped off, but it was still remarkably easy to have the app listen to iTunes for track changes, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2011/10/21/displaying-currently-playing-itunes-track-in-the-mac-menu-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Benchmarking DNS servers with Java</title>
		<link>http://www.evanhoffman.com/evan/2011/09/26/benchmarking-dns-servers-with-java/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=benchmarking-dns-servers-with-java</link>
		<comments>http://www.evanhoffman.com/evan/2011/09/26/benchmarking-dns-servers-with-java/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 16:33:28 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1626</guid>
		<description><![CDATA[I&#8217;m currently in the process of moving our DNS over to another provider and I was curious as to whether the old or new provider offers faster lookups. dig shows query times, but I didn&#8217;t want to just run that &#8230; <a href="http://www.evanhoffman.com/evan/2011/09/26/benchmarking-dns-servers-with-java/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2011/09/26/benchmarking-dns-servers-with-java/"></g:plusone></div><p>I&#8217;m currently in the process of moving our DNS over to another provider and I was curious as to whether the old or new provider offers faster lookups.  <code>dig</code> shows query times, but I didn&#8217;t want to just run that over and over.  I decided to write something to do this, in Java since I like Java.  I found <a href="http://mowyourlawn.com/blog/?p=8">this post,</a> which has the meat of the work done already.  I also read some of Sun&#8217;s <a href="http://download.oracle.com/javase/1,5.0/docs/guide/jndi/jndi-dns.html">JNDI/DNS</a> lookup info, which was pretty dense.  All I want to do is specify the name server&#8217;s IP and do the lookup.  I don&#8217;t even really care about the result, just how long the query takes.</p>
<p>The thing I wrote only looks up <code>A</code> records, but can easily be modified to do CNAMEs or whatever.  Here&#8217;s how you call it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ java <span style="color: #660033;">-jar</span> DNSTester.jar 4.2.2.2 www.google.com <span style="color: #000000;">25</span>
Resolved www.google.com to 74.125.235.19 against NS 4.2.2.2
Performed <span style="color: #000000;">25</span> lookups <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">233.29</span> milliseconds.  Average 9.3316ms per lookup.
&nbsp;
$ java <span style="color: #660033;">-jar</span> DNSTester.jar 8.8.4.4 www.google.com <span style="color: #000000;">25</span>
Resolved www.google.com to 74.125.226.146 against NS 8.8.4.4
Performed <span style="color: #000000;">25</span> lookups <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">450.034</span> milliseconds.  Average 18.00136ms per lookup.</pre></div></div>

<p>Code is in github <a href="https://github.com/evandhoffman/DNSBench">here</a>.  Jar is available <a href="http://www.evanhoffman.com/java/DNSTester.jar">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2011/09/26/benchmarking-dns-servers-with-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fedora Core 15 &amp; Gnome 3</title>
		<link>http://www.evanhoffman.com/evan/2011/09/23/fedora-core-15-gnome-3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fedora-core-15-gnome-3</link>
		<comments>http://www.evanhoffman.com/evan/2011/09/23/fedora-core-15-gnome-3/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 14:27:22 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[autostart]]></category>
		<category><![CDATA[chkconfig]]></category>
		<category><![CDATA[fc12]]></category>
		<category><![CDATA[fc15]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[preupgrade]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[smb]]></category>
		<category><![CDATA[systemctl]]></category>
		<category><![CDATA[systemd]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1618</guid>
		<description><![CDATA[Shrinking partitions, installing/upgrading to FC15, and systemd/chkconfig. <a href="http://www.evanhoffman.com/evan/2011/09/23/fedora-core-15-gnome-3/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2011/09/23/fedora-core-15-gnome-3/"></g:plusone></div><p>Over a year ago, the hard drive in my primary desktop at home bricked itself and rather than going through the hassle of reinstalling Win7 on the new disk, I decided to go with FC12. I&#8217;ve been pretty happy with it in general, since I&#8217;ve always been partial to Red Hat and use CentOS primarily at work.<br />
<span id="more-1618"></span><br />
Last week I got the great idea to upgrade to FC14. In hindsight I can&#8217;t even recall what led me to try this, but it didn&#8217;t end well. I tried the &#8220;preupgrade&#8221; procedure, which appeared to do the entire upgrade from FC12 to FC14 in place. I left it overnight, and when I looked at it the next day it looked like it was done. I was in FC14 and everything looked ok. But then I tried syncing my photos over NFS and discovered nfs wasn&#8217;t running on my desktop. When I tried starting it, it failed. After some trial and error, I used the Google and found that <a href="http://forums.fedoraforum.org/showthread.php?t=264182">this is just what happens when upgrading to FC14</a> due to changes between FC12 and FC14, namely the introduction of <a href="http://fedoraproject.org/wiki/Systemd">systemd</a>.</p>
<p>In all the threads I read, the &#8220;solution&#8221; was a clean install of Fedora. I tried doing this without formatting my / (root) partition, since that had 500 gigs of my stuff on it, but it kept failing. What I ended up doing was downloading <a href="http://partedmagic.com/doku.php?id=start">partedmagic</a>, which is a totally awesome partitioning tool.  If you&#8217;re familiar with Partition Magic, this is similar but Linux-based and free.  I burned the iso to disc, booted to it, and shrunk my / partition from 900 GB to 850 GB, and created a new 50 GB partition at the end of my disk without losing any of my data:</p>
<div id="attachment_1619" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.evanhoffman.com/evan/2011/09/23/fedora-core-15-gnome-3/parted-20110923/" rel="attachment wp-att-1619"><img class="size-medium wp-image-1619" title="FC15 Partitions" src="http://www.evanhoffman.com/evan/wp-content/uploads/2011/09/parted-20110923-300x195.png" alt="FC15 Partitions" width="300" height="195" /></a><p class="wp-caption-text">FC15 Partitions</p></div>
<p>Once this was done, which took surprisingly little time, I did a net install of FC15. I opted for a net install rather than downloading the ISO because I feel that with FiOS it&#8217;s actually faster than reading a DVD, and avoids having to run &#8220;yum update&#8221; afterwards.</p>
<p>So, I ended up with FC15 clean-installed to the new &#8220;/&#8221; partition. I moved everything around so the old partition is mounted at /docs and has all my stuff in it. I&#8217;d heard that FC15 was causing an uproar but until I logged into Gnome 3 myself I didn&#8217;t really understand the fuss. It&#8217;s going to take some getting used to, but after adding the <a href="http://code.google.com/p/tint2/">tint2</a> taskbar it&#8217;s not too awful.</p>
<p>But back to systemd. In FC15 I wanted to ensure Samba started at boot, since that&#8217;s how I share docs between my VMs and host. Chkconfig is still there, but based on my problems with NFS and systemd on FC14 I decided to look into it a bit and see if there&#8217;s a &#8220;new&#8221; way to enable stuff at startup. <a href="http://fedoraproject.org/wiki/Systemd#How_do_I_start.2Fstop_or_enable.2Fdisable_services.3F">There is!</a></p>
<p>Instead of:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># chkconfig smb on</span></pre></div></div>

<p>The command is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># systemctl enable smb.service</span></pre></div></div>

<p>Of course, when I did this it apparently fell back to using chkconfig for smb:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>evan-fedora ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># systemctl enable smb.service</span>
smb.service is not a native service, redirecting to <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>chkconfig.
Executing <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>chkconfig smb on</pre></div></div>

<p>It does say in the <a href="http://fedoraproject.org/wiki/Systemd#Does_chkconfig_command_work_with_systemd.3F">Fedora wiki</a> that systemd respects chkconfig and vice versa, so I guess this post is kind of pointless and I should have just linked to the wiki. But, whatever.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2011/09/23/fedora-core-15-gnome-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making sure SSLv2 is disabled in Apache (and Nginx)</title>
		<link>http://www.evanhoffman.com/evan/2011/09/20/making-sure-sslv2-is-disabled-in-apache/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=making-sure-sslv2-is-disabled-in-apache</link>
		<comments>http://www.evanhoffman.com/evan/2011/09/20/making-sure-sslv2-is-disabled-in-apache/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 18:06:38 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[beast]]></category>
		<category><![CDATA[cipher]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mitm]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[sslciphersuite]]></category>
		<category><![CDATA[sslv2]]></category>
		<category><![CDATA[tls]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1606</guid>
		<description><![CDATA[Edit Jan 24, 2012: Deleted all the crap from this story and just left the recommended Apache and Nginx SSL cipher suites for maximum security without SSLv2 and without BEAST vulnerability (at least according to Qualys). Apache httpd SSLProtocol -ALL &#8230; <a href="http://www.evanhoffman.com/evan/2011/09/20/making-sure-sslv2-is-disabled-in-apache/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2011/09/20/making-sure-sslv2-is-disabled-in-apache/"></g:plusone></div><p><ins datetime="2012-01-24T03:50:52+00:00"><br />
<strong>Edit Jan 24, 2012: </strong> Deleted all the crap from this story and just left the recommended Apache and Nginx SSL cipher suites for maximum security without SSLv2 and without BEAST vulnerability (at least according to Qualys).<br />
</ins><br />
<strong>Apache httpd</strong></p>

<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">SSLProtocol -ALL +SSLv3 +TLSv1
SSLCipherSuite ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM;
SSLHonorCipherOrder on</pre></div></div>

<p><strong>nginx</strong></p>

<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">        ssl_protocols  SSLv3 TLSv1;
        ssl_ciphers     ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM;
        ssl_prefer_server_ciphers   on;</pre></div></div>

<p>Source: </p>
<ul>
<li>
<a href="https://community.qualys.com/blogs/securitylabs/2011/10/17/mitigating-the-beast-attack-on-tls">Qualys</a></li>
<li><a href="https://www.ssllabs.com/ssldb/">SSL checker</a></li>
</ul>
<p><a target="_blank" href="http://affiliate.godaddy.com/redirect/5F43C3ECBA841ACFC3859F4F4E6CA7DA64C271385B2D61A3AD6F3CCE83EB1DD8235E60DCD7D63BCD92E2429E79A75FAC"><img src="http://affiliate.godaddy.com/ads/5F43C3ECBA841ACFC3859F4F4E6CA7DA64C271385B2D61A3AD6F3CCE83EB1DD8235E60DCD7D63BCD92E2429E79A75FAC" border="0" width="468"  height="60" alt="Go Daddy $12.99 SSL Sale!"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2011/09/20/making-sure-sslv2-is-disabled-in-apache/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Exchange (OWA) CAS crashes with 503 error &#8211; again</title>
		<link>http://www.evanhoffman.com/evan/2011/09/18/exchange-owa-cas-crashes-with-503-error-again/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exchange-owa-cas-crashes-with-503-error-again</link>
		<comments>http://www.evanhoffman.com/evan/2011/09/18/exchange-owa-cas-crashes-with-503-error-again/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 16:22:46 +0000</pubDate>
		<dc:creator>Evan Hoffman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[0xe053534f]]></category>
		<category><![CDATA[503]]></category>
		<category><![CDATA[appcrash]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[KERNELBASE.dll]]></category>
		<category><![CDATA[MSExchangeOWAAppPool]]></category>
		<category><![CDATA[owa]]></category>
		<category><![CDATA[w3wp.exe]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=1599</guid>
		<description><![CDATA[This just started happening again, with these errors appearing in the event viewer: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 &#8230; <a href="http://www.evanhoffman.com/evan/2011/09/18/exchange-owa-cas-crashes-with-503-error-again/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="plus-one-wrap"><g:plusone size="small" href="http://www.evanhoffman.com/evan/2011/09/18/exchange-owa-cas-crashes-with-503-error-again/"></g:plusone></div><p>This just started happening <a href="http://www.evanhoffman.com/evan/?p=986">again</a>, with these errors appearing in the event viewer:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">Log Name: System
Source: Microsoft-Windows-WAS
Date: 9/18/2011 11:16:33 AM
Event ID: 5011
Task Category: None
Level: Warning
Keywords: Classic
User: N/A
Computer: exch2010fe1
Description:
A process serving application pool 'MSExchangeOWAAppPool' suffered a
fatal communication error with the Windows Process Activation Service.
The process id was '3760'. The data field contains the error number.
&nbsp;
Log Name: System
Source: Microsoft-Windows-WAS
Date: 9/17/2011 6:47:07 AM
Event ID: 5009
Task Category: None
Level: Warning
Keywords: Classic
User: N/A
Computer: exch2010fe1
Description:
A process serving application pool 'MSExchangeOWAAppPool' terminated
unexpectedly. The process id was '3108'. The process exit code was
'0x800703e9'.
&nbsp;
Log Name: Application
Source: Application Error
Date: 9/17/2011 6:46:30 AM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: exch2010fe1
Description:
Faulting application name: w3wp.exe, version: 7.5.7600.16385, time
stamp: 0x4a5bd0eb
Faulting module name: KERNELBASE.dll, version: 6.1.7600.16385, time
stamp: 0x4a5bdfe0
Exception code: 0xe053534f
Fault offset: 0x000000000000aa7d
Faulting process id: 0x%9
Faulting application start time: 0x%10
Faulting application path: %11
Faulting module path: %12
Report Id: %13</pre></td></tr></table></div>

<p>After reviewing the IIS logs and the event logs, I think it has to do with the WebReady document viewer &#8211; the thing in OWA that renders and lets you view .doc attachments within the browser rather than forcing you to open Word or Excel.  I think users were attempting to open corrupted files and that was causing it to crash.  I&#8217;ve disabled Webready in EMC (Server Config -> CAS) and I&#8217;ll see what happens.  </p>
<p><a target="_blank" href="http://affiliate.godaddy.com/redirect/5F43C3ECBA841ACFC3859F4F4E6CA7DA64C271385B2D61A3AD6F3CCE83EB1DD8235E60DCD7D63BCD92E2429E79A75FAC"><img src="http://affiliate.godaddy.com/ads/5F43C3ECBA841ACFC3859F4F4E6CA7DA64C271385B2D61A3AD6F3CCE83EB1DD8235E60DCD7D63BCD92E2429E79A75FAC" border="0" width="468"  height="60" alt="Go Daddy $12.99 SSL Sale!"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2011/09/18/exchange-owa-cas-crashes-with-503-error-again/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

