<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Packetslave Industries</title>
	
	<link>http://www.packetslave.com</link>
	<description>This is my blog. There are many like it, but this one is mine.</description>
	<lastBuildDate>Wed, 07 Sep 2011 04:01:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/PacketslaveIndustries" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="packetslaveindustries" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FPacketslaveIndustries" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FPacketslaveIndustries" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bloglines.com/sub/http://feeds.feedburner.com/PacketslaveIndustries" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FPacketslaveIndustries" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2FPacketslaveIndustries" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><item>
		<title>Python: strip whitespace/comments when reading a file</title>
		<link>http://www.packetslave.com/2011/09/06/python-strip-whitespace-and-comments-when-reading-a-file/</link>
		<comments>http://www.packetslave.com/2011/09/06/python-strip-whitespace-and-comments-when-reading-a-file/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 03:59:45 +0000</pubDate>
		<dc:creator>Brian Landers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.packetslave.com/?p=311</guid>
		<description><![CDATA[From StackOverflow def stripped(f): for l in f: line = l.rstrip() if line and not line.startswith("#"): yield line with(open "foo.txt", "r") as f: for line in stripped(f): print line]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://stackoverflow.com/questions/4842057/python-easiest-way-to-ignore-blank-lines-when-reading-a-file">StackOverflow</a></p>
<p></p>
<pre>def stripped(f):
    for l in f:
        line = l.rstrip()
        if line and not line.startswith("#"):
            yield line

with(open "foo.txt", "r") as f:
    for line in stripped(f):
        print line
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.packetslave.com/2011/09/06/python-strip-whitespace-and-comments-when-reading-a-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python: wrapper around termcolor to allow enable/disable</title>
		<link>http://www.packetslave.com/2011/09/06/python-wrapper-around-termcolor-to-allow-enabledisable/</link>
		<comments>http://www.packetslave.com/2011/09/06/python-wrapper-around-termcolor-to-allow-enabledisable/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 03:57:35 +0000</pubDate>
		<dc:creator>Brian Landers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.packetslave.com/?p=308</guid>
		<description><![CDATA[class Color(object): """Wrapper around termcolor to allow colors to be disabled.""" @classmethod def Setup(cls, enabled=True): if enabled: cls.me = cls.WithColor else: cls.me = cls.WithoutColor @classmethod def WithColor(cls, msg, color=None, on_color=None, attrs=None): return termcolor.colored(msg, color, on_color, attrs) @classmethod def WithoutColor(cls, msg, color=None, on_color=None, attrs=None): (color, on_color, attrs) = (color, on_color, attrs) # gpylint return msg]]></description>
			<content:encoded><![CDATA[<pre><span style="color: red">class</span> <span style="color: #38761d">Color</span>(object):
  <span style="color: #b45f06">"""Wrapper around termcolor to allow colors to be disabled."""</span>

  <span style="color: #38761d">@classmethod</span>
  <span style="color: red">def</span> <span style="color: #3d85c6">Setup</span>(cls, enabled=<span style="color: red">True</span>):
    <span style="color: red">if</span> enabled:
      cls.me = cls.WithColor
    <span style="color: red">else</span>:
      cls.me = cls.WithoutColor

  <span style="color: #38761d">@classmethod</span>
  <span style="color: red">def</span> <span style="color: #3d85c6">WithColor</span>(cls, msg, color=<span style="color: red">None</span>, on_color=<span style="color: red">None</span>, attrs=<span style="color: red">None</span>):
    <span style="color: red">return</span> termcolor.colored(msg, color, on_color, attrs)

  <span style="color: #38761d">@classmethod</span>
  <span style="color: red">def</span> WithoutColor(cls, msg, color=<span style="color: red">None</span>, on_color=<span style="color: red">None</span>, attrs=<span style="color: red">None</span>):
    (color, on_color, attrs) = (color, on_color, attrs)  <span style="color: #b45f06"># gpylint</span>
    <span style="color: red">return</span> msg
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.packetslave.com/2011/09/06/python-wrapper-around-termcolor-to-allow-enabledisable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linked: Items of Interest for Sept. 5</title>
		<link>http://www.packetslave.com/2011/09/05/linked-items-of-interest-for-sept-5/</link>
		<comments>http://www.packetslave.com/2011/09/05/linked-items-of-interest-for-sept-5/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 03:58:13 +0000</pubDate>
		<dc:creator>Brian Landers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.packetslave.com/?p=309</guid>
		<description><![CDATA[MacOS 10.7: Monitor your Wi-Fi with Wi-Fi Diagnostics Lion ships with an app called Wi-Fi diagnostics. It allows you to monitor Wi-Fi networks your computer is connected to and collect various kinds of information. This utility could be very useful for finding problems or doing research on your Wi-Fi networks. Enabling OS X Screen Sharing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://hints.macworld.com/article.php?story=20110807084920307">MacOS 10.7: Monitor your Wi-Fi with Wi-Fi Diagnostics</a><br />
</p>
<blockquote><p>
Lion ships with an app called Wi-Fi diagnostics. It allows you to monitor Wi-Fi networks your computer is connected to and collect various kinds of information. This utility could be very useful for finding problems or doing research on your Wi-Fi networks.
</p></blockquote>
<p><a href="http://technotes.twosmallcoins.com/?p=279">Enabling OS X Screen Sharing via the CLI</a><br />
</p>
<blockquote><p>
If you’re already at your Mac&#8217;s desktop, you can simply turn on Screen Sharing. But if you (1) didn&#8217;t plan ahead or (2) worry about security, here&#8217;s how to turn it on.
</p></blockquote>
<p><a href="http://stackoverflow.com/questions/715417/converting-from-a-string-to-boolean-in-python">Converting from a string to boolean in Python</a><br />
</p>
<blockquote>
<pre>&gt;&gt;&gt; import ast
&gt;&gt;&gt; ast.literal_eval("True")
</pre>
</blockquote>
<p><a href="http://www.team5150.com/~andrew/carmack/slashdot.html">John Carmack Slashdot Archive</a><br />
</p>
<blockquote><p>
All of Carmack&#8217;s comments on Slashdot, from 1999 to 2008. See also his .plan file updates from 1996-2007 <a href="http://www.team5150.com/~andrew/carmack/plan.html">here</a>.
</p></blockquote>
<p><a href="http://blog.carbonfive.com/2011/09/01/deploying-node-js-on-amazon-ec2/">Deploying node.js on Amazon EC2</a><br />
</p>
<blockquote><p>
Creating an AWS &#8220;micro&#8221; instance running Ubuntu 10.04LTS and setting up a <a href="http://nodejs.org/">Node.js</a> server with deployment managed by <a href="https://github.com/capistrano/capistrano/wiki/">Capistrano</a> and process management by <a href="https://github.com/arya/bluepill">Bluepill</a>.
</p></blockquote>
<p><a href="http://startuplawyer.com/startup-issues/if-i-launched-a-startup">If I Launched a Startup</a><br />
</p>
<blockquote><p>
Collection of linked advice from Ryan Roberts, aka <a href="http://twitter.com/#!/startuplawyer">@StartupLawyer</a>.
</p></blockquote>
<p><a href="http://www.cleveralgorithms.com/nature-inspired/index.html">Clever Algorithms</a><br />
</p>
<blockquote><p>
&#8220;This book is concerned with &#8216;clever algorithms&#8217;, which are algorithms drawn from many sub-fields of artificial intelligence not limited to the scruffy fields of biologically inspired computation, computational intelligence and metaheuristics. The term &#8216;clever algorithms&#8217; is intended to unify a collection of interesting and useful computational tools under a consistent and accessible banner. &#8221;
</p></blockquote>
<p><a href="http://jblevins.org/projects/deft/">Deft</a><br />
</p>
<blockquote><p>
Emacs mode for quickly browsing, filtering, and editing directories of plain text notes, inspired by Notational Velocity. It was designed for increased productivity when writing and taking notes by making it fast and simple to find the right file at the right time and by automating many of the usual tasks such as creating new files and saving files.
</p></blockquote>
<p><a href="http://dl.acm.org/citation.cfm?id=2019527">Warehouse-Scale Computing: Entering the Teenage Decade</a><br />
</p>
<blockquote><p>
ACM keynote from <a href="http://www.acm.org/fcrc/">FCRC 2011</a> by Luis Barroso Alvarez. Covers both Google-specific stuff and general datacenter industry trends.
</p></blockquote>
<p><a href="https://github.com/madrobby/keymaster">Keymaster</a><br />
</p>
<blockquote><p>
A simple micro-library for defining and dispatching keyboard shortcuts.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.packetslave.com/2011/09/05/linked-items-of-interest-for-sept-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dropbox Encryption w/ EncFS on MacOS X</title>
		<link>http://www.packetslave.com/2011/04/21/dropbox-encryption-w-encfs-on-macos-x/</link>
		<comments>http://www.packetslave.com/2011/04/21/dropbox-encryption-w-encfs-on-macos-x/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 13:55:38 +0000</pubDate>
		<dc:creator>Brian Landers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.packetslave.com/?p=303</guid>
		<description><![CDATA[The Problem Dropbox recently made news by updating their Terms of Service to explicitly state that (if asked by law enforcement) they can and will decrypt your files and hand them over. As set forth in our privacy policy, and in compliance with United States law, Dropbox cooperates with United States law enforcement when it [...]]]></description>
			<content:encoded><![CDATA[<h2>The Problem</h2>
<p><a href="http://www.dropbox.com">Dropbox</a> recently made news by <a href="http://www.tuaw.com/2011/04/19/dropbox-under-fire-for-security-concerns/">updating their Terms of Service</a> to explicitly state that (if asked by law enforcement) they can and will decrypt your files and hand them over.</p>
<blockquote><p>As set forth in our privacy policy, and in compliance with United States law, Dropbox cooperates with United States law enforcement when it receives valid legal process, which may require Dropbox to provide the contents of your private Dropbox. In these cases, Dropbox will remove Dropbox&#8217;s encryption from the files before providing them to law enforcement.</p></blockquote>
<p>This seemingly contradicts some language in their marketing materials that would suggest that user files are stored in an encrypted format on Dropbox&#8217;s backend and are completely inaccessible even to Dropbox employees.  This is similar to what competing tools like <a href="http://www.jungledisk.com">Jungle Disk</a> do explicitly:  the files are encrypted before they ever leave your computer and the decryption key is only ever stored locally.</p>
<p>Unfortunately, it now seems possible that Dropbox is <strong>not</strong> encrypting files on the backend, given the comments from their CTO at the end of the TUAW article linked above.  Given this, it seems prudent to look for a solution that allows you to keep using Dropbox, but encrypt sensitive data before it&#8217;s ever uploaded to the cloud.</p>
<h2>Enter EncFS</h2>
<p><a href="http://www.arg0.net/encfs">EncFS</a> is an encrypted pass-through filesystem that&#8217;s implemented in userspace.  What&#8217;s that mean?  Pass-through means (basically) that the encryption is done on a file-by-file basis, as opposed to an encrypted block device, such as <a href="http://www.truecrypt.org/">TrueCrypt</a> or Apple&#8217;s <a href="http://en.wikipedia.org/wiki/Apple_Disk_Image">DMG</a> image format, where you have one monolithic encrypted &#8220;bucket&#8221; into which you put your files.</p>
<p>In a nutshell, an EncFS volume looks (mostly) like an ordinary folder on your hard drive. Anything you save into that folder gets transparently encrypted and stored in a <strong>separate</strong> folder elsewhere on your hard drive (the &#8220;backing store&#8221;). As far as any applications know, they&#8217;re working with plain, ordinary, unencrypted files but these files are never actually read or written on disk. Only the encrypted versions are actually accessed behind the scenes.</p>
<p>It&#8217;s this backing store functionality that makes EncFS a perfect companion to <a href="http://www.dropbox.com/">Dropbox</a>. You read and write your files on your hard drive as normal (inside the virtual folder), and EncFS transparently stores the encrypted versions in your Dropbox folder, where they are synced in real-time to the cloud. Since each file is encrypted individually, Dropbox can sync changes incrementally instead of having to sync the whole disk image. To be fair, they do differential syncing, so only the actual changed bits of the image get transferred over the wire, but to my mind syncing the individual files is still better. File-based encryption also makes it much smoother to access your files from multiple machines at the same time, since Dropbox can resolve conflicts at the individual file level.</p>
<p>&#8220;Implemented in userspace&#8221; means that EncFS runs as an ordinary process (a daemon), like a web or FTP server, as opposed to a kernel module.  This is done through use of the <a href="http://fuse.sourceforge.net/">FUSE</a> (Filesystem in Userspace) project, which<strong> is</strong> a kernel module and provides the hooks into the file handling subsystem that something like EncFS, <a href="http://fuse.sourceforge.net/sshfs.html">sshfs</a>, or <a href="http://sr71.net/projects/gmailfs/">GMailFS</a> requires to work their magic.</p>
<h2>MacFUSE</h2>
<p>FUSE was originally (and still is) a Linux project, using a loadable module for the Linux kernel to provide the necessary hooks to userspace filesystems like EncFS.  Fortunately, Amit Singh from Google (author of the terrific book &#8220;<a href="http://osxbook.com/">MacOS X Internals</a>&#8220;) developed a MacOS X port, <a href="http://code.google.com/p/macfuse/">MacFUSE</a>, which provides the same userspace API, but hooks into the Darwin kernel instead.  Thus, we can use EncFS, sshfs, and most if not all of the other FUSE filesystems on the Mac.</p>
<h2>Installation</h2>
<ul>
<li>download MacFUSE from <a href="http://code.google.com/p/macfuse/downloads/list">Google Code</a>. Don&#8217;t worry about the latest version being from 2008. It still works fine with (32-bit) OS X 10.6. Run the installer and click through, accepting the defaults.</li>
<li>download EncFS pre-built for OS X from <a href="http://code.google.com/p/encfsvault/downloads/list">Google Code</a>.  You want the file named something like &#8220;EncFS-10.5-2.0.0.zip&#8221; even though it says it&#8217;s for Leopard.  Run the installer and again accept all of the defaults.  This will install the EncFS FUSE module and the related CLI tools (in /usr/local/bin)</li>
</ul>
<h2>Creating Your First Secure Volume</h2>
<p>On my machines, I keep the backing store (the actual files on disk) in my Dropbox, which is <em>~/Dropbox/Secure</em>. The virtual folder where I can access these files is in <em>~/Documents/Secure</em>.</p>
<pre>$ <strong>encfs ~/Dropbox/Secure ~/Documents/Secure</strong>
Creating new encrypted volume.
Please choose from one of the following options:
 enter "x" for expert configuration mode,
 enter "p" for pre-configured paranoia mode,
 anything else, or an empty line will select standard mode.
?&gt; <strong>p</strong>

Paranoia configuration selected.

Configuration finished.  The filesystem to be created has
the following properties:
Filesystem cipher: "ssl/aes", version 2:1:1
Filename encoding: "nameio/block", version 3:0:1
Key Size: 256 bits
Block Size: 512 bytes, including 8 byte MAC header
Each file contains 8 byte header with unique IV data.
Filenames encoded using IV chaining mode.
File data IV is chained to filename IV.

-------------------------- WARNING --------------------------
The external initialization-vector chaining option has been
enabled.  This option disables the use of hard links on the
filesystem. Without hard links, some programs may not work.
The programs 'mutt' and 'procmail' are known to fail.  For
more information, please see the encfs mailing list.
If you would like to choose another configuration setting,
please press CTRL-C now to abort and start over.

Now you will need to enter a password for your filesystem.
You will need to remember this password, as there is absolutely
no recovery mechanism.  However, the password can be changed
later using encfsctl.

New Encfs Password: <strong>dontuseme</strong>
Verify Encfs Password: <strong>dontuseme</strong></pre>
<h2>The Results</h2>
<p>Creating and manipulating files inside the virtual directory is just like any other directory on disk. Both UNIX and MacOS applications see nothing different about the file.</p>
<pre>$ <strong>echo Hello World &gt; ~/Documents/Secure/hello.txt</strong>

$ <strong>ls ~/Documents/Secure</strong>
hello.txt

$ <strong>cat ~/Documents/Secure/hello.txt</strong>
Hello World</pre>
<p>However, if we examine the actual files stored on disk inside the Dropbox folder, we will see that both the name of the file and its contents are encrypted securely.</p>
<pre>$ <strong>ls ~/Dropbox/Secure</strong>
CUUNdUhk0bp-k-eswFVtxG6D

$ <strong>cat ~/Dropbox/Secure/CUUNdUhk0bp-k-eswFVtxG6D</strong>
ѹ?7????3?V{1}=????|??D?x</pre>
<p>A screenshot from my Dropbox folder</p>
<p><a href="http://www.packetslave.com/wp-content/uploads/2011/04/Screen-shot-2011-04-21-at-12.27.52-AM.png"><img class="alignnone size-full wp-image-304" title="Dropbox with EncFS" src="http://www.packetslave.com/wp-content/uploads/2011/04/Screen-shot-2011-04-21-at-12.27.52-AM.png" alt="" width="582" height="306" /></a></p>
<h2>Caveats and Notes</h2>
<p>An EncFS volume does not mount on boot, so you will need to either manually re-run the <strong>encfs</strong> command above, or create a startup script of some kind (possibly with AppleScript) to do it for you automatically.  Personally, I like this behavior &#8212; especially on my laptop. If my Macbook Pro is ever stolen, the thief would need to reboot to get past the screensaver. All of my sensitive data is securely encrypted inside the EncFS backing store and would be completely inaccessible unless the virtual filesystem is mounted (which would require my passphrase).</p>
<p>Probably the biggest downside to the EncFS solution (or any client-side encryption scheme) is that it breaks access to your files from the Dropbox web client, from mobile devices, or from any computer that doesn&#8217;t have EncFS installed. You&#8217;ll want to carefully consider the risk and perhaps only use your encrypted folder for especially-sensitive files that you&#8217;re not likely to need to access from a non-EncFS-enabled computer.</p>
<p>Amazingly, there actually <strong>does</strong> appear to be initial EncFS support for Windows. See <a href="http://groups.google.com/group/dokan/browse_thread/thread/27a58326f733572e/a533b59d8ed374f4">here</a> for details. It appears to at least work on Windows XP, but there seem to be issues with Vista and Windows 7.  Better than nothing, and quite an impressive hack given the major differences between the Windows OS kernel and Linux. At least MacOS X is based on Mach, so there&#8217;s a UNIX-<strong>like</strong> kernel underneath!</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.packetslave.com/2011/04/21/dropbox-encryption-w-encfs-on-macos-x/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>PowerCLI: basic ESXi Build Script</title>
		<link>http://www.packetslave.com/2011/03/26/powercli-basic-esxi-build-script/</link>
		<comments>http://www.packetslave.com/2011/03/26/powercli-basic-esxi-build-script/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 20:24:21 +0000</pubDate>
		<dc:creator>Brian Landers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://packetslave.com/?p=302</guid>
		<description><![CDATA[I&#8217;ve been building and rebuilding hosts in the home lab quite a bit lately.  After about the 3rd time reconfiguring the same host options (adding a NFS store, setting up my portgroups, etc.) I decided this was a good opportunity to learn some PowerCLI.  Could do something similar with host profiles, but that&#8217;s a project [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been building and rebuilding hosts in the home lab quite a bit lately.  After about the 3rd time reconfiguring the same host options (adding a NFS store, setting up my portgroups, etc.) I decided this was a good opportunity to learn some PowerCLI.  Could do something similar with host profiles, but that&#8217;s a project for another day.</p>
<p>Below is a basic script that will add a newly-built ESXi host to vCenter and apply the common settings for my lab.  Still requires manual configuration of the management interface IP info (although that could be automated through a scripted install).</p>
<pre><span style="color: #999999;"># Connect to vCenter
</span><span style="color: #3366ff;">Connect-VIServer</span> <span style="color: #800000;">vc1.packetslave.local</span>

<span style="color: #999999;"># Add host to vCenter and setup NTP
</span><span style="color: #800000;">$host = "tc2.packetslave.local"</span>
<span style="color: #3366ff;">Add-VMHost</span> <span style="color: #800000;">$host</span> -Force -Location (Get-Cluster <span style="color: #800000;">HA</span>) -User <span style="color: #800000;">root</span> -Password <span style="color: #800000;">mypass</span>
<span style="color: #3366ff;">Add-VMHostNtpServer</span> -VMHost <span style="color: #800000;">$host</span> -NtpServer <span style="color: #800000;">'time.apple.com'</span>

<span style="color: #999999;"># Enable vMotion
</span><span style="color: #800000;">$vk</span> = <span style="color: #3366ff;">Get-VMHostNetworkAdapter</span> -VMhost <span style="color: #800000;">$host</span> -VMKernel | <span style="color: #3366ff;">where</span> {$_.DeviceName -eq <span style="color: #800000;">"vmk0"</span>}
<span style="color: #800000;">$vk</span> | <span style="color: #3366ff;">Set-VMHostNetworkAdapter</span> -VMotionEnabled<span style="color: #800000;"> $true</span>

<span style="color: #999999;"># Connect to my NFS datastore
</span><span style="color: #3366ff;">New-DataStore</span> -VMhost <span style="color: #800000;">$host</span> -Name <span style="color: #800000;">mynfs</span> -Nfs -NfsHost <span style="color: #800000;">mynas</span> -Path <span style="color: #800000;">/vm</span>

<span style="color: #999999;"># Rename the default port group
</span><span style="color: #800000;">$vs</span> = <span style="color: #3366ff;">Get-VirtualSwitch</span> -VMhost <span style="color: #800000;">$host</span> -Name <span style="color: #800000;">vSwitch0</span>
<span style="color: #800000;">$pg</span> = <span style="color: #3366ff;">Get-VirtualPortGroup</span> -VirtualSwitch <span style="color: #800000;">$vs</span> -Name <span style="color: #800000;">"VM Network"</span>
<span style="color: #3366ff;">Set-VirtualPortGroup</span> -VirtualPortGroup<span style="color: #800000;"> $pg</span> -Name <span style="color: #800000;">"Production Network"</span>

<span style="color: #999999;"># Add my additional port groups
</span><span style="color: #3366ff;">New-VirtualPortGroup</span> -VirtualSwitch <span style="color: #800000;">$vs</span> -Name <span style="color: #800000;">"Test Network"</span>
<span style="color: #3366ff;">New-VirtualPortGroup</span> -VirtualSwitch <span style="color: #800000;">$vs</span> -Name <span style="color: #800000;">"Storage Admin"</span>

<span style="color: #999999;"># Tell DRS to re-balance VMs including the new host
</span><span style="color: #3366ff;">Get-DrsRecommendation</span> -Cluster (Get-Cluster <span style="color: #800000;">HA</span>) -Refresh

<span style="color: #999999;">#
</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.packetslave.com/2011/03/26/powercli-basic-esxi-build-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HP NC550SFP 10gb NIC and ESXi 4.1 U1</title>
		<link>http://www.packetslave.com/2011/03/13/hp-nc550sfp-10gb-nic-and-esxi-4-1-u1/</link>
		<comments>http://www.packetslave.com/2011/03/13/hp-nc550sfp-10gb-nic-and-esxi-4-1-u1/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 15:52:26 +0000</pubDate>
		<dc:creator>Brian Landers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://packetslave.com/?p=296</guid>
		<description><![CDATA[Mostly a note for myself: in order for the HP NC550SFP dual-port 10gb NIC to be detected under ESXi 4.1 U1 (at least on the HP DL360 G6 server), you must install the 2.102 Emulex driver from vmware, not the newer 2.103 version listed there. Out of the box, ESXi 4.1 U1 will not detect [...]]]></description>
			<content:encoded><![CDATA[<p>Mostly a note for myself:  in order for the HP NC550SFP dual-port 10gb NIC to be detected under ESXi 4.1 U1 (at least on the HP DL360 G6 server), you <strong>must</strong> install the 2.102 Emulex driver from vmware, <strong>not</strong> the newer 2.103 version listed there.</p>
<p>Out of the box, ESXi 4.1 U1 will not detect this NIC, nor will it be detected with the 2.103 driver.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.packetslave.com/2011/03/13/hp-nc550sfp-10gb-nic-and-esxi-4-1-u1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cisco ACE: Sticky Sessions using HTTP Authentication</title>
		<link>http://www.packetslave.com/2011/03/11/cisco-ace-sticky-sessions-using-http-authentication/</link>
		<comments>http://www.packetslave.com/2011/03/11/cisco-ace-sticky-sessions-using-http-authentication/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 05:43:13 +0000</pubDate>
		<dc:creator>Brian Landers</dc:creator>
				<category><![CDATA[Cisco ACE]]></category>

		<guid isPermaLink="false">http://packetslave.com/?p=294</guid>
		<description><![CDATA[Requirements any URL matching /foo/ will have HTTP authentication applied by the backend web servers.  We want to use the logged-in user as the sticky criteria for user sessions. All other URLs should use an ACE-inserted cookie called Backend Solution Use the &#8220;Authorization&#8221; HTTP header for sticky, since (with Basic authentication) this will contain the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Requirements</strong></p>
<ul>
<li>any URL matching /foo/ will have HTTP authentication applied by the backend web servers.  We want to use the logged-in user as the sticky criteria for user sessions.</li>
<li>All other URLs should use an ACE-inserted cookie called Backend</li>
</ul>
<p><strong>Solution</strong></p>
<p>Use the &#8220;Authorization&#8221; HTTP header for sticky, since (with Basic authentication) this will contain the Base64-encoded username and password of the authenticated user.</p>
<p>Note: this assumes that basic HTTP load balancing is already configured.  See <a href="/2010/01/24/cisco-ace-basic-http-load-balancing/">my previous post</a> for an example.</p>
<pre>sticky http-header Authorization USER_STICKY
  timeout 60
  replicate sticky
  serverfarm HTTP_FARM
sticky http-cookie Backend COOKIE_STICKY
  cookie insert browser-expire
  replicate sticky
  serverfarm HTTP_FARM

policy-map type loadbalance http first-match HTTP_LB
  match FOO http url /foo/.+
    sticky-serverfarm USER_STICKY
    action urlrewrite
    insert-http X-Forwarded-For header-value "%is"
  class class-default
    sticky-serverfarm COOKIE_STICKY
    action urlrewrite
    insert-http X-Forwarded-For header-value "%is"</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.packetslave.com/2011/03/11/cisco-ace-sticky-sessions-using-http-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitoring Unsaved IOS Device Changes with Nagios</title>
		<link>http://www.packetslave.com/2011/02/01/monitoring-unsaved-ios-device-changes-with-nagios/</link>
		<comments>http://www.packetslave.com/2011/02/01/monitoring-unsaved-ios-device-changes-with-nagios/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 04:14:24 +0000</pubDate>
		<dc:creator>Brian Landers</dc:creator>
				<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.packetslave.com/?p=284</guid>
		<description><![CDATA[It never fails:  you make a bunch of important changes to a network device, then a phone call or urgent issue interrupts you before you &#8216;copy run start&#8217;.  Your device runs happily along until the next unexpected power outage or IOS crash, at which point your changes go *poof*.  Not good if the old configuration [...]]]></description>
			<content:encoded><![CDATA[<p>It never fails:  you make a bunch of important changes to a network device, then a phone call or urgent issue interrupts you before you &#8216;copy run start&#8217;.  Your device runs happily along until the next unexpected power outage or IOS crash, at which point your changes go *poof*.  Not good if the old configuration no longer lets you access the device remotely (you <span style="text-decoration: underline;">do</span> have out-of-band access, right?)</p>
<p>After the most recent incident of this at $DAYJOB, I wrote a plugin for our <a href="http://www.opsview.com">Opsview</a> server (which runs on top of <a href="http://www.nagios.org">Nagios</a>) to check the &#8220;last changed&#8221; and &#8220;last saved&#8221; times of a device using SNMP.</p>
<p>It&#8217;s not perfect:  notably because IOS updates the &#8220;last changed&#8221; time every time you enter/exit config mode, whether you actually made any changes or not.  This is a recipe for false positives.  Unfortunately, there&#8217;s no easy way around this without the plugin actually downloading the device configs and comparing them.  Given the multitude of authentication and other challenges this would present, I&#8217;m happy to let tools like Rancid and Solarwinds NCM solve them instead of making the plugin much more complex.</p>
<p>Available on GitHub <a href="https://github.com/Packetslave/packetslave-nagios-plugins/blob/master/check_snmp_cisco_unsaved/check_snmp_cisco_unsaved">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.packetslave.com/2011/02/01/monitoring-unsaved-ios-device-changes-with-nagios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vMotion I/O Errors with HP NC522 10gb NIC</title>
		<link>http://www.packetslave.com/2011/01/17/vmotion-io-errors-with-hp-nc522-10gb-nic/</link>
		<comments>http://www.packetslave.com/2011/01/17/vmotion-io-errors-with-hp-nc522-10gb-nic/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 23:08:26 +0000</pubDate>
		<dc:creator>Brian Landers</dc:creator>
				<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://www.packetslave.com/?p=279</guid>
		<description><![CDATA[We recently spun up a new VMware ESXi 4.1 cluster at $DAYJOB, running on some nice new HP DL380 G7 servers. We&#8217;re using the onboard 1gb NICs for the management network and an HP NC522SFP dual-port 10gb NIC for production, vMotion, and IP storage. Everything went smoothly until we started testing vMotion between hosts. It [...]]]></description>
			<content:encoded><![CDATA[<p>We recently spun up a new VMware ESXi 4.1 cluster at $DAYJOB, running on some nice new HP <a href="http://h10010.www1.hp.com/wwpc/us/en/sm/WF25a/15351-15351-3328412-241644-241475-4091412.html">DL380 G7</a> servers. We&#8217;re using the onboard 1gb NICs for the management network and an HP <a href="http://h18000.www1.hp.com/products/servers/networking/nc522sfp/index.html">NC522SFP dual-port 10gb NIC</a> for production, vMotion, and IP storage.  Everything went smoothly until we started testing vMotion between hosts.  It would consistently fail at between 10% and 40% with an I/O error:</p>
<p><a href="http://www.packetslave.com/wp-content/uploads/2011/01/image001.png"><img class="aligncenter size-medium wp-image-280" title="I/O Error" src="http://www.packetslave.com/wp-content/uploads/2011/01/image001-300x213.png" alt="I/O Error" width="300" height="213" /></a></p>
<p>After praying to the Google deity for a while, we hit upon the following KB article: <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1026021">vMotion fails on ESX/ESXi 3.5 and 4.0 with some versions of nx_nic and unm_nic drivers</a>.  The issue only seems to crop up if you have VLAN tagging enabled on the vSwitch to which the NIC is connected, and are using TCP segmentation offload (which is enabled by default).</p>
<p>The fix is to either create a new vmKernel interface for vMotion with TSO disabled (and without using VLAN tagging), or to upgrade the NIC driver in ESX/ESXi itself.  In our case, since this was a new environment, we decided to fix it for good and do the upgrade.  A quick <a href="http://downloads.vmware.com/d/details/esx4x_qla_nx_nic_dt/ZHcqYmRAdyViZHdlZQ">download</a> and a little vMA magic, and vMotion is now working flawlessly over 10gb.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.packetslave.com/2011/01/17/vmotion-io-errors-with-hp-nc522-10gb-nic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically Generate CME ephone Configs</title>
		<link>http://www.packetslave.com/2011/01/08/automatically-generate-cme-ephone-configs/</link>
		<comments>http://www.packetslave.com/2011/01/08/automatically-generate-cme-ephone-configs/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 02:00:38 +0000</pubDate>
		<dc:creator>Brian Landers</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[cisco callmanager express CME IOS ephone perl]]></category>

		<guid isPermaLink="false">http://www.packetslave.com/?p=263</guid>
		<description><![CDATA[While spinning up a new Callmanager Express site, I needed to configure a ton of phones from a spreadsheet of names, DID&#8217;s, and phone MAC addresses. To make this easier, I hacked together a quick Perl script to automatically generate the proper IOS configs. You can find it on my Hacks page: here]]></description>
			<content:encoded><![CDATA[<p>While spinning up a new Callmanager Express site, I needed to configure a ton of phones from a spreadsheet of names, DID&#8217;s, and phone MAC addresses.  To make this easier, I hacked together a quick Perl script to automatically generate the proper IOS configs.</p>
<p>You can find it on my Hacks page:  <a href="/hacks">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.packetslave.com/2011/01/08/automatically-generate-cme-ephone-configs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

