<?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>BioTeam Inc. &#187; tech notes</title>
	<atom:link href="http://blog.bioteam.net/category/tech-notes/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bioteam.net</link>
	<description>Latest news: publications, presentations, projects and training classes</description>
	<lastBuildDate>Thu, 29 Jul 2010 14:15:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to resize an Amazon EC2 AMI when boot disk is on EBS</title>
		<link>http://blog.bioteam.net/2010/07/14/how-to-resize-an-amazon-ec2-ami-when-boot-disk-is-on-ebs/</link>
		<comments>http://blog.bioteam.net/2010/07/14/how-to-resize-an-amazon-ec2-ami-when-boot-disk-is-on-ebs/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 22:12:12 +0000</pubDate>
		<dc:creator>chrisdag</dc:creator>
				<category><![CDATA[Employee Posts]]></category>
		<category><![CDATA[tech notes]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[ebs]]></category>

		<guid isPermaLink="false">http://blog.bioteam.net/?p=565</guid>
		<description><![CDATA[Note Screwing around with the boot volume is part of our regular &#8220;explore around the edges&#8221; work before we get serious with how we are going to configure and orchestrate the new systems. The boot volume in this scenario does not have PV driver support and thus will perform slower than the actual ephemeral storage. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Note</strong></p>
<p><em>Screwing around with the boot volume is part of our regular &#8220;explore around the edges&#8221; work before we get serious with how we are going to configure and orchestrate the new systems. The boot volume in this scenario does not have PV driver support and thus will perform slower than the actual ephemeral storage. Our need was for the boot volume to be big enough to hammer with bonnie++ &#8211; this is not something we&#8217;d do in a production scenario</em>.</p>
<p><strong>Background</strong></p>
<p><span style="font-family: 'Lucida Grande';">All of the cloud nerds at BioTeam are thrilled now that the Amazon Compute Cluster nodes have been publicly launched. If you missed the exciting news please visit the announcement post over at the AWS blog - <a href="http://aws.typepad.com/aws/2010/07/the-new-amazon-ec2-instance-type-the-cluster-compute-instance.html">http://aws.typepad.com/aws/2010/07/the-new-amazon-ec2-instance-type-the-cluster-compute-instance.html</a></span></p>
<p><span style="font-family: 'Lucida Grande';">We&#8217;ve been madly banging on the new instance types and trying to (initially) perform some basic low level benchmarks before we go on to the cooler benchmarks where we run actual life science &amp; informatics pipelines against the hot new gear. Using our <a href="http://www.opscode.com/chef/">Chef Server</a> it&#8217;s trivial for us to orchestrate these new systems into working HPC clusters in just a matter of minutes. We plan to start blogging and demoing live deployment of elastic genome assembly pipelines and NextGen DNA sequencing instrument pipelines (like the <a href="http://www.illumina.com/">Illumina</a> software) on AWS soon. </span></p>
<p><span style="font-family: 'Lucida Grande';">Like <a href="http://perspectives.mvdirona.com/2010/07/13/HighPerformanceComputingHitsTheCloud.aspx">James Hamilton says</a>, the real value in these new EC2 server types lies in the non-blocking 10Gigabit ethernet network backing them up. All of a sudden our &#8220;legacy&#8221; cluster and compute farm practices that involved network filesharing among nodes via NFS, GlusterFS, Lustre and GPFS seem actually feasible rather than a sick masochistic exercise in cloud futility. </span></p>
<p><span style="font-family: 'Lucida Grande';">We expect to see quite a bit of news in the near future about people using NFS, pNFS and other parallel/cluster filesystems for HPC data sharing on AWS &#8211; seems like a no-brainer now that we have full bisectional 10GbE bandwidth between our Compute Cluster cc1.4xlarge instance types. </span></p>
<p><span style="font-family: 'Lucida Grande';">However, despite the fact that the coolest stuff is going to involve what we can do now<strong><em> node-to-node</em></strong> over the fast new networking fabric there is still value in doing the low-level &#8220;what does this new environment look and feel like?&#8221; tests involving EBS disk volumes, S3 access and the like. </span></p>
<p><span style="font-family: 'Lucida Grande';">The Amazon AWS team did a great job preparing the way for people who want to quickly experiment with the new HPC instance types. The EC2 AMI images have to boot off of EBS and run under HVM virtualization rather than the standard paravirtualization used on the other instance types.</span></p>
<p><span style="font-family: 'Lucida Grande';">Recognizing that bootstrapping a HVM-aware EBS-booting EC2 server instance is a non-trivial exercise, AWS created a QuickStart public AMI with CentOS Linux that anyone can use right away:</span></p>
<p><span style="font-family: 'Lucida Grande';"><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-001.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-0011.png" border="0" alt="amiResize-001.png" width="550" height="304" /></span></p>
<p><span style="font-family: 'Lucida Grande';"><strong>The Problem &#8211; how to grow the default 20GB system disk in the QuickStart AMI? </strong></span></p>
<p><span style="font-family: 'Lucida Grande';">As beautiful as the CentOS HVM AMI is, it only gives us 20GB of disk space in it&#8217;s native form. This is perfectly fine for most of our use cases but presented a problem when we decided we wanted to use <a href="http://www.coker.com.au/bonnie++/">bonnie++</a> to perform some <a href="http://blog.bioteam.net/2010/07/13/preliminary-ebs-performance-tests-on-amazon-compute-cluster-cc1-4xlarge-instance-types/">disk IO benchmarks</a> on the local boot volume to complement our tests against more traditional mounted EBS volumes and RAID0 stripe sets.</span></p>
<p><span style="font-family: 'Lucida Grande';">Bonnie++ <strong><em>really</em></strong> wants to work against a filesystem that is at least twice the size of available RAM so as to mitigate any memory-related caching issues when testing actual IO performance. </span></p>
<p><span style="font-family: 'Lucida Grande';">The cc1.4xlarge &#8220;Cluster Compute&#8221; instance comes with ~23GB of physical RAM. Thus our problem &#8212; we wanted to run bonnie++ against the local system disk but the disk is actually smaller than the amount of RAM available to the instance!</span></p>
<p><span style="font-family: 'Lucida Grande';">For this one particular IO test we really wanted a HVM-compatible AMI that had at least 50GB of </span><span style="font-family: 'Lucida Grande';">storage on the boot volume. </span></p>
<p><span style="font-family: 'Lucida Grande';"><strong>The Solution</strong></span></p>
<p><span style="font-family: 'Lucida Grande';">I was shocked and amazed to find that in about ~20 minutes of screwing around with EBS snapshot sizes, instance disk partitions and LVM settings I was able to achieve the goal of converting the Amazon Quickstart 20GB AMI into a custom version where the system disk was 80Gb in size. </span></p>
<p><span style="font-family: 'Lucida Grande';">The fact that this was possible and achievable out of the box without having to debug mysterious boot failures, kernel panics and all the other sorts of things I&#8217;m used to dealing with when messing with low level disk and partition issues is the ultimate testament to both Amazon&#8217;s engineering prowess (<em>how cool is it that we can launch EBS snapshots of arbitrary size</em>?) as well as the current excellent state of Linux, Grub and LVM2. </span></p>
<p><span style="font-family: 'Lucida Grande';">I took a bunch of rough notes so I&#8217;d remember how the heck I managed to do this. Then I decided to clean up the notes and really document the process in case it might help someone else. </span></p>
<p><span style="font-family: 'Lucida Grande';"><strong>The Process</strong></span></p>
<p><span style="font-family: 'Lucida Grande';">I will try to walk through step-by-step the commands and methods used to increase the system boot disk from 20GB in size to 80GB in size. </span></p>
<p><span style="font-family: 'Lucida Grande';">It boils down to two main steps</span></p>
<ul>
<li><span style="font-family: 'Lucida Grande';">Launch the Amazon QuickStart AMI but override &amp; increase the default 20GB boot disk size</span></li>
<li><span style="font-family: 'Lucida Grande';">Get the CentOS Linux OS to recognize that it&#8217;s now running on a bigger disk</span></li>
</ul>
<p><span style="font-family: 'Lucida Grande';">You can&#8217;t do the following step using the <a href="https://console.aws.amazon.com/">AWS Web Management Console</a> as the webUI does not let you alter the parameters of the block device settings. You will need the <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351">command-line EC2 utilities</a> installed and working in order to proceed.</span></p>
<p>On the command line we can easily tell Amazon that we want to start the QuickStart AMI but instead of launching it within a 20GB snapshot of the EBS boot volume we will launch it against a much larger snapshot.</p>
<p>If you look at the info for AMI ami-7ea24a17 within the web page you will see this under the details for the block devices that will be available to the system at boot:</p>
<blockquote><p><span class="label" style="width: 130px;"><span id="images_main_block_devices" class="console-tooltip">Block Devices: </span></span><span class="value">/dev/sda1=snap-1099e578:20:true</span></p></blockquote>
<p>That is basically saying that Linux Device &#8220;/dev/sda1&#8243; will be built from EBS snapshot volume &#8220;snap-1099e578&#8243;. The next &#8220;:&#8221; delimited parameter sets the size to 20GB.</p>
<p>We are going to change that from 20GB to 80GB.</p>
<p>Here is the command to launch that AMI using a disk of 80GB in size instead of the default 20GB.</p>
<p>In the following screenshot, note how we are starting the Amazon AMI ami-7ea24a17 with a block device (the &#8220;-b&#8221; switch) that is bootstrapping itself from the snapshot &#8220;snap-1099e578&#8243;.</p>
<p>All we needed to do in order to make the EC2 server have a larger boot disk is pass in &#8220;80&#8243; to override the default value of 20GB. Confused? Look at the &#8220;-b&#8221; block device argument below, the 80GB is set right after the snapshot name:</p>
<p> </p>
<div class="triple_wide_data" style="width: 97%;"><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-002.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-002.png" border="0" alt="amiResize-002.png" width="553" height="281" /></div>
<p>Your EBS volume might take a bit longer than normal to boot up but once it is online and available you can login normally.</p>
<p>Of course, the system will appear to have the default 20GB system disk:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-003.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-003.png" border="0" alt="amiResize-003.png" width="500" height="346" /></p>
<p>Even the LVM2 physical disk reports show the ~20GB settings:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-004.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-004.png" border="0" alt="amiResize-004.png" width="500" height="174" /></p>
<p>However, if we actually use the &#8216;fdisk&#8217; command to examine the disk we see that the block device is, indeed, much larger than the 20GB the Operating System thinks it has to utilize:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-005.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-005.png" border="0" alt="amiResize-005.png" width="500" height="288" /></p>
<p>Fdisk tells us that disk device /dev/hda has 85.8 GB of physical capacity.</p>
<p>Now we need to teach the OS to make use of that space!</p>
<p>There are only two partitions on this disk, /dev/hda1 is the 100MB /boot partition common to RedHat varients. Lets leave that alone.</p>
<p>The second partition, /dev/hda2 is already set up for logical volumes under LVM. We are going to be lazy. We are just going to use &#8216;fdisk&#8217; to delete the /dev/hda2 partition so that we can immediately recreate it so that it spans the full remaining space on the physical drive.</p>
<p>After typing &#8220;fdisk /dev/hda&#8221; we type &#8220;d&#8221; and delete partition &#8220;2&#8243;. Then we type &#8220;n&#8221; for a new partition of type &#8220;p&#8221; for primary and &#8220;2&#8243; to name it as the second partition. After that we just hit return to accept the default suggestions for the begin and end of the recreated second partion.</p>
<p>If it all worked, we can type the &#8220;p&#8221; command to print the new partition table out.</p>
<p>Note how /dev/hda2 now has <strong><em>many</em></strong> more blocks? Cool!</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-006.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-0062.png" border="0" alt="amiResize-006.png" width="500" height="288" /></p>
<p>We are not done yet. None of our partition changes have actually been written to disk yet. We still need to type &#8220;w&#8221;  to write the new partition table down to disk and &#8220;q&#8221; to exit.</p>
<p>Obviously we can&#8217;t make live changes on a running boot disk. The new partition settings will come into effect after a system reboot.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-007.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-007.png" border="0" alt="amiResize-007.png" width="500" height="288" /></p>
<p>Now we reboot the system and wait for it to come back up.</p>
<p>When it comes back up, don&#8217;t be alarmed that both &#8216;df&#8217; and &#8216;pvscan&#8217; still show the incorrect size:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-008.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-008.png" border="0" alt="amiResize-008.png" width="500" height="255" /></p>
<p>We can fix that! Now we are in the realm of LVM so we need to use the &#8220;pvresize &lt;device&gt;&#8221; command to rescan the physical disk. Since our LVM2 partition is still /dev/hda2 that is the physical device path we give it:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-009.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-009.png" border="0" alt="amiResize-009.png" width="500" height="223" /></p>
<p>Success! LVM recognizes that the drive is larger than 20GB.</p>
<p>With LVM aware that the disk is larger we are pretty much done. We can resize an existing logical volume or add a new one to the default Volume Group (&#8220;VolGroup00&#8243;).</p>
<p>Since I&#8217;m lazy AND I want to mount the extra space away from the root (&#8220;/&#8221;) volume I chose to create a new logical volume that shares the same /dev/hda2 physical volume (&#8220;PV&#8221;) and Volume Group (&#8220;VG&#8221;).</p>
<p>We are going to use the command &#8220;lvcreate VolGroup00 &#8211;size 60G /dev/hda2?&#8221; to make a new 60GB logical volume that is part of the existing Volume Group named &#8220;VolGroup00&#8243;:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-010.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-0102.png" border="0" alt="amiResize-010.png" width="500" height="223" /></p>
<p>Success. Note that our new logical volume got assigned a default name of &#8220;lvol0&#8243; and it now exists in the LVM device path of &#8220;/dev/mapper/VolGroup00-lvol0&#8243;.</p>
<p>Now we need to place a Linux filesystem on our new 60GB of additional space and mount it up. Since I am a fan of XFS on EC2 I need to first install the &#8220;xfsprogs&#8221; RPM and then format the volume. A simple &#8220;yum -y install xfsprogs&#8221; does the trick and now I can make XFS filesystems on my server:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-011.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-011.png" border="0" alt="amiResize-011.png" width="500" height="248" /></p>
<p>Success. We now have 60GB more space, visible to the OS and formatted with a filesystem. The final step is to mount it.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="amiResize-012.png" src="http://blog.bioteam.net/wp-content/uploads/2010/07/amiResize-0121.png" border="0" alt="amiResize-012.png" width="500" height="276" /></p>
<p> </p>
<p>And we are done. We&#8217;ve successfully converted the 20GB Amazon QuickStart AMI into a version with a much larger boot volume<span style="font-family: 'Lucida Grande';">.</span></p>
<p><strong>Conclusion</strong></p>
<p>None of this is rocket science. It&#8217;s actually just Linux Systems Administration 101.</p>
<p>The real magic here is how easily this is all accomplished on our virtual cloud system using nothing but a web browser and some command-line utilities.</p>
<p>What makes this process special for me is how quick and easy it was &#8211; anyone who has spent any significant amount of time managing many physical Linux server systems knows the pain and hours lost when trying to do this stuff in the real world on real (and flaky) hardware.</p>
<p>I can&#8217;t even count how many hours of my life I&#8217;ve lost trying to debug Grub bootloader failures, mysterious kernel panics and other hard-to-troubleshoot booting and disk resizing efforts on production and development server systems when I&#8217;ve altered settings that we&#8217;ve covered in this post. In cluster environments we often have to do this debugging via a 9600 baud serial console or via flaky IPMI consoles. It&#8217;s just nasty.</p>
<p>The fact that this method worked so quickly and so smoothly is probably only amazing to people who know the real pain of having done this in the field, crouched on the floor of a freezing cold datacenter and trying not to pull your hair out as text scrolls slowly by at 9600 baud.</p>
<p>Congrats to the Amazon AWS team. Fantastic work. It&#8217;s a real win when virtual infrastructure is this easy to manipulate.</p>
<p> </p>
<p> </p>
<p> </p>
<img src="http://blog.bioteam.net/?ak_action=api_record_view&id=565&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.bioteam.net/2010/07/14/how-to-resize-an-amazon-ec2-ami-when-boot-disk-is-on-ebs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PGP Universal Server 3 and XenServer 5.5</title>
		<link>http://blog.bioteam.net/2010/04/13/pgp-universal-server-and-xenserver-5-5/</link>
		<comments>http://blog.bioteam.net/2010/04/13/pgp-universal-server-and-xenserver-5-5/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 00:07:41 +0000</pubDate>
		<dc:creator>chrisdag</dc:creator>
				<category><![CDATA[Employee Posts]]></category>
		<category><![CDATA[tech notes]]></category>
		<category><![CDATA[pgp]]></category>
		<category><![CDATA[pgp universal server 3]]></category>
		<category><![CDATA[wde]]></category>
		<category><![CDATA[whole disk encryption]]></category>
		<category><![CDATA[xencenter 5.5]]></category>

		<guid isPermaLink="false">http://blog.bioteam.net/?p=472</guid>
		<description><![CDATA[Background BioTeam is a Massachusetts-based &#8220;virtual&#8221; company in that all of our employees work from home when not traveling on business. Being from Massachusetts is actually important because as of March 31st, 2010 the state has passed a fairly strict set of laws concerning how companies handle digital data. Without going into the details of [...]]]></description>
			<content:encoded><![CDATA[<h3>Background</h3>
<p>BioTeam is a Massachusetts-based &#8220;virtual&#8221; company in that all of our employees work from home when not traveling on business. Being from Massachusetts is actually important because as of March 31st, 2010 the state has passed a fairly strict set of laws concerning how companies handle digital data.</p>
<p>Without going into the details of the Massachusetts data protection laws lets just say that there is one key attribute that we as a company fixated on:</p>
<ul>
<li>Any company that can <strong>prove</strong> that a lost/stolen/missing data storage device or computer was encrypted at the time it went missing<strong> <em>is exempt from the rules covering mandatory event reporting and public breach disclosure</em></strong>.</li>
</ul>
<p>Interesting, huh? Just to be straight here the rule does not exempt us from doing anything stupid or illegal. The law is just written so that mandatory press releases and other data loss notification events do not have to happen if the missing device was <strong><em>provably encrypted</em></strong> (and thus unreadable or unusable) at the time it got lost.</p>
<p>I&#8217;m totally fine with this law and I&#8217;m happy that MA is being aggressive about making sure companies are responsible with sensitive data types and records.</p>
<h3>PGP Whole Disk Encryption &amp; PGP Universal Server</h3>
<p>I don&#8217;t want to shill for PGP so lets cut to the chase and namedrop the software products we chose to allow BioTeam to encrypt all employee digital data in a verifiable way:</p>
<ul>
<li>We use <a href="http://www.pgp.com/products/endpoint_dataprotection/index.html">PGP Desktop with Whole Disk Encryption</a> on all employee Apple Macbook Pro&#8217;s (and a few random Linux &amp; Windows netbooks). The PGP Desktop product does a lot more than just disk encryption but we use it mainly for rendering our laptops unusable without the decryption key as well as to encrypt our USB storage and other portable media devices.</li>
<li>The real magic, however, comes with <a href="http://www.pgp.com/products/universal_server/index.html">PGP Universal Server</a>. This product is an external server that manages our desktop PGP clients including enforcing policy rules, auditing the state of encryption and (handily) making sure that our employee laptops are always loaded with a secondary decryption key that an IT Administrator can use to decrypt the laptop if the staffer ever forgets his or her passphrase.</li>
</ul>
<p>Make sense? PGP Desktop/w WDE is the product we use on the laptops to do the actual encryption and PGP Universal Server is the product that we use for policy management and to generate an audit trail. This is the software combo that fits nicely our needs under the Massachusetts data protection laws but it&#8217;s also just common sense IT procedures for any tech-centric business.</p>
<h3>PGP and Small Business</h3>
<p>I could write a whole blog post on the nightmare involved in getting someone at PGP to actually sell me this software. It was clear (at the time) that the company itself and it&#8217;s legion of resellers simply didn&#8217;t give a damn about small customers looking for less than 100 licensed seats. It was only after I left a whiny blog comment on the internet detailing my hassles that someone at PGP reached out and put me in touch with a reseller who understood small business and was willing to sell us a 10-seat enterprise license for Universal Server.</p>
<p>Not sure if things have changed but if you are an Apple shop looking to go down the same road drop me a line and I&#8217;ll put you in touch with the reseller who hooked us up. That said though, it looks like PGP now has <a href="http://www.pgp.com/products/packages/pgp_wde_we/index.html">&#8220;small business&#8221; and &#8220;workgroup&#8221; edition software</a> now so maybe our use of Universal Server is overkill for the size of our shop.</p>
<h3>Citrix XenEnterprise 4, Universal Server 2 and Apple OS X 10.5</h3>
<p>Prior to Apple releasing version 10.6 (&#8220;Snow Leopard&#8221; of Mac OS X we had things running quite well:</p>
<ul>
<li>Virtualization system running Citrix XenEnterprise 4</li>
<li>PGP Universal Server 2.x running virtual under XenEnterprise 4</li>
<li>PGP Desktop 9.x running on our laptops</li>
</ul>
<p>Running Universal Server under XenEnterprise is not supported by PGP but the install worked perfectly off of the supplied .iso image. The main problem we had was that PGP Universal Server would not reliably report encryption status of Apple disk devices. The devices were actually encrypted but the status change rarely showed up in the reporting tools.  This was a &#8220;known bug&#8221; and we were told to sit tight for a future release.</p>
<h3>The reason for this post:<br />
PGP Universal Server 3, XenServer 5.5 and Apple OS X 10.6</h3>
<p>Now we come for the actual reason for this blog post &#8212; documenting the process (painful) of getting PGP Universal Server 3 to actually function while virtualized under the open-source version of Citrix XenServer 5.5.</p>
<blockquote><p><strong>Warning</strong>: I&#8217;m leaving out tons of information about the mechanics of actually doing the upgrade/install including the details of preserving your Organizational keypair and an encrypted backup configuration file &#8212; both of which are necessary if you want to reload the configuration of your old Universal Server into the new 3.0 system that has to be install from scratch via a CentOS-based .ISO image. Read the PGP docs. Understand also that according to PGP running Universal Server under any virutalization system other than VMWare is also unsupported. PGP will also probably not like you mucking around as root within the Universal Server console as well.</p></blockquote>
<p><strong>Problems with Universal Server 3 and XenCenter 5.5</strong></p>
<p>The problems I had trying to install from the .iso simplified down into the following issues:</p>
<ol>
<li>Booting off of the .iso image and letting the &#8220;<strong>standard</strong>&#8221; install happen automatically seems to work all the way through the final reboot. However, when the system comes up after it&#8217;s inital reboot it freaks out over what appears to be ext3 related filesystem corruption and hangs forever during the boot process.</li>
<li>Choosing the &#8220;<strong>expert</strong>&#8221; install method results in a python crash that takes out the CentOS Anaconda installer software, leaving you stuck and only able to reboot and start over.</li>
<li>Choosing the &#8220;<strong>customnet</strong>&#8221; install method fails in the same way that &#8220;expert&#8221; does &#8212; a python stacktrace pops up and you are stuck only seconds into the install process</li>
</ol>
<p>I did find a manual workaround that got us functional (see screen images below). The basic details are below. Hopefully this will help some other poor soul in the same position!</p>
<ol>
<li>Boot the PGP .ISO image and choose the &#8220;<strong>noautopart</strong>&#8221; install option. For some reason I did not get the anaconda crash when using this method</li>
<li>Manually partition your disk. Easy for me since I&#8217;ve been using CentOS forever but might be hard for some. I chose a very simple partition layout: 100MB ext3 primary partition for &#8220;/boot&#8221;, a 2GB swap partition, a 2GB ext3 &#8220;/tmp&#8221; partition, a 3GB ext3 &#8220;/var&#8221; partition and finally an ext3 partition that spanned the rest of the disk as the &#8220;/&#8221; root partition.</li>
<li>The install will continue automatically. One side effect of the &#8220;noautopart&#8221; option is that the system will not prompt for network setup information and will auto-configure your first NIC to use the IP address 192.168.1.100. Fixing that is the next step</li>
<li>My system actually booted up after following the above steps except for the fact that the PostgreSQL database failed to start and initialize. I am not 100% sure if the problem was due to not having enough memory in the VM when I first booted it (I mistakenly left it at 256MB) or if the database really wanted a fully functional network before it would properly start up.</li>
<li>If your database actually initialized then you still have the problem of the hard-coded network settings. To fix these you&#8217;ll have to first reboot the server into single user mode by appending &#8220;s&#8221; or &#8220;single&#8221; to the kernel parameter in the grub boot menu</li>
<li>Once you are in single-user mode you can use &#8216;vi&#8217; to edit the file &#8220;/opt/ovid/prefs.xml&#8221; &#8212; this is the central configuration file that PGP uses to generate all of the specific Linux configuration settings and files. You <strong>must</strong> edit this file, manually editing network settings or things like /etc/resolv.conf will get overwritten. The file is pretty straightforward XML, just enter the information for your interfaces. A key thing to remember is that if your primary interface is not &#8220;Interface 1&#8243; then there are a number of lines in the prefs.xml file that refer to what interface is used for critical services &#8212; make sure you find and replace all instances of &#8220;Interface 1&#8243; with the interface you actually plan to use.</li>
</ol>
<p>There is a command line tool called &#8220;pgpsysconf&#8221; that can be used for things like &#8220;pgpsysconf &#8211;network &#8211;check&#8221; and &#8220;pgpsysconf &#8211;network&#8221; that will (a) check your network settings and (b) reconfigure the server to use them. They are worth using if only to make sure you did not leave any typos or mistakes in the prefs.xml file.</p>
<p>Didn&#8217;t mean to be so long winded, the simple process looks like this:</p>
<ol>
<li>Boot the ISO, choose &#8220;noautopart&#8221; and manually partition your disk</li>
<li>Boot into single user mode so that you can hand edit and fix /etc/ovid/prefs.xml to enter the real networking and IP information</li>
</ol>
<p>If you have postgres database startup or initialization problems, boot into single user mode and look at the log file that lives in /var/lib/pgsql. All I had to do was delete the &#8220;data/&#8221; directory there and reboot and PGP automatically reinitialized the database.</p>
<p>If you made it to this point you have a functional server and you can now use the web interface to upload your Organizational key and backup configuration file. No more need for hacking around within the VM console.</p>
<p>Some screenshots below.</p>
<p><a title="View 'XenServer 5.5 and PGP Universal Server 3.0' on Flickr.com" href="http://www.flickr.com/photos/8558461@N08/4518726919"><img src="http://farm5.static.flickr.com/4066/4518726919_fda8f90ca3_m.jpg" border="0" alt="XenServer 5.5 and PGP Universal Server 3.0" width="240" height="177" align="left" /></a></p>
<p><a title="View 'XenServer 5.5 and PGP Universal Server 3.0' on Flickr.com" href="http://www.flickr.com/photos/8558461@N08/4518726753"><img src="http://farm5.static.flickr.com/4036/4518726753_3a100108bc_m.jpg" border="0" alt="XenServer 5.5 and PGP Universal Server 3.0" width="240" height="213" align="left" /></a></p>
<p><a href="http://blog.bioteam.net/wp-content/uploads/2010/04/xen-pgp-2.png"><img src="http://blog.bioteam.net/wp-content/uploads/2010/04/xen-pgp-2.png" border="0" alt="xen-pgp-2.png" width="240" align="left" /></a></p>
<img src="http://blog.bioteam.net/?ak_action=api_record_view&id=472&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.bioteam.net/2010/04/13/pgp-universal-server-and-xenserver-5-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cluster user training</title>
		<link>http://blog.bioteam.net/2009/12/21/cluster-user-training/</link>
		<comments>http://blog.bioteam.net/2009/12/21/cluster-user-training/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 19:57:19 +0000</pubDate>
		<dc:creator>cdwan</dc:creator>
				<category><![CDATA[Employee Posts]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[tech notes]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[gridengine]]></category>

		<guid isPermaLink="false">http://blog.bioteam.net/?p=365</guid>
		<description><![CDATA[On the same trip to India, I found myself in the position of delivering a training session to a room with incredibly varied backgrounds and skill levels. Some folks had never edited a file on the Unix command line before. Others just wanted to know where MPICH was installed. This set of slides goes from [...]]]></description>
			<content:encoded><![CDATA[<p>On the same trip to India, I found myself in the position of delivering a training session to a room with incredibly varied backgrounds and skill levels.  Some folks had never edited a file on the Unix command line before.  Others just wanted to know where MPICH was installed.  This set of slides goes from an introduction to the bash shell through building MPI programs and SGE integration.</p>
<p>Please do not re-distribute without attribution.</p>
<p><a href="http://blog.bioteam.net/wp-content/uploads/2009/12/2009-Cluster-User.pdf"><img class="alignnone size-full wp-image-367" title="cluster_user_icon" src="http://blog.bioteam.net/wp-content/uploads/2009/12/cluster_user_icon.png" alt="" width="172" height="135" /></a></p>
<img src="http://blog.bioteam.net/?ak_action=api_record_view&id=365&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.bioteam.net/2009/12/21/cluster-user-training/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inquiry Cluster Admin Slides</title>
		<link>http://blog.bioteam.net/2009/12/21/inquiry-cluster-admin-slides/</link>
		<comments>http://blog.bioteam.net/2009/12/21/inquiry-cluster-admin-slides/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 19:38:32 +0000</pubDate>
		<dc:creator>cdwan</dc:creator>
				<category><![CDATA[Employee Posts]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[tech notes]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[SGE]]></category>
		<category><![CDATA[slides]]></category>

		<guid isPermaLink="false">http://blog.bioteam.net/?p=358</guid>
		<description><![CDATA[I recently took a trip to Kolkata, India to train users and administrators of an Apple / Inquiry compute cluster there. The slides I developed for that trip may be of general interest, and so I&#8217;m sharing them here. The intent of these slides is to provide an overview of the administrative tools and systems [...]]]></description>
			<content:encoded><![CDATA[<p>I recently took a trip to Kolkata, India to train users and administrators of an Apple / Inquiry compute cluster there.  The slides I developed for that trip may be of general interest, and so I&#8217;m sharing them here.  The intent of these slides is to provide an overview of the administrative tools and systems used in an Apple Inquiry cluster.</p>
<p>Please do not redistribute without attribution.  </p>
<p><a href='http://blog.bioteam.net/wp-content/uploads/2009/12/Cluster_Admin.pdf'><img src="http://blog.bioteam.net/wp-content/uploads/2009/12/cluster_admin_icon.png" alt="" title="cluster_admin_icon" width="169" height="134" class="alignnone size-full wp-image-361" /></a></p>
<img src="http://blog.bioteam.net/?ak_action=api_record_view&id=358&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.bioteam.net/2009/12/21/inquiry-cluster-admin-slides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up LOM on an Apple XServe from the command line</title>
		<link>http://blog.bioteam.net/2009/12/03/setting-up-lom-on-an-apple-xserve-from-the-command-line/</link>
		<comments>http://blog.bioteam.net/2009/12/03/setting-up-lom-on-an-apple-xserve-from-the-command-line/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 15:48:05 +0000</pubDate>
		<dc:creator>cdwan</dc:creator>
				<category><![CDATA[Employee Posts]]></category>
		<category><![CDATA[tech notes]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[os x]]></category>

		<guid isPermaLink="false">http://blog.bioteam.net/?p=354</guid>
		<description><![CDATA[Apple provides a GUI for setting up the IP address and authentication information on the LOM.  The problem, for me, with using a GUI for something like this is that it's nearly impossible to script and automate.  When I'm setting up a cluster of even a dozen nodes, going through a remote desktop to a GUI becomes intolerable in a hurry.  This post shares my recipe for getting the LOM ports on the network and accessible, using only the command line.]]></description>
			<content:encoded><![CDATA[<p>Apple&#8217;s XServe comes with a Lights Out Management (LOM) capability.  For anyone dealing with co-located servers or clusters, this is an essential feature.  Remote monitoring, power, and so on are lifesavers when something goes wrong.</p>
<p>Apple provides a GUI for setting up the IP address and authentication information on the LOM.  The problem, for me, with using a GUI for something like this is that it&#8217;s nearly impossible to script and automate.  When I&#8217;m setting up a cluster of even a dozen nodes, going through a remote desktop to a GUI becomes intolerable in a hurry.  </p>
<p>The command line tool for changing settings on the LOM is a standard one called &#8216;ipmitool&#8217;.  While the internal documentation is good, the usage can be a little obscure.  Here, therefore, are the commands that I use to set up and enable channel 1 (ethernet port 1, or eth0):</p>
<p>I feel compelled to note that you will need to use different IP addresses for the various hosts you&#8217;re setting up.  Also, you *really* don&#8217;t want to set the LOM Ip address to conflict with the IP address of the operating system.  Really, you&#8217;re setting up a small, separate, out of band machine to manage the big expensive server.  Think of it as a different machine, and you&#8217;ll be all set.</p>
<p>For most of the clusters I build, I address the compute nodes as 192.168.2.1 = node001, and so on.  For clusters of less than 100 nodes, I set the LOM address to the node address plus 100.  Thus, these settings would be appropriate for node015.</p>
<p><code>ipmitool lan set 1 ipaddr 192.168.2.115<br />
ipmitool lan set 1 netmask 255.255.255.0<br />
ipmitool lan set 1 defgw ipaddr 192.168.2.254<br />
ipmitool lan set 1 access on<br />
ipmitool lan set 1 arp respond on</code></p>
<p>At this point, the IP address of the LOM ought to respond to pings.  All that&#8217;s left is to set up and enable a user account.  Note that we&#8217;re now talking about user number two, rather than port number 1:</p>
<p><code>ipmitool user set name 2 admin<br />
ipmitool user set password 2<br />
  ** You get to type the password twice **<br />
ipmitool user enable 2</code></p>
<p>FInally, I associate user number 2 with port number 1:</p>
<p><code>ipmitool user priv 2 4 1</code></p>
<p>I have yet to find a way around typing all those IP addresses into the Server Monitor tool.</p>
<img src="http://blog.bioteam.net/?ak_action=api_record_view&id=354&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.bioteam.net/2009/12/03/setting-up-lom-on-an-apple-xserve-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH tunnels part 3:  Reverse tunnels</title>
		<link>http://blog.bioteam.net/2009/11/04/ssh-tunnels-part-3-reverse-tunnels/</link>
		<comments>http://blog.bioteam.net/2009/11/04/ssh-tunnels-part-3-reverse-tunnels/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 15:05:15 +0000</pubDate>
		<dc:creator>cdwan</dc:creator>
				<category><![CDATA[Employee Posts]]></category>
		<category><![CDATA[tech notes]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[reverse ssh]]></category>
		<category><![CDATA[reverse ssh tunnel]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh tunnel]]></category>

		<guid isPermaLink="false">http://blog.bioteam.net/?p=328</guid>
		<description><![CDATA[The problem addressed here is the same as the previous two, except that the remote administrator won't open up *any* ports in their firewall.  Machines on the customer's network can connect <b>out</b> onto the internet, but there is no direct way to connect to them from out here.  This post describes how to set up a pair of tunnels that meet in the middle, allowing me access to machines that don't even have a public IP address.]]></description>
			<content:encoded><![CDATA[<p>In the previous two posts, I laid out the basics of forward ssh tunnels.  Now it&#8217;s time to delve into the dark magic of the reverse tunnel.  For reference, here are the first two articles:</p>
<p>* <a href="http://blog.bioteam.net/2009/10/30/ssh-tunnels-for-beginners/">Intro to ssh tunnels</a><br />
* <a href="http://blog.bioteam.net/2009/11/01/ssh-tunnels-part-2/">Chaining ssh tunnels together</a></p>
<p>The problem addressed in this post is the same as the previous two, except that the remote administrator won&#8217;t open up *any* ports in their firewall.  Machines on the customer&#8217;s network can connect <strong>out</strong> onto the internet, but there is no direct way to connect <strong>in</strong> from out here.  This is remarkably common, either because the admin only has a limited number of public IP addresses, or because most organizations are very private with their machines.   This post describes how to set up a pair of tunnels that meet in the middle on my co-located server, allowing me access to machines that don&#8217;t even have a public IP address.</p>
<p>Ssh tunnels are <strong>directional</strong>.  When I open a tunnel with &#8220;-L&#8221;, I am opening a path from the originating machine <strong>forward</strong> to the target.  The other tunnel argument, &#8220;-R&#8221;, opens a <strong>reverse</strong> tunnel from a port on the destination machine back to the originator.  In the <a href="http://blog.bioteam.net/2009/11/01/ssh-tunnels-part-2/">second post</a> I set up a connection letting me see into remote.customer.com from demo.bioteam.net.  However, someone sitting at remote.customer.com wouldn&#8217;t be able to see back down that tunnel.</p>
<p>It&#8217;s worth noting that at this point we run a risk of violating security policies at the customer site.  By enlisting a co-conspirator inside the firewall, we&#8217;re getting access to resources that are very clearly supposed to be inaccessible.  Bioteam&#8217;s practice is to be totally above board about what we are doing and why we&#8217;re doing it.  Many security / networking folks agree that the goal of a network setup like this is to prevent <strong>unauthorized</strong> access.  In that circumstance, we can frequently agree that my access is authorized, and that it&#8217;s simpler for short term or one time connections to use ssh tunnels to get the job done.  However, if the policy is actually to prevent <strong>any</strong> remote access, there&#8217;s no getting around it.  In those cases, I get in a car or on a plane.  Many of my long term clients have started off giving me reverse ssh tunnels while we waited for the organizational paperwork on a &#8220;real&#8221; solution like VPN access.</p>
<p>Short version:  There are times when it&#8217;s better to ask forgiveness than permission.  Dealing with network security is not one of them.  Building trust with the people responsible for a computing network requires both honesty and demonstrated competence over a period of time.  If you sneak around behind people&#8217;s backs, you will eventually get burned.</p>
<p>The target machine is called:  <code>customer.private</code><br />
I have an account on that machine: <code>bioteam</code><br />
Bioteam&#8217;s co-located server is still:  <code>demo.bioteam.net</code><br />
My account on bioteam&#8217;s server: <code>cdwan</code><br />
The customer also gets an account on bioteam&#8217;s server:  <code>customer</code></p>
<p>The customer needs to be logged into <code>customer.private</code> and connect from there to <code>demo.bioteam.net</code> like this:</p>
<p><code>ssh demo.bioteam.net -l customer <strong>-R 9001:customer.private:80</strong></code></p>
<p>That specification has three parts:</p>
<p>* 9001:  The port <strong>on demo.bioteam.net</strong> on which the tunnel listens<br />
* customer.private:  The machine on which the tunnel ends.  This is the part where terms like &#8220;localhost&#8221; get really confusing.  In this case &#8220;localhost&#8221; would work just as well, but I&#8217;m making it explicit.<br />
* 80:  The port where the tunnel ends.</p>
<p>From my laptop, I open up a forward tunnel exactly as before:</p>
<p><code>ssh demo.bioteam.net -l cdwan -L 9000:localhost:9001</code></p>
<p>That&#8217;s it.  We&#8217;ve got a tunnel from my side to port 9001 on <code>demo.bioteam.net</code>, and another tunnel from 9001 to port 80 on <code>customer.private</code>.  I connect to <code>http://localhost:9000</code> on my laptop, and I should see the webserver on customer.private.  We&#8217;ve created the same chained pair of tunnels from the <a href="http://blog.bioteam.net/2009/11/01/ssh-tunnels-part-2/">previous post</a>, but with one originating on each side rather than me pushing both of them forward.</p>
<p>The attentive reader may ask &#8220;if there&#8217;s a tunnel listening at demo.bioteam.net:9001, can&#8217;t you just connect your web server directly to <code>http://demo.bioteam.net:9001</code>?   This is a good question.  The answer is &#8220;yes, but you need to explicitly ask for this functionality.&#8221;  By default, ssh tunnels only listen to requests originating from within the machine itself.  The tunnel listens on what is called the &#8220;loopback&#8221; interface and is not visible from outside the machine.  While it&#8217;s possible to get around this, I&#8217;ve found it to be a universally bad idea in my work with Bioteam.  It represents enough of a potential security hole that I just don&#8217;t do it.</p>
<p>Notice also that the customer didn&#8217;t have to give me an ssh account on their machine.  Instead, we both connected to some machine in the middle (demo.bioteam.net) and I was able to see their web server.   As before, as soon as either ssh connection closes, the access is gone.  This has a pleasing symmetry insofar as I&#8217;m asking for access by giving the customer an account on my machine.</p>
<p>Now for the meat of it:  Assume that the customer wants to let me log in via ssh.  This means that the reverse tunnel needs to terminate at the ssh port (22) rather than the http port (80).  Otherwise it&#8217;s exactly the same:</p>
<p><code>ssh demo.bioteam.net -l customer -R 9002:customer.private:22</code></p>
<p>With that in place, I can log in to <code>demo.bioteam.net</code> and then run this:</p>
<p><code>ssh localhost -l bioteam -p 9002</code></p>
<p>If everything has gone correctly, I will get a password prompt, type my password for cutomer.private, and see a shell prompt for a machine without a public internet IP.</p>
<p>Of course, I can create my own tunnels using that connection.  For example, with the reverse tunnel from above in place, I can set up my very own tunnel from port 9010 on my laptop, through port 9011 on demo.bioteam.net, to the webserver on remote.customer.com.  This is the part where the &#8220;localhosts&#8221; get almost impenetrably confusing:</p>
<p><code>ssh demo.bioteam.net -l cdwan -L 9010:localhost:9011<br />
ssh localhost -l bioteam -p 9002 -L 9011:localhost:80</code></p>
<img src="http://blog.bioteam.net/?ak_action=api_record_view&id=328&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.bioteam.net/2009/11/04/ssh-tunnels-part-3-reverse-tunnels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH Tunnels &#8211; part 2</title>
		<link>http://blog.bioteam.net/2009/11/01/ssh-tunnels-part-2/</link>
		<comments>http://blog.bioteam.net/2009/11/01/ssh-tunnels-part-2/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 21:41:25 +0000</pubDate>
		<dc:creator>cdwan</dc:creator>
				<category><![CDATA[Employee Posts]]></category>
		<category><![CDATA[tech notes]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh tunnel]]></category>

		<guid isPermaLink="false">http://blog.bioteam.net/?p=323</guid>
		<description><![CDATA[In a previous post I described how and why one might set up a very simple ssh tunnel in order to access a web server or a remote desktop server on a machine with a restrictive firewall.  This post goes one step deeper, showing how to chain tunnels together.]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://blog.bioteam.net/2009/10/30/ssh-tunnels-for-beginners/">previous post</a> I described how and why one might set up a very simple ssh tunnel in order to access a web server or a remote desktop server on a machine with a restrictive firewall.  This post goes one step deeper, showing how to chain tunnels together.</p>
<p>With this added complexity, we have hit the point where there are many, many ways to skin this particular cat.  My aim in these posts is to show how <strong>I</strong> do things, demonstrating the underlying tools along the way.  Hopefully, this will let you build up your own set of techniques in a way that makes sense to you.</p>
<p>A very common practice among the network security folks I meet is to ask &#8220;where will you be logging in from?&#8221;  They then make an exception in their firewall rules for traffic from my particular machine.  This makes a lot of sense, but it limits my flexiblity.   If I give them the address of my home internet connection, then I won&#8217;t be able to connect while I&#8217;m on the road, and so on.  In addition, if I need to let my colleagues see what I&#8217;m dealing with in order to get their help debugging something, we need a way to share that hole in the firewall.</p>
<p>My solution is to give an IP address of a server in Bioteam&#8217;s co-location facility, and then use ssh tunnels to bounce my connections through that server and into the customer&#8217;s network.  This has the added social benefit of giving the customer a &#8220;bioteam.net&#8221; IP address rather than my home.  I think that this looks a bit more professional.</p>
<p>My server is called &#8220;demo.bioteam.net&#8221;<br />
I log into my server with the username &#8220;cdwan&#8221;</p>
<p>The customer&#8217;s server is &#8220;remote.customer.com&#8221;<br />
I log into the customer&#8217;s server with the username &#8220;bioteam&#8221;</p>
<p>As before, the first thing to check is that straightforward, vanilla ssh connections work:</p>
<p><code>ssh demo.bioteam.net -l cdwan</code></p>
<p>I will be prompted for a password.   This first time, I enter the password for &#8220;cdwan&#8221; on the bioteam machine.  Next, within that ssh session, I connect to the customer&#8217;s machine:</p>
<p><code>ssh remote.customer.com -l bioteam</code></p>
<p>Again, the password prompt &#8211; but this time I have to enter the password for &#8220;bioteam&#8221; on the customer&#8217;s machine.</p>
<p>It feels a little pedantic to specify which password goes where, but I find that the second most common source of confusion about ssh tunnels is figuring out which machine is demanding a password.  As you start to build up more and more complex systems, it&#8217;s key to remember where you are and where you are trying to go.</p>
<p>Assume that we want to take a look at the web server on the remote machine.  If the security folks made a complete (all ports) exception for my host (demo.bioteam.net), then this is pretty simple.  From my laptop, I do this:</p>
<p><code>ssh demo.bioteam.net -l cdwan <strong>-L 8999:remote.customer.com:80</strong></code></p>
<p>This is exactly the same as the first example in the <a href="http://blog.bioteam.net/2009/10/30/ssh-tunnels-for-beginners/">first post</a> in this series, except that instead of connecting to &#8220;localhost,&#8221; I&#8217;m telling ssh to point at some external machine.</p>
<p>I will make a practice of changing the port number in these examples (8999 vs. 9000 in this case) to demonstrate that it doesn&#8217;t matter what number you use <strong>as long as it is not in use for anything else</strong>.  If you try to open a tunnel on a port that is already in use by another process (someone else&#8217;s ssh tunnel to a different machine, for example) the command will fail.</p>
<p>There is a pretty safe range of ports from about 8900 to about 9100 that I tend to use for these purposes.  I make a practice of picking numbers pretty much at random.  You should do the same, rather than just hitting &#8220;up arrow, return&#8221; on some command cut and pasted from a blog post.</p>
<p>In actual practice, Bioteam sets up virtual machines &#8211; one per customer &#8211; to prevent us from stepping on each other&#8217;s connections and ssh keys.  This has other benefits as well, the best being that we can give customers an account on our systems to share files &#8211; which is often simpler to do than convincing their networking team to let us into their machines.</p>
<p>Anyway, with the above tunnel in place, I can look at the URL below and see the remote machine:</p>
<p><code>http://localhost:8999</code></p>
<p>It&#8217;s worth noting that I could do almost the same thing by opening a remote desktop (or VNC) connection to demo.bioteam.net and running a web browser in that remote session.  I find this to be inferior because remote desktops invariably have less pixels and worse mouse control than my local browser.</p>
<p>I would use exactly the same sort of command if the customer wanted me to use their &#8220;DMZ&#8221; gateway machine to access their network, rather than my own.  This happens in lots of cases.  The key here is that once I have ssh access to a machine &#8211; I can point whatever application I want at anything that machine can see.</p>
<p>The setup above works as long as there is a clear path from demo.bioteam.net to remote.customer.com.  As an additional complexity, assume that we now encounter the firewall problem from my first post.  The security folks only opened port 22 (ssh) and only from demo.bioteam.net.</p>
<p>To overcome this, we need to chain ssh tunnels together.  Here&#8217;s the example:</p>
<p><code>ssh demo.bioteam.net -l cdwan <strong>-L 8999:localhost:9000</strong></code></p>
<p>From within that session, connect to the remote machine like this:</p>
<p><code>ssh remote.customer.com -l bioteam <strong>-L 9000:localhost:80</strong></code></p>
<p>And then look at the same URL:</p>
<p><code>http://localhost:8999</code></p>
<p>Here&#8217;s what happens:  I have one tunnel leading from my laptop&#8217;s port 8999 to port 9000 on demo.bioteam.net.  I have a <strong>second</strong> tunnel from port 9000 into remote.customer.com.  Under the hood, ssh near-magically forwards packets along and does the right thing to tie them together.</p>
<p>There is absolutely no need for those tunnels to be opened in the same ssh session or from the same terminal.  In fact, in the next post I will show how to open one tunnel from each side to meet in the middle.</p>
<p>It is possible to chain tunnels together arbitrarily.  The longest series that I&#8217;ve ever built was three deep, but I&#8217;m not aware of any fundamental limitation on that &#8211; other than my own ability to keep track of accounts and passwords.</p>
<img src="http://blog.bioteam.net/?ak_action=api_record_view&id=323&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.bioteam.net/2009/11/01/ssh-tunnels-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SSH Tunnels For Beginners</title>
		<link>http://blog.bioteam.net/2009/10/30/ssh-tunnels-for-beginners/</link>
		<comments>http://blog.bioteam.net/2009/10/30/ssh-tunnels-for-beginners/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 14:48:32 +0000</pubDate>
		<dc:creator>cdwan</dc:creator>
				<category><![CDATA[Employee Posts]]></category>
		<category><![CDATA[tech notes]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh tunnel]]></category>

		<guid isPermaLink="false">http://blog.bioteam.net/?p=318</guid>
		<description><![CDATA[A basic introduction to ssh tunnels:  As a first puzzle, assume that a friendly administrator gave me an ssh account on her web server.  However, her organization's security scheme only allows me to get to port 22.  I can ssh in, but I can't really debug some problem with the web browser because port 80 is still blocked.  Assume as well that we've already called up the network administrator, who offered to think about it - laughed maniacally - and hung up on us. ]]></description>
			<content:encoded><![CDATA[<p>SSH tunnels are some of the most powerful utilities in the entire command line arsenal.  They allow me to connect to arbitrary ports on remote machines.  I use them daily to navigate the somewhat arbitrary networking requirements that I encounter from both software tools and network administrators.  I have found that it is invariably easier to figure out how to construct a tunnel than it is to convince network security folks to open more ports in their firewalls.  Even though I can be flippant about this, all of these techniques remain true to the spirit, if occasionally subverting the letter, of the network access requirements imposed by my customers.</p>
<p>This post provides a very basic intro to forward tunnels.  I hope to shed some light on reverse tunnels in a future post.</p>
<p>Firewalls and other network devices frequently limit the network ports that I am allowed to access.  A very reasonable policy might only allow access over ssh (port 22) from machines outside of a local network.  That&#8217;s well and good, but in my work I often need to see web servers (port 80) and/or Apple&#8217;s Remote Desktop or VNC (port 5900).</p>
<p>As a first puzzle, assume that a friendly administrator gave me an ssh account on her web server.  However, because I&#8217;m not working onsite, her organization&#8217;s security scheme only allows me to get to port 22.  I can ssh in, but I can&#8217;t really debug some problem with the web browser because port 80 is still blocked.  Assume as well that we&#8217;ve already called up the network administrator, who said &#8220;no,&#8221; there are no exceptions to this security policy.</p>
<p>The remote machine is called:  &#8220;remote.customer.com&#8221;<br />
I will log into that remote machine with an account called &#8220;cdwan&#8221;</p>
<p>I run this perfectly ordinary ssh command to log in, and it works:</p>
<p><code>ssh remote.customer.com -l cdwan</code></p>
<p>Keep in mind that if that first command doesn&#8217;t work &#8211; there&#8217;s nothing I can do to make the rest work.  With that in hand, I am going to add the forward tunnel specification:</p>
<p><code>ssh remote.customer.com -l cdwan <strong>-L 9000:localhost:80</strong></code></p>
<p>The tunnel specification is in three parts:</p>
<p>* First is the port on <strong>my</strong> local machine into which I peer<br />
* The middle is the target hostname I want to connect to <strong>as it is seen on the remote machine</strong>.  In this simple example, I&#8217;m going to &#8220;localhost&#8221;, which really means &#8220;remote.customer.com&#8221;.  I think that this is the most frequent source of confusion with tunnels, figuring out the context in which hostnames are evaluated.<br />
* Last  is the port to connect <strong>to</strong> on that target machine.  That&#8217;s where the tunnel ends.</p>
<p>So, I&#8217;m setting up a connection from my local machine&#8217;s port 9000 to port 80 on remote.customer.com.</p>
<p>Once that tunnel is in place, I should be able to open a web browser and look at the URL below to see the web server on the remove machine:</p>
<p><code>http://localhost:9000</code></p>
<p>From the point of view of the web browser, I&#8217;m looking at port 9000 on my local machine.  My ssh connection is catching those requests on port 9000, forwarding them along to the remote machine, and passing them to port 80.  Responses come back by the same route.</p>
<p>The connection will only stay open as long as the ssh connection is active.  As soon as I log out, my tunnel goes away.  While I&#8217;m connected, all of my traffic goes over port 22, and is encrypted in exactly the same way as the rest of my ssh traffic.  It&#8217;s actually a remarkably stable and secure solution to this problem.</p>
<p>I&#8217;ll close this post with the fact that ssh accepts multiple instances of the &#8220;-L&#8221; flag.  So, if I want to connect to both a web server (port 80) and a remote desktop server (port 5900), I can do this:</p>
<p><code>ssh remote.customer.com -l cdwan -L 9000:localhost:80 -L 9001:localhost:5900</code></p>
<p>With that in place, I can point my web browser at localhost:9000, and my remote desktop client at localhost:9001.</p>
<img src="http://blog.bioteam.net/?ak_action=api_record_view&id=318&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.bioteam.net/2009/10/30/ssh-tunnels-for-beginners/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Binding Apple&#8217;s Open Directory from the Command Line</title>
		<link>http://blog.bioteam.net/2009/10/29/binding-apples-open-directory-from-the-command-line/</link>
		<comments>http://blog.bioteam.net/2009/10/29/binding-apples-open-directory-from-the-command-line/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 16:32:35 +0000</pubDate>
		<dc:creator>cdwan</dc:creator>
				<category><![CDATA[Employee Posts]]></category>
		<category><![CDATA[tech notes]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[os x]]></category>

		<guid isPermaLink="false">http://blog.bioteam.net/?p=314</guid>
		<description><![CDATA[Here is a trick I use a couple of times a month to get finicky compute nodes in a Apple compute clusters to correctly bind to their LDAP / Open Directory master. This started working as of OS X 10.4, and to my knowledge it still works as of OS X 10.6.1. Bioteam uses a [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a trick I use a couple of times a month to get finicky compute nodes in a Apple compute clusters to correctly bind to their LDAP / Open Directory master.  This started working as of OS X 10.4, and to my knowledge it still works as of OS X 10.6.1.</p>
<p>Bioteam uses a pretty standard architecture, where the portal has the IP address and domain settings below. Modifying those for your particular setup is left as an exercise for the reader.</p>
<p><code>ldapsearch -h 192.168.2.254 -b "dc=cluster,dc=private" -x</p>
<p>slapconfig -setldapstatic 192.168.2.254</code></p>
<p>Apple&#8217;s &#8220;Directory Utility&#8221; GUI app is great, but for cluster maintenance you really can&#8217;t beat the command line.</p>
<img src="http://blog.bioteam.net/?ak_action=api_record_view&id=314&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.bioteam.net/2009/10/29/binding-apples-open-directory-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
