Pages

Tuesday, February 7, 2012

Why is my newly deployed Windows Server 2008 R2 Enterprise Root CA (Certificate Authority) unable to issue certificates with SAN (Subject Alternative Name) entries?

Problem

You have just recently deployed a new Windows Server 2008 R2 Enterprise Root CA in your Active Directory and would like to issue certificates with SAN (Subject Alternative Name) entries.  As per the following KB:

How to add a Subject Alternative Name to a secure LDAP certificate
http://support.microsoft.com/kb/931351

… you added the line:

san:dns=citrix-vdi&dns=WEBINTERFACE01.contoso.com&dns=WEBINTERFACE01&dns=WEBINTERFACE02.contoso.com&dns=WEBINTERFACE02

… in the Attributes box but you notice that when you review the certificate’s details tab, you don’t see these entries added in.

Solution

The solution to this problem is to actually configure the CA to accept the SAN attribute.  The first section of the KB article I included above mentions this in the section labeled:

----------------------------------------------------------------------------------------------------------------------------------------------------------------

How to configure a CA to accept a SAN attribute from a certificate request
By default, a CA that is configured on a Windows Server 2003-based computer does not issue certificates that contain the SAN extension. If SAN entries are included in the certificate request, these entries are omitted from the issued certificate. To change this behavior, run the following commands at a command prompt on the server that runs the Certification Authority service. Press ENTER after each command.

certutil -setreg policy\EditFlags +EDITF_ATTRIBUTESUBJECTALTNAME2
net stop certsvc
net start certsvc

----------------------------------------------------------------------------------------------------------------------------------------------------------------

I’m sure some people will probably ask: “Why do you even blogging about this?”  My answer to that question is that the KB article I included doesn’t specify which version of Windows this is for and the only reference to a version of Windows Server is Windows Server 2003 under the Related Support Centers heading.

So to enable your new CA to accept SAN attributes, simply execute the following command:

certutil -setreg policy\EditFlags +EDITF_ATTRIBUTESUBJECTALTNAME2
net stop certsvc
net start certsvc

image

Once the command executes successfully and the CA services has been restarted, proceed with reissuing a certificate with the additional attributes and you should now get the SAN attribute in the details tab:

image

A new Windows Server 2008 R2 Enterprise Root Certificate Authority throws the error: “No certificate templates could be found. You do not have permission to request a certificate from this CA, or an error occurred while accessing the Active Directory.” when you try to request a certificate through the web enrollment webpage

Problem

Your Active Directory environment has an empty root domain and a child domain that contains your computer and user objects.  You decide to deploy an Enterprise Root CA in the child domain and use it as a Certificate Authority.  The deployment of the CA completes and while logged on as a domain administrator of the child domain, you open the http://yourCA/certsrv web enrollment page to try to request a certificate but receive the following error:

Certificate Template: (No templates found!)

No certificate templates could be found. You do not have permission to request a certificate from this CA, or an error occurred while accessing the Active Directory.

image

You open up Active Directory Sites and Services to check on Services –> Public Key Services –> Certificate Templates and you see the templates:

image

Solution

The reason why you’re receiving this error is because although you’ve installed the Enterprise Root CA in your child domain, by default, the permissions required to see the templates is to have at least Domain Administrator privileges in the parent root domain.  It’s a bit hard to see in the screenshot below since I had to blank out the domain name but what we’re supposed to see in there is the domain and enterprise administrators for the root domain listed:

image

The screenshot below is the permissions that the domain administrator of the root domain has inherited:

image

What we need to do is add the domain administrators group to the security permissions and mirror the permissions that the domain administrators group in the root domain has:

image

What’s also important is to change the Apply to drop down menu from:

This object only

… to …

This object and all descendant objects

image

Click OK when the permissions have been set:

image

Now that you have given the domain administrators group permissions to the templates, the error message should no longer be presented when you attempt to request a certificate from the web enrollment webpage:

image

Monday, February 6, 2012

Notes on Citrix XenApp 6.5 PowerShell cmdlets

Having worked with Microsoft Exchange 2000, 2003, 2007 and finally 2010, I’ve come to appreciate what Microsoft has done and how mature Exchange 2010 PowerShell cmdlets are today.  There really isn’t a whole lot you can’t do with the cmdlets and while most administrators including myself probably only use 5% (if even) what it’s capable of, I know if I needed to automate a task that the GUI doesn’t allow you to, PowerShell will be able to do so.  Now moving onwards to Citrix, it’s great that they have adopted PowerShell but I find that it still needs a few iterations before it’s as powerful as what PowerShell does for Exchange.  Anyways, I digress.  The following are just some of my Citrix PowerShell notes that I’ll continue to build towards as I develop my toolkit for Citrix XenApp.

List XenApp Applications

List all applications:
Get-XAApplication

List all applications and pipe to file:
Get-XAApplication > C:\XenAppApplications.txt

List a specific application based on BrowserName variable:
Get-XAApplication -BrowserName "Microsoft Word 2010"

List applications based on BrowserName with a wild card:
Get-XAApplication -BrowserName Microsoft*

List applications with a variable equal to a value you specify:
Get-XAApplication -BrowserName Microsoft* | where-object {$_.Enabled -match "False"} | Format-Table DisplayName

**Note that Enabled is the checkbox here:

image

Alternatively, you can use another variable such as HideWhenDisabled:

image

… and if you want to use other variables, you can review the attributes available via the

Get-XAApplication

… which outputs information similar to the following:

image

List applications that start with “Microsoft” and its specific attributes:
Get-XAApplication -BrowserName Microsoft* | Format-Table DisplayName, CommandLineExecutable

List the “DisplayName” attribute’s value of applications in a folder named “Office 2010 SP1”:
Get-XAApplication -FolderPath Applications\"Office 2010 SP1" | Format-table DisplayName

Modify XenApp Applications

Set all of the applications in a folder named “Office 2010 SP1” to be published on a (one) server:
Get-XAApplication -FolderPath Applications\"Office 2010 SP1" | Set-XAApplication -ServerNames <serverName>

**Note that the above command will overwrite the servers that the application is published in with the server you specify.  Please replace <serverName> with the name of the server you want to use to publish the applications.

Set all of the applications in a folder named “Office 2010 SP1” to be published on multiple servers:
Get-XAApplication -FolderPath Applications\"Office 2010 SP1" | Set-XAApplication -ServerNames <serverName1>, <serverName2>

Set the “Client Application Folder” properties field for all of the applications in a folder named “Clinical Apps” under the folder “Published” to “Clinical Apps”:
Get-XAApplication -FolderPath Applications\Published\"Clinical Apps" | Set-XAApplication -ClientFolder "Clinical Apps"

Set access rights for Group1 and Group2 to all of the applications in a folder named “Web Browsers” that’s located in another folder named “Published”:
Get-XAApplication -folderpath applications\Published\"Web Browsers" | Set-XAApplication -Account
domain\group1,domain\group2

**Note that the above command will overwrite the permissions currently set for the applications.

I’ll append to this post another day with more modifying cmdlets.

Friday, February 3, 2012

Problem logging into Outlook Web Access (OWA) 2003 with Citrix XenApp 6.5

Problem

You’ve successfully published Outlook Web Access (OWA) via Exchange 2003 with Citrix XenApp 6.5 and through launching it via a desktop, able to hit the landing page:

image

However, you notice after you’ve typed in your credentials and hit the Log On button, you are sent back to the landing page:

image

image

You notice that if you tested this with an account that was a part of the administrators group, the logon works fine.

Solution

I’m not sure how many other reasons there are that may cause this problem but for my situation, it was because the published OWA URL was an external URL that Internet Explorer classified as an Internet site.  What I ended up doing was configure the IE policy to include the external URL address in the local intranet site:

image

Note that the above screenshot shows this policy was configured via the Local Computer policy but you can also apply this via an Active Directory GPO.  I configured a local computer policy because I did not have AD access to the environment I was working in.

Once I got the site to show up and labeled as Local intranet, I was then able to log in as a regular non administrator account.

image

Thursday, February 2, 2012

Issuing a certificate for the “certsrv” directory for a newly deployed Root CA (Certificate Authority) in Active Directory

I was asked recently by an ex-colleague about how I would go about in issuing a certificate for a new and only Certificate Authority in Active Directory.  I’ve always found this situation amusing whenever I come across it because, and I can’t recall if this is true but I don’t remember Windows 2003 certificate authorities forcing you to have HTTPS (SSL) in order to use the Create and submit a request to this CA option through the http://yourCA/certsrv web enrollment webpage.  In Windows 2008, you are forced to secure the web enrollment page for the Create and submit a request to this CA or you won’t be able to request a certificate.  This appears to throw a lot of people off when they’ve just deployed their new certificate authority and would like to use that feature to, say, generate a SAN (Subject Alternative Name) certificate which may require that feature.

So how do would you go about generate a certificate without having access to the Create and submit a request to this CA feature?  Simply use the Submit a certificate request by using a base-64-encoded CMC or PKCS #10 file or submit a renewal request by using a base-64-encoded PKCS #7 file:

image

The following shows the problem and solution.

Problem

You’ve just deployed a new Certificate Authority in your Active Directory and need to create a new web server certificate with SAN entries for a IIS server so you proceed by navigating to http://yourCA/certsrv webpage to generate a request.  You proceed with clicking on Request a certificate:

image

Then advanced certificate request:

image

Then Create and submit a request to this CA:

image

… but then you are prompted with the message:

In order to complete certificate enrollment, the Web site for the CA must be configure to use HTTPS authentication.

image

This shouldn’t surprise anyone as you wouldn’t want your certificate’s information being passed via HTTP.  You then realize that what you’ll need to do is generate a certificate for your root CA’s web enrollment site but may then get confused as to how you can generate a certificate for this website if you don’t have one to secure it. 

Note that some may think that they can use the Root certificate that’s already placed in the local computer store:

image

… but the problem with using this certificate is that it’s not the right certificate template:

image

IIS actually allows you to assign this but it won’t work.

Solution

The solution is actually quite simple, don’t use the Create and submit a request to this CA feature but rather use the Submit a certificate request by using a base-64-encoded CMC or PKCS #10 file or submit a renewal request by using a base-64-encoded PKCS #7 file:

Open up Internet Information Services (IIS) Manager and select the web server:

image

Double click on the Server Certificates icon:

image

Click on the Create Certificate Request action on the right:

image

Fill in the appropriate fields:

image

Most certificate authorities, especially external public CAs, require at least 2048 bit length for certificates so you should choose that at the very minimum:

image

Save the certificate request somewhere accessible:

image

Open your Root CA’s certsrv webpage and select Request a certificate:

image

Select advanced certificate request:

image

Select Submit a certificate request by using a base-64-encoded CMC or PKCS #10 file or submit a renewal request by using a base-64-encoded PKCS #7 file:

image

Once presented with the following page:

image

… open up the certificate request file you generated earlier:

image

Copy the content and paste it into the Base-64-encoded certificate request (CMC or PKCS #10 or PKCS #7) then click the Submit button:

image

You will now see the following Certificate Pending page:

image

Open up the Active Directory Certificate Services management console either through Server Manager or via the MMC snap-in, then navigate to the Pending Requests node:

image

Right click on the pending request, click on All Tasks and then Issue:

image

The certificate listed in Pending Requests should not be listed in Issued Certificates:

image

Navigate to the http://yourCA/certsrv webpage and you should now see a View the status of a pending certificate request link:

image

Clicking on the link above should now reveal the page with the link:

Saved-Request certificate (Some date)

image

Clicking on the link above will bring you to the following page:

image

From here, you want to make sure you select option Base 64 encoded then Download certificate:

image

Save the file somewhere accessible:

image

Opening this .cer file will show something like this:

image

Navigate back to IIS and select Complete Certificate Request:

image

Browse to the file and give the certificate a friendly name (I usually just use the FQDN):

image

image

The certificate should now show up in the Server Certificates window:

image

Proceed with assigning it to the Default Web Site and your certsrv site is now secured.