<?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>VCritical &#187; scripting</title>
	<atom:link href="http://www.vcritical.com/tag/scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vcritical.com</link>
	<description>Informed Virtualization Criticism</description>
	<lastBuildDate>Wed, 19 Oct 2011 22:08:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Automating SSL Certificate Deployments for HP iLO</title>
		<link>http://www.vcritical.com/2010/11/automating-ssl-certificate-deployments-for-hp-ilo/</link>
		<comments>http://www.vcritical.com/2010/11/automating-ssl-certificate-deployments-for-hp-ilo/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 15:33:26 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[ilo]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=2979</guid>
		<description><![CDATA[In this article I show you how to become your own Certificate Authority (CA) and write a simple script that automatically deploys a signed SSL certificate to an HP iLO controller.]]></description>
			<content:encoded><![CDATA[<h2>Self-Signed Certificates Considered Annoying</h2>
<p>You&#8217;ve likely seen this warning countless times when accessing self-signed SSL-encrypted web applications, such as the one used for remotely managing HP servers through iLO:</p>
<p><img style=' display: block; margin-right: auto; margin-left: auto;'  class="aligncenter size-full wp-image-2986" title="We recommend  closing this webpage" src="http://www.vcritical.com/wp-content/uploads/2010/11/recommend_closing_webpage.png" alt="" width="576" height="142" /></p>
<p>In order to get on with your business, the only real choice is to rotely click the <em>not recommended </em>link.  Using iLO doubles the annoyance because the prompt appears <em>again </em>when subsequently opening a remote console window.</p>
<p>The solution, of course, is to install signed SSL certificates to stop web browsers from complaining.  Given a private Certificate Authority (CA), installing signed certificates is normally an interactive process that involves some clicking and pasting.  Take a look at these articles from <a href="http://thelazyadmin.com/blogs/thelazyadmin/archive/2007/06/11/using-certificates-with-compaq-hp-riloe-and-ilo-hardware.aspx" target="_blank">Jason Boche</a> and <a href="http://www.rtfm-ed.co.uk/2007/06/11/using-self-signed-ssl-certificates-with-hp-ilo/" target="_blank">Mike Laverick</a> for additional background.</p>
<p>The one-by-one manual approach is fine for a handful of systems, but setting up a c7000 chassis full of 16 blade servers is an opportunity begging for automation.  In this article I will show you how to become your own CA and write a simple script that automatically deploys a  signed SSL certificate to an HP iLO controller.<br />
<span id="more-2979"></span></p>
<h2>Overview</h2>
<p>From a high level, these are the tasks:</p>
<ol>
<li>Become your own CA with a Linux system and OpenSSL</li>
<li>Import that CA certificate into web browsers</li>
<li>Download the HP Perl iLO utility</li>
<li>Adapt the sample shell script below to work in your environment</li>
</ol>
<p>Keep in mind that the process described here works best for environments where a known group of individuals needs to administer servers, such as in a lab.  For production systems with many users, certificates from a trusted CA are much more appropriate.</p>
<h2>Becoming Your Own CA</h2>
<p>Most Linux distributions come with OpenSSL and everything needed to run your own private CA &#8212; naturally, I am using <a href="http://www.vcritical.com/tag/sles/">SLES for VMware</a>.  Locate the script called <strong>CA.pl</strong> and optionally increase the CA certificate expiration from 3 years to 10 years, e.g.:</p>
<pre>vi /usr/share/ssl/misc/CA.pl</pre>
<p>Find the following line and modify accordingly:</p>
<pre>$CADAYS="-days 3650";</pre>
<p>Next, create a directory to use for the base of your private CA and run the following command there, following the interactive prompts:</p>
<pre>/usr/share/ssl/misc/CA.pl -newca</pre>
<p>I also chose to remove the passphrase from the resulting private key in order to make the automation script simpler.  To create an unprotected version, use the following command and then rename/swap with the original:</p>
<pre>openssl rsa -in ./demoCA/private/cakey.pem -out nopasswd-tmp.pem</pre>
<p>Have a look at /etc/ssl/openssl.cnf to change certain default behaviors &#8212; optional.</p>
<h2>Import CA Certificate to Web Browsers</h2>
<p>Next you need to tell your web browser(s) to trust your private CA &#8212; you&#8217;ll also need to distribute this certificate to other administrators on your team so they can do the same.</p>
<p>The certificate is located by default at ./demoCA/cacert.pem;  take a copy and rename it with a .crt extension to make it easier to import &#8212; simply double-clicking in Windows will get the process started for Internet Explorer.  Be sure to import into the <strong>Trusted Root Certification Authorities</strong>:</p>
<p><img style=' display: block; margin-right: auto; margin-left: auto;'  class="aligncenter size-full wp-image-2985" title="Import trusted root certificate in IE" src="http://www.vcritical.com/wp-content/uploads/2010/11/ie_import_trusted_root_certificate.png" alt="" width="513" height="466" /></p>
<p>Firefox has its own certificate store, which can be reached as seen here &#8212; be sure to select the <strong>Authorities</strong> tab:</p>
<p><img style=' display: block; margin-right: auto; margin-left: auto;'  class="aligncenter size-full wp-image-2983" title="Import trusted root certificate in Firefox" src="http://www.vcritical.com/wp-content/uploads/2010/11/firefox_import_trusted_root_cert.png" alt="" width="528" height="494" /></p>
<h2>Set Up iLO Utilities</h2>
<p>Download the <a href="http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.jsp?lang=en&amp;cc=us&amp;prodTypeId=15351&amp;prodSeriesId=1121516&amp;swItem=MTX-9ded60bd746942e18651211f51&amp;mode=4&amp;idx=1" target="_blank">HP Lights-Out XML PERL Scripting Sample for Linux</a> in order to get the <strong>locfg.pl</strong> script.  You may need to install a couple of additional Perl modules to get everything working &#8212; see the documentation if you get stuck.  Hint: you can most likely use the package manager for your Linux distribution to add the modules.</p>
<p>Here is a test command to run in order to verify things are working:</p>
<pre>locfg.pl -f Cert_Request.xml -u Administrator -p s3kr3t -s ilo-host-name</pre>
<p>If an XML response is returned that includes a CERTIFICATE REQUEST element, you are ready to get started with the automation&#8230;</p>
<h2>Create Automation Scripts</h2>
<p>Place <strong>locfg.pl</strong> and the following 4 files in the same directory that was previously created for the CA:</p>
<p><strong>auto-ilo-cert.sh</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">AUTH</span>=<span style="color: #ff0000;">'-u Administrator -p s3kr3t'</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 &quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
        <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">ILO</span>=<span style="color: #007800;">$1</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;running on <span style="color: #007800;">$ILO</span>...&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;subjectAltName=IP:&quot;</span><span style="color: #000000; font-weight: bold;">`</span>host <span style="color: #007800;">$ILO</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $4}'</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$ILO</span>.ext
&nbsp;
.<span style="color: #000000; font-weight: bold;">/</span>locfg.pl <span style="color: #660033;">-f</span> Cert_Request.xml <span style="color: #007800;">$AUTH</span> <span style="color: #660033;">-s</span> <span style="color: #007800;">$ILO</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$ILO</span>-req.pem
&nbsp;
openssl ca <span style="color: #660033;">-policy</span> policy_anything <span style="color: #660033;">-batch</span> <span style="color: #660033;">-extfile</span> <span style="color: #007800;">$ILO</span>.ext <span style="color: #660033;">-days</span> <span style="color: #000000;">3650</span> <span style="color: #660033;">-out</span> <span style="color: #007800;">$ILO</span>.pem <span style="color: #660033;">-infiles</span> <span style="color: #007800;">$ILO</span>-req.pem
openssl x509 <span style="color: #660033;">-in</span> <span style="color: #007800;">$ILO</span>.pem <span style="color: #660033;">-outform</span> PEM <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> Import_Cert_A.txt - Import_Cert_B.txt <span style="color: #000000; font-weight: bold;">&gt;</span> Import_<span style="color: #007800;">$ILO</span>.xml
&nbsp;
.<span style="color: #000000; font-weight: bold;">/</span>locfg.pl <span style="color: #660033;">-f</span> Import_<span style="color: #007800;">$ILO</span>.xml <span style="color: #007800;">$AUTH</span> <span style="color: #660033;">-s</span> <span style="color: #007800;">$ILO</span></pre></div></div>

<p><strong>Import_Cert_A.txt</strong></p>
<pre>&lt;RIBCL VERSION="2.0"&gt;
  &lt;LOGIN USER_LOGIN="" PASSWORD=""&gt;
  &lt;RIB_INFO MODE="write"&gt;
    &lt;IMPORT_CERTIFICATE&gt;</pre>
<p><strong>Import_Cert_B.txt</strong></p>
<pre>&lt;/IMPORT_CERTIFICATE&gt;
    &lt;RESET_RIB/&gt;
  &lt;/RIB_INFO&gt;
  &lt;/LOGIN&gt;
&lt;/RIBCL&gt;</pre>
<p><strong>Cert_Request.xml</strong></p>
<pre>&lt;RIBCL VERSION="2.0"&gt;
  &lt;LOGIN USER_LOGIN="" PASSWORD=""&gt;
  &lt;RIB_INFO MODE="write"&gt;
    &lt;CERTIFICATE_SIGNING_REQUEST/&gt;
  &lt;/RIB_INFO&gt;
  &lt;/LOGIN&gt;
&lt;/RIBCL&gt;</pre>
<p>After all of the files are saved, chmod +x the shell script and execute it passing the hostname of an iLO controller as the sole argument.  If everything works, repeat for each server or wrap it up in a loop and deploy certificates en masse.</p>
<h2>Manually Signing Requests</h2>
<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  class="size-full wp-image-3021 alignright" title="IIS right-click menu" src="http://www.vcritical.com/wp-content/uploads/2010/11/iis_cert_req_menu.png" alt="" width="238" height="130" />It&#8217;s easy enough to use your new CA to manually sign certificates from other web services such as Microsoft IIS or the HP Onboard Administrator (OA) controllers.</p>
<p>Simply generate a certificate request and save in a text file, e.g., myweb1-req.txt.  Then run the following openssl command to create a new certificate:</p>
<pre>openssl ca -policy policy_anything -days 3650 -out myweb1.pem -infiles myweb1-req.txt</pre>
<p>Use the contents of the resulting output file to complete the original request.</p>
<h2>Server Name Considerations</h2>
<p>Browsers are very particular about server names &#8212; if they do not match the certificate exactly, a warning will be thrown.  One key decision to make when using the script above is whether to use short hostnames or FQDNs &#8212; I prefer the former.</p>
<p>Another issue specific to HP BladeSystem is that when an iLO console is launched from the Onboard Administrator, the iLO IP address is used and not the hostname.  Fortunately, this overcome by adding the subjectAltName parameter to the certificate.</p>
<p>Note that there is an advanced option in Internet Explorer that may be useful to prevent warnings about certificate names not matching:</p>
<p><img style=' display: block; margin-right: auto; margin-left: auto;'  class="aligncenter size-full wp-image-2984" title="Changing IE configuration for certificate mismatch warnings" src="http://www.vcritical.com/wp-content/uploads/2010/11/ie_cert_mismatch_warning.png" alt="" width="423" height="541" /></p>
<h2>Concluding</h2>
<p>If you are tired of dismissing the warning messages that accompany self-signed certificates, it might be time to set up your own private CA.  By investing some time up front, it becomes simple to deploy new certificates when adding servers.</p>


<p>Related posts:<ol><li><a href='http://www.vcritical.com/2008/11/vi-client-ssl-thumbprint-cache-cleanup/' rel='bookmark' title='VI Client SSL thumbprint cache cleanup'>VI Client SSL thumbprint cache cleanup</a></li>
<li><a href='http://www.vcritical.com/2010/12/best-of-2010/' rel='bookmark' title='Best of 2010'>Best of 2010</a></li>
<li><a href='http://www.vcritical.com/2009/08/the-vmware-esxi-4-64mb-hypervisor-challenge/' rel='bookmark' title='The VMware ESXi 4 64MB Hypervisor Challenge'>The VMware ESXi 4 64MB Hypervisor Challenge</a></li>
<li><a href='http://www.vcritical.com/2010/03/cloudy-with-a-chance-of-vaporware/' rel='bookmark' title='Cloudy with a chance of vaporware'>Cloudy with a chance of vaporware</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2010/11/automating-ssl-certificate-deployments-for-hp-ilo/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/ilo/" rel="tag">ilo</a>, <a href="http://www.vcritical.com/tag/scripting/" rel="tag">scripting</a>, <a href="http://www.vcritical.com/tag/ssl/" rel="tag">SSL</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2010/11/automating-ssl-certificate-deployments-for-hp-ilo/">Automating SSL Certificate Deployments for HP iLO</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2010 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2010/11/automating-ssl-certificate-deployments-for-hp-ilo/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Win $2500 with your 1337 VMware ESXi scripting skillz</title>
		<link>http://www.vcritical.com/2010/02/win-2500-with-your-1337-vmware-esxi-scripting-skillz/</link>
		<comments>http://www.vcritical.com/2010/02/win-2500-with-your-1337-vmware-esxi-scripting-skillz/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 18:37:28 +0000</pubDate>
		<dc:creator>Eric Gray</dc:creator>
				<category><![CDATA[Virtualizationism]]></category>
		<category><![CDATA[ESXi]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://www.vcritical.com/?p=2278</guid>
		<description><![CDATA[Win up to $2500 in the VMware ESXi Scripting Contest!]]></description>
			<content:encoded><![CDATA[<p>VMware is currently running a VMware ESXi scripting contest.  Top prize is $2500, which is not too shabby for doing something <em>productive</em>.</p>
<p><a href="http://communities.vmware.com/community/vmtn/vsphere/automationtools/scriptomania" target="_blank">Check out the details</a> and get scripting!</p>


<p>Related posts:<ol><li><a href='http://www.vcritical.com/2010/01/vmware-esxi-4-sd-flash-in-bl460c-g6/' rel='bookmark' title='VMware ESXi 4: SD Flash in BL460c G6'>VMware ESXi 4: SD Flash in BL460c G6</a></li>
<li><a href='http://www.vcritical.com/2009/08/if-vmware-esxi-4-is-so-small-why-is-it-so-big/' rel='bookmark' title='If VMware ESXi 4 is so small, why is it so big?'>If VMware ESXi 4 is so small, why is it so big?</a></li>
<li><a href='http://www.vcritical.com/2009/02/new-vmware-esxi-management-kit/' rel='bookmark' title='New VMware ESXi Management Kit'>New VMware ESXi Management Kit</a></li>
<li><a href='http://www.vcritical.com/2009/07/win-a-macbook-air-or-ipod-touch/' rel='bookmark' title='Win a MacBook Air or iPod Touch'>Win a MacBook Air or iPod Touch</a></li>
</ol></p><div style="font-family:Verdana; color:#000000; background-color: #C0C0C0; padding: 7px;border: dashed thin">

<a href="http://www.vcritical.com/2010/02/win-2500-with-your-1337-vmware-esxi-scripting-skillz/#respond">Leave a Comment</a> •
<a href="http://feedproxy.google.com/vcritical">Subscribe to RSS</a> •
<a href="http://feedburner.google.com/fb/a/mailverify?uri=vcritical&loc=en_US">Subscribe via Email</a> •
<a href="http://www.twitter.com/eric_gray">Follow Eric Gray on Twitter</a><br/>

More articles on: <a href="http://www.vcritical.com/tag/esxi/" rel="tag">ESXi</a>, <a href="http://www.vcritical.com/tag/scripting/" rel="tag">scripting</a> • <a href="http://www.vcritical.com/category/virtualizationism/">Browse All Virtualization Content</a><br/>

<a href="http://www.vcritical.com/2010/02/win-2500-with-your-1337-vmware-esxi-scripting-skillz/">Win $2500 with your 1337 VMware ESXi scripting skillz</a> by <a href="http://www.vcritical.com/about/">Eric Gray</a> © 2010 • <a href="http://www.vcritical.com/">VCritical</a>

</div>]]></content:encoded>
			<wfw:commentRss>http://www.vcritical.com/2010/02/win-2500-with-your-1337-vmware-esxi-scripting-skillz/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

