<?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>Gavin Adams Information Blog &#187; PKI / Certificates</title>
	<atom:link href="http://www.gavinadams.org/blog/category/tech-tips/pki-certificates/feed" rel="self" type="application/rss+xml" />
	<link>http://www.gavinadams.org/blog</link>
	<description>Musings on hobbies, technology and topics of interest</description>
	<lastBuildDate>Fri, 23 Jul 2010 19:41:10 +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>Replacing vCenter 4.1 SSL Certificate with Active Directory Issued One</title>
		<link>http://www.gavinadams.org/blog/2010/07/14/replacing-vcenter-4-1-ssl-certificate-with-active-directory-issued-one</link>
		<comments>http://www.gavinadams.org/blog/2010/07/14/replacing-vcenter-4-1-ssl-certificate-with-active-directory-issued-one#comments</comments>
		<pubDate>Wed, 14 Jul 2010 18:02:36 +0000</pubDate>
		<dc:creator>me@gavinadams.org</dc:creator>
				<category><![CDATA[PKI / Certificates]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[vCenter]]></category>
		<category><![CDATA[vSphere]]></category>

		<guid isPermaLink="false">http://www.gavinadams.org/blog/?p=170</guid>
		<description><![CDATA[<p>This is an update post to reflect the differences in vCenter 4.1 vs the older vCenter 25 install. The older post can be found here.</p> <p>Certain third party products such as XenDesktop respect the expiration date on the vCenter SSL certificate. The vSphere Client doesn’t mind so much, nor it appears do the vSphere [...]]]></description>
			<content:encoded><![CDATA[<p>This is an update post to reflect the differences in vCenter 4.1 vs the older vCenter 25 install. The older post can be found <a href="http://www.gavinadams.org/blog/2010/04/16/replacing-vicenter-2-5-self-signed-certificate-with-active-directory-issued-one">here</a>.</p>
<p>Certain third party products such as XenDesktop respect the expiration date on the vCenter SSL certificate. The vSphere Client doesn’t mind so much, nor it appears do the vSphere (ESX/ESXi &#8212; err vSphere Hypervisor) hosts, but when your VDIs suddenly can’t be reached, it’s a bad thing. I&#8217;m sure other products may have the same issue.</p>
<p>By default, vCenter will create a self-signed certificate issued to &#8220;<em>VMware default certificate</em>&#8220;. Unlike previous vCenter installs, the certificate is valid for 10 years, but still can cause problems for third parties that want to see the proper common name (e.g., FQDN of the vCenter server).</p>
<p><a href="http://www.gavinadams.org/blog/wp-content/uploads/2010/07/vmware-def-cert.png"><img class="alignnone size-full wp-image-177" title="VMware Default Certificate" src="http://www.gavinadams.org/blog/wp-content/uploads/2010/07/vmware-def-cert.png" alt="" width="402" height="506" /></a></p>
<p>In our case, since we’re not publishing any SSL services to the public and already have a Microsoft Certificate Authority, we can create and sign our own vCenter certificate. And just like the newer version of vCenter, we’ll set it up for 10 years too.</p>
<p>This can be completed in just under 15 minutes if all the prerequisites are in place. Took me an hour (including this documentation).</p>
<p><span id="more-170"></span></p>
<h2>Environment Summary</h2>
<p>For this process to work, the following assumptions are made:</p>
<ul>
<li>Active Directory installed and Certificate Authority installed (in my case, it’s on a Windows 2008 Domain Controller with Certificate Authority and Certificate Authority Web Enrollment )</li>
<li>DNS used for vCenter and internal FQDN name</li>
<li>vCenter server part of the domain, Domain Admin access to it</li>
<li>vCenter installed with local database (SQL Server 2005 Express) and using SYSTEM account &#8211; People commented on my <a href="http://www.gavinadams.org/blog/2010/04/16/replacing-vicenter-2-5-self-signed-certificate-with-active-directory-issued-one">previous related post</a> about other steps required for database connectivity</li>
<li>Using the included web services that comes with vCenter (IIS users on your own for this one)</li>
</ul>
<p>To test, we’ll use a browser from a workstation and the XenDesktop DDC to validate connection (make sure the root CA certificate is added to the Trusted Roots for the Computer Account on each test and production server)</p>
<h2>Prep vCenter</h2>
<p>Since vCenter 4.1 now requires a 64-Bit Operating System (Server 2008 R2 Standard in my case), we&#8217;ll download the OpenSSL for Windows 64-Bit version.</p>
<p>Download <a href="http://www.slproweb.com/products/Win32OpenSSL.html">OpenSSL for Windows</a> (binary for the 64-bit version  v1.0.0a is <a href="http://www.slproweb.com/download/Win64OpenSSL-1_0_0a.exe">here</a>) You may have to install the Visual C++ 2008 redistributable package first.</p>
<p>Verify the private key exists in: <strong>C:\Users\All Users\VMware\VMware VirtualCenter\SSL\rui.key</strong> (you will need to change permissions to allow your user account to access this directory and files)</p>
<p>Copy  all the files in<strong> C:\Users\All Users\VMware\VMware VirtualCenter\SSL</strong> to a temporary location such as  <strong>c:\temp\vcenter\oldssl</strong> (create if needed)</p>
<p>Open a command shell and go to <strong>c:\temp\vcenter\newssl</strong> (create if needed)</p>
<p>Generate the new RSA private key (2048 bit) and the certificate request (most important is that the common name must be the FQDN of the server). For the CSR, I normally use the common name value.csr, but since we’re working with rui.*, we’ll use that here too:</p>
<pre>C:\temp\vcenter\newssl&gt;c:\OpenSSL-Win64\bin\openssl.exe req -newkey rsa:2048 -keyout rui.key -nodes -days 3650 -out rui.csr
Loading 'screen' into random state - done
Generating a 2048 bit RSA private key
.............................+++
......................................+++
writing new private key to 'rui.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:<strong>US</strong>
State or Province Name (full name) [Some-State]:<strong>Georgia</strong>
Locality Name (eg, city) []:<strong>Cumming</strong>
Organization Name (eg, company) [Internet Widgits Pty Ltd]:<strong>Gavin Adams</strong>
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:<strong>vcenter.peanuts.local</strong>
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

C:\temp\vcenter\newssl&gt;<strong>dir</strong>
Volume in drive C has no label.
Volume Serial Number is 204A-99B1
Directory of C:\temp\vcenter\newssl
04/16/2010  03:50 PM    &lt;DIR&gt;          .
04/16/2010  03:50 PM    &lt;DIR&gt;          ..
04/16/2010  03:50 PM             1,024 .rnd
04/16/2010  03:49 PM             1,675 privkey.pem
04/16/2010  03:50 PM             1,679 rui.key
04/16/2010  03:50 PM             1,005 rui.csr
</pre>
<p>From the vCenter system, browse to the certsrv URL for your Active Directory Certificate Authority (normally https://dcname/certsrv and probably will require a valid Active Directory user):</p>
<p><a href="http://www.gavinadams.org/blog/wp-content/uploads/2010/04/vcu-1.png"><img class="size-full wp-image-153 alignnone" title="vcu-1" src="http://www.gavinadams.org/blog/wp-content/uploads/2010/04/vcu-1.png" alt="" width="474" height="295" /></a></p>
<p>Select Request a certificate, advanced certificate request, and then <em>Submit a certificate using base-64….</em> Past the entire contents of the <strong>rui.csr </strong>(open in Notepad, select all &#8212; it will be all on one line, but a CTRL-A CTRL-C will do fine) in the Saved Request box, select <em>Web Server </em>for Certificate template:</p>
<p><a href="http://www.gavinadams.org/blog/wp-content/uploads/2010/04/vcu-2.png"><img class="alignnone size-full wp-image-154" title="vcu-2" src="http://www.gavinadams.org/blog/wp-content/uploads/2010/04/vcu-2.png" alt="" width="487" height="515" /></a></p>
<p>At this point the certificate will be signed. On the next page select <em>Base 64 encoded</em> then  <em>Download certificate</em> and save as <strong>rui.crt</strong> in <strong>c:\temp\vcenter\newssl</strong></p>
<p>From the private key and certificate, create the PFX fie:</p>
<pre>C:\temp\vcenter\newssl&gt;c:\OpenSSL-Win64\bin\openssl pkcs12 -export -in rui.crt -inkey rui.key -name rui -passout pass:testpassword -out rui.pfx</pre>
<p>Stop the following services:</p>
<blockquote><p>VMware VirtualCenter Management Webservices<br />
VMware VirtualCenter Server</p></blockquote>
<p>Copy  all the files in the newssl directory to :<strong> </strong><strong>C:\Users\All Users\VMware\VMware VirtualCenter\SSL</strong><strong>\</strong> replacing the existing ones. Don’t worry, we backed these up.</p>
<p>Now restart the services in this order (unsure if it matters):</p>
<blockquote><p>VMware VirtualCenter Server<br />
VMware VirtualCenter Management Webservices</p></blockquote>
<p>Use browser and navigate to the URL of the vCenter (e.g.,  <em>https://vcenter.peanuts.local</em>) and verify the certificate is valid. Open the vSphere client and verify all looks okay. After restarting the services, you will need  to reconnect to the ESX / ESXi hosts and re-authenticate with root credentials on each server. This is because the SSL trust between the two has changed and a new trust relationship needs to be established. Another reason for a longer term certificate!</p>
<h2>Problems and Resolution</h2>
<p>I&#8217;ll update the post with corrections, but with different configurations, we may run into different issues.</p>
<table border="0">
<caption><strong>Observed Problems and Resolutions</strong></caption>
<tbody>
<tr>
<td style="text-align: center;">Problem</td>
<td style="text-align: center;">Resolution</td>
</tr>
<tr>
<td>Web Service won&#8217;t restart with error<br />
One thing after this the webservice won’t start.<br />
in the log I found following error:<br />
vmware RSA_padding_check_PKCS1_type_2:block type is not 02</td>
<td>See VMware KB article: <a rel="nofollow" href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1003070">http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1003070</a></p>
<p>May require account password for database (assuming db other than SQL Server express)</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinadams.org/blog/2010/07/14/replacing-vcenter-4-1-ssl-certificate-with-active-directory-issued-one/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Replacing vCenter 2.5 Self-Signed Certificate with Active Directory Issued One</title>
		<link>http://www.gavinadams.org/blog/2010/04/16/replacing-vicenter-2-5-self-signed-certificate-with-active-directory-issued-one</link>
		<comments>http://www.gavinadams.org/blog/2010/04/16/replacing-vicenter-2-5-self-signed-certificate-with-active-directory-issued-one#comments</comments>
		<pubDate>Fri, 16 Apr 2010 21:27:48 +0000</pubDate>
		<dc:creator>me@gavinadams.org</dc:creator>
				<category><![CDATA[PKI / Certificates]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[vCenter]]></category>

		<guid isPermaLink="false">http://www.gavinadams.org/blog/?p=145</guid>
		<description><![CDATA[<p>Certain third party products such as XenDesktop respect the expiration date on the vCenter SSL certificate. The vSphere Client doesn’t mind so much, nor it appears does the ESX hosts, but when your VDIs suddenly can’t be reached, it’s a bad thing.</p> <p>By default, vCenter will create a self-signed certificate with just the host [...]]]></description>
			<content:encoded><![CDATA[<p>Certain third party products such as XenDesktop respect the expiration date on the vCenter SSL certificate. The vSphere Client doesn’t mind so much, nor it appears does the ESX hosts, but when your VDIs suddenly can’t be reached, it’s a bad thing.</p>
<p>By default, vCenter will create a self-signed certificate with just the host name. In our case, since we’re not publishing any SSL services to the public and already have a Microsoft Certificate Authority, we can create and sign our own vCenter certificate. And just like the newer version of vCenter, we’ll set it up for 10 years too.</p>
<p>This can be completed in just under 15 minutes if all the prerequisites are in place. Took me an hour (including this documentation).</p>
<p><span id="more-145"></span></p>
<h3>Environment Summary</h3>
<p>For this process to work, the following assumptions are made:</p>
<ul>
<li>Active Directory installed and Certificate Authority installed (in my case, it’s on a Windows 2008 Domain Controller with Certificate Authority and Certificate Authority Web Enrollment )</li>
<li>DNS used for vCenter and internal FQDN name</li>
<li>vCenter server part of the domain, Domain Admin access to it</li>
<li>Using the included web services that comes with vCenter (IIS users on your own for this one)</li>
</ul>
<p>To test, we’ll use a browser from a workstation and the XenDesktop DDC to validate connection (make sure the root CA certificate is added to the Trusted Roots for the Computer Account on each test and production server)</p>
<h3>Prep vCenter</h3>
<p>Download OpenSSL for Windows (binaries can be found at: <a href="http://www.slproweb.com/products/Win32OpenSSL.html">http://www.slproweb.com/products/Win32OpenSSL.html</a>) . You may have to install the 2008 redistributable package first.</p>
<p>Open a command shell and go to <strong>c:\temp\vcenter\newssl</strong> (create if needed)</p>
<p>Verify the private key exists in: <strong>C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\SSL\rui.key</strong></p>
<p>Copy all the files in<strong> C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\SSL</strong> to a temporary location such as <strong>c:\temp\vcenter\oldssl</strong> (create if needed)</p>
<p>Generate the new RSA private key (2048 bit) and the certificate request (most important is that the common name must be the FQDN of the server). For the CSR, I normally use the common name value.csr, but since we’re working with rui.*, we’ll use that here too:</p>
<pre>C:\temp\vcenter\newssl&gt;c:\OpenSSL\bin\openssl.exe req -newkey rsa:2048 -keyout rui.key -nodes –days 3650 -out rui.csr
Loading 'screen' into random state - done
Generating a 2048 bit RSA private key
.............................+++
......................................+++
writing new private key to 'rui.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:<strong>US</strong>
State or Province Name (full name) [Some-State]:<strong>Georgia</strong>
Locality Name (eg, city) []:Cumming
Organization Name (eg, company) [Internet Widgits Pty Ltd]:<strong>Gavin Adams</strong>
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:<strong>vcenter.peanuts.local</strong>
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

C:\temp\vcenter\newssl&gt;<strong>dir</strong>
Volume in drive C has no label.
Volume Serial Number is 204A-99B1
Directory of C:\temp\vcenter\newssl
04/16/2010  03:50 PM    &lt;DIR&gt;          .
04/16/2010  03:50 PM    &lt;DIR&gt;          ..
04/16/2010  03:50 PM             1,024 .rnd
04/16/2010  03:49 PM             1,675 privkey.pem
04/16/2010  03:50 PM             1,679 rui.key
04/16/2010  03:50 PM             1,005 rui.csr
</pre>
<p>From the vCenter system, browse to the certsrv URL for your Active Directory Certificate Authority:</p>
<p><a href="http://www.gavinadams.org/blog/wp-content/uploads/2010/04/vcu-1.png"><img class="size-full wp-image-153 alignnone" title="vcu-1" src="http://www.gavinadams.org/blog/wp-content/uploads/2010/04/vcu-1.png" alt="" width="474" height="295" /></a></p>
<p>Select Request a certificate, advanced certificate request, and then Submit a certificate using base-64…. Past the entire contents of the CSR (open in Notepad) in the Saved Request box, select Web Server for Certificate template:</p>
<p><a href="http://www.gavinadams.org/blog/wp-content/uploads/2010/04/vcu-2.png"><img class="alignnone size-full wp-image-154" title="vcu-2" src="http://www.gavinadams.org/blog/wp-content/uploads/2010/04/vcu-2.png" alt="" width="487" height="515" /></a></p>
<p>At this point the certificate will be signed. On the next page select <em>Base 64 encoded</em> then  <em>Download certificate</em> and save as <strong>rui.crt</strong> in <strong>c:\temp\vcenter\newssl</strong></p>
<p>From the private key and certificate, create the PFX fie:</p>
<pre>C:\temp\vcenter\newssl&gt;c:\openssl\bin\openssl pkcs12 -export -in rui.crt -inkey rui.key -name rui -passout pass:testpassword -out rui.pfx</pre>
<p>Stop the following services:</p>
<blockquote><p>VMware VirtualCenter Management Webservices<br />
VMware VirtualCenter Server</p></blockquote>
<p>Copy  all the files in the newssl directory to :<strong> C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\SSL\</strong> replacing the existing ones. Don’t worry, we backed these up.</p>
<p>Now restart the services in this order (unsure if it matters):</p>
<blockquote><p>VMware VirtualCenter Server<br />
VMware VirtualCenter Management Webservices</p></blockquote>
<p>Use browser and navigate to the URL of the vCenter (e.g.,  <em>https://vcenter.peanuts.local</em>) and verify the certificate is valid. Open the vSphere client and verify all looks okay. After restarting the services, you will need  to reconnect to the ESX / ESXi hosts and re-authenticate with root credentials on each server. This is because the SSL trust between the two has changed and a new trust relationship needs to be established. Another reason for a longer term certificate!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinadams.org/blog/2010/04/16/replacing-vicenter-2-5-self-signed-certificate-with-active-directory-issued-one/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Snow Leopard Certificate Sillyness</title>
		<link>http://www.gavinadams.org/blog/2010/01/05/snow-leopard-certificate-sillyness</link>
		<comments>http://www.gavinadams.org/blog/2010/01/05/snow-leopard-certificate-sillyness#comments</comments>
		<pubDate>Tue, 05 Jan 2010 22:10:46 +0000</pubDate>
		<dc:creator>me@gavinadams.org</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[PKI / Certificates]]></category>
		<category><![CDATA[pkcs12]]></category>
		<category><![CDATA[startssl.com]]></category>

		<guid isPermaLink="false">http://www.gavinadams.org/blog/?p=132</guid>
		<description><![CDATA[<p>I love OS X and every iteration has gotten better and better. But every once in a while tasks that should be simple&#8211;aren&#8217;t. Take the case of trying to add a S/MIME certificate to the Keychain.</p> <p>In the past, simply double-clicking on the .p12 file would prompt for the passphrase and import it into [...]]]></description>
			<content:encoded><![CDATA[<p>I love OS X and every iteration has gotten better and better. But every once in a while tasks that should be simple&#8211;aren&#8217;t. Take the case of trying to add a S/MIME certificate to the Keychain.</p>
<p>In the past, simply double-clicking on the .p12 file would prompt for the passphrase and import it into the login chain. After getting my certificate issued by StartSSL and stored in Firefox, I exported the certificate and private key, set a passphrase, double-clicked, and&#8230;.</p>
<p><a href="http://www.gavinadams.org/blog/wp-content/uploads/2010/01/hate-the-keychain.png"><img class="aligncenter size-full wp-image-133" title="hate-the-keychain" src="http://www.gavinadams.org/blog/wp-content/uploads/2010/01/hate-the-keychain.png" alt="" width="750" height="385" /></a></p>
<p><strong>An error has occurred. Unable to import an item. The contents of this item cannot be retrieved. You failed to provide the necessary administrator authorization.</strong> <em>(Added so the search engines will pick this up)</em></p>
<p><span id="more-132"></span>And so the battle commenced. There really isn&#8217;t a lot out there discussing when Keychain Access fails. The closest similar discussion was by Midori Green (email thread <a href="http://www.mail-archive.com/openssl-users@openssl.org/msg59442.html">here</a>). The error was different, but it was the same attempt to import a PKCS12 file.</p>
<p>I tried using openssl to rearrange the certificates in the file (after exporting into PEM format), tried adding/removing/changing the private key passphrase, import/export from a Windows machine in .PFX format, and even trying to recreate the PKCS12 file from its&#8217; constituent parts.</p>
<p>Luckily, I ran across this post on <a href="http://krypted.com/mac-os-x/basic-pkcs12-management-with-security/">krypted.com</a> that mentioned the CLI command <em>security</em>. After placing the exported .p12 file (from Firefox) in a directory and launching terminal, I was able to use the command:</p>
<pre>linus:gadams$ <strong>security import startssl-smime-cert.p12 -f pkcs12 ~/Library/Keychains/login.keychain</strong>
1 identity imported.
2 certificates imported.
</pre>
<p>And <em>bam!</em>, the certificate loaded. Composing a new message in Mail.app showed the signing and encryption boxes. Although I still get invalid signatures when sending rich text format messages, plain text are properly getting signed.</p>
<p>I am curious exactly what command is executed when you double-click on a certificate file. I assume the <em>Keychain access </em>application makes underly calls to <em>security</em>, but I&#8217;d like to be able to trace the steps it takes.</p>
<p>Side note, I&#8217;m going to do an opinion piece of certificate authorities in general and digital certificates, SSL, S/MIME, and all that rot. There are some great options for small companies and individuals to get certificates at a cheap or free price. No Verisign or GTE Cybertrust (err Verizon Business) $$$$$ prices need apply!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinadams.org/blog/2010/01/05/snow-leopard-certificate-sillyness/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
