<?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; Active Directory</title>
	<atom:link href="http://www.gavinadams.org/blog/tag/active-directory/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>Sat, 25 Jun 2011 14:22:21 +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>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&#8217;t mind so much, nor it appears does the ESX hosts, but when your VDIs suddenly can&#8217;t be reached, it&#8217;s a bad thing.</p> <p>By default, vCenter will create a self-signed certificate with just the host name. [...]]]></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&#8217;t mind so much, nor it appears does the ESX hosts, but when your VDIs suddenly can&#8217;t be reached, it&#8217;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&#8217;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&#8217;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&#8217;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&#8217;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&#8217;re working with rui.*, we&#8217;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&#8230;. 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&#8217;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>CentOS 5.2 &#8211; Apache &#8211; Kerberos / Active Directory Authentication</title>
		<link>http://www.gavinadams.org/blog/2009/03/25/centos-52-apache-kerberos-active-directory-authentication/</link>
		<comments>http://www.gavinadams.org/blog/2009/03/25/centos-52-apache-kerberos-active-directory-authentication/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 19:36:40 +0000</pubDate>
		<dc:creator>me@gavinadams.org</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[CentOS 5.2]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Centos]]></category>
		<category><![CDATA[Kerberos]]></category>
		<category><![CDATA[Microsoft Windows]]></category>

		<guid isPermaLink="false">http://www.gavinadams.org/blog/?p=35</guid>
		<description><![CDATA[<p>Linux and Windows Active Directory (AD) integration has come a long ways since 2000. It is now quite easy to take advantage of Kerberos for managing authentication at the host level (user logins and such). Surprisingly, it&#8217;s just as easy to the same in Apache now.</p> <p>This posting will walk you through the steps needed [...]]]></description>
			<content:encoded><![CDATA[<p>Linux and Windows Active Directory (AD) integration has come a long ways since 2000. It is now quite easy to take advantage of Kerberos for managing authentication at the host level (user logins and such). Surprisingly, it&#8217;s just as easy to the same in Apache now.</p>
<p>This posting will walk you through the steps needed to configure and test authentication against a valid AD user.</p>
<h3>Prerequisites</h3>
<p>It is assumed the following prerequisites are in place:</p>
<ul>
<li>CentOS 5.2 Server &#8211; fully updated</li>
<li>Apache, Kerberos, and supporting packages installed</li>
<li>Samba configured as member server (net ads join has been successfully performed)</li>
<li>Windows Server 2003 R2 or 2008 SP1 with UNIX Identity Management extensions installed</li>
<li>Kerberos working (kinit from a AD user properly authenticates and klist shows tickets)</li>
</ul>
<p><span id="more-35"></span>If possible, test this from a freshly installed machine. In this example, the following servers and realms will be referenced:</p>
<pre style="padding-left: 30px;">AD Server       dc01.example.com
Linux Server    www.example.com
Computer Object www
Kerberos Realm  EXAMPLE.COM</pre>
<h3>Creating the SPN</h3>
<p>Kerberos uses a <em>service principal name </em>for each service available on the host. For a server that can authenticate against AD, this would include at least the HOST principal. From the AD server, issue the setspn command to view the current SPN&#8217;s assigned to www.example.com (use the canonical name for www, not the FQDN):</p>
<pre style="padding-left: 30px;">C:\&gt;<strong>setspn -L www</strong>
Registered ServicePrincipalNames for CN=www,CN=Computers,DC=example,DC=com:
        HOST/www
        HOST/www.example.com</pre>
<p>Now as root on www issue the command to create the HTTP SPN (the net ads command is provided by the samba packages&#8211;make sure these are installed even if they are not used):</p>
<pre style="padding-left: 30px;">[root@www /]#<strong> net ads keytab add HTTP -U administrator</strong>
Processing principals to add...
administrator's password: <strong>*******</strong></pre>
<p>The -U is used to provide an administrator account with Domain Admin privileges. This step has added the SPN which we&#8217;ll see in AD, and it has also updated the local keytab file /etc/krb5.keytab with the SPN bits.</p>
<p>To verify the SPN has been created properly, issue the same setspn command and verify there are entries for HTTP. It should look something like this:</p>
<pre style="padding-left: 30px;">C:\&gt;<strong>setspn -L www</strong>
Registered ServicePrincipalNames for CN=www,CN=Computers,DC=example,DC=com:
        HTTP/www
        HTTP/www.example.com
        HOST/www
        HOST/www.example.com</pre>
<h3>Configure Apache</h3>
<p>Make sure the package mod_auth_kerb is installed. This should create the configuration file in /etc/httpd/conf.d/auth_kerb.conf which will load the Kerberos module and provide a commented out example (which we&#8217;ll use). First, because httpd runs as apache, we need to copy the keytab file and change permissions so that apache can read it. I&#8217;ve placed it in the default specified in the auth_kerb.conf file:</p>
<pre style="padding-left: 30px;">[root@www /]#<strong> cp /etc/krb5.keytab /etc/httpd/conf/keytab2</strong>
[root@www /]# <strong>ls -l /etc/httpd/conf</strong>
total 64
-rw-r--r-- 1 root   root   33760 Mar 25 14:01 httpd.conf
---------- 1 root   root    1321 Mar 25 15:06 keytab
-rw-r--r-- 1 root   root   12958 Nov 12 10:43 magic
[root@www /]# <strong>chown apache.apache /etc/httpd/conf/keytab2</strong>
[root@www /]# <strong>chmod 400 /etc/httpd/conf/keytab2</strong>
[root@www /]# <strong>ls -l /etc/httpd/conf</strong>
total 64
-rw-r--r-- 1 root   root   33760 Mar 25 14:01 httpd.conf
-r-------- 1 apache apache  1321 Mar 25 15:06 keytab
-rw-r--r-- 1 root   root   12958 Nov 12 10:43 magic</pre>
<h3>Create an Apache Location for Testing</h3>
<p>Now modify the &#8220;private&#8221; location and uncomment the directives and set them for the realm (changes from defaults in bold):</p>
<pre style="padding-left: 30px;">[root@www /]# vi /etc/http/conf.d/auth_kerb.conf# The mod_auth_kerb module implements Kerberos authentication over
# HTTP, following the "Negotiate" protocol.
#
LoadModule auth_kerb_module modules/mod_auth_kerb.so
#
# Sample configuration: Kerberos authentication must only be
# used over SSL to prevent replay attacks.  The keytab file
# configured must be readable only by the "apache" user, and
# must contain service keys for "HTTP/www.example.com", where
# "www.example.com" is the FQDN of this server.
#

#&lt;Location /private&gt;
#  SSLRequireSSL
 AuthType Kerberos
 AuthName "Kerberos Login"
 KrbMethodNegotiate On
 KrbMethodK5Passwd <strong>On</strong>
 KrbAuthRealms <strong>EXAMPLE.COM</strong>
 Krb5KeyTab /etc/httpd/conf/keytab
 require valid-user
&lt;/Location&gt;</pre>
<p>Create the directory (/var/www/html/private) and a test HTML file in the directory (index.html). Restart httpd and navigate to the URL (http://www.example.com/private/index.html). You should be prompted for credentials. Using a valid AD user and password should get you in. A side benefit is that if logged into a workstation within the domain (e.g., Windows XP, Vista, etc), using Internet Explorer should use your Kerberos credentials to authenticate.</p>
<h3>Uses</h3>
<p>For production use, any application or web service that can use Apache&#8217;s authentication mechanisms should work. Take care to understand that even if you enter a short username, the realm will be appended onto the end. In this example, the username gadams would appear as gadams@EXAMPLE.COM in the log files, and probably be presented to the referenced application.</p>
<h3>Credit</h3>
<p>I&#8217;d like to <a href="http://blog.scottlowe.org/" target="_blank">Scott Lowe </a>for all the articles he has done on Linux / AD / Kerberos integration, and<a href="http://blog.scottlowe.org/2006/08/10/kerberos-based-sso-with-apache/" target="_blank"> this article</a>, which was where I started my CentOS / Apache / Kerberos / AD journey. His article covers all the basics, but a lot has changed (for the better) since 2006. Thanks Scott!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinadams.org/blog/2009/03/25/centos-52-apache-kerberos-active-directory-authentication/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

