<?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>PKI &#8211; Blog of Kliment Andreev &#8211; A place so I won&#039;t forget things</title>
	<atom:link href="https://blog.andreev.it/tag/pki/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.andreev.it</link>
	<description></description>
	<lastBuildDate>Sat, 24 Oct 2020 12:31:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Windows: Enterprise PKI on Windows 2016</title>
		<link>https://blog.andreev.it/2017/12/117-windows-enterprise-pki-windows-2016/</link>
					<comments>https://blog.andreev.it/2017/12/117-windows-enterprise-pki-windows-2016/#respond</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Sat, 02 Dec 2017 23:44:23 +0000</pubDate>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Certificates]]></category>
		<category><![CDATA[Enterprise PKI]]></category>
		<category><![CDATA[PKI]]></category>
		<guid isPermaLink="false">http://blog.iandreev.com/?p=3334</guid>

					<description><![CDATA[A public key infrastructure (PKI) is a set of roles, policies, and procedures needed&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>A public key infrastructure (PKI) is a set of roles, policies, and procedures needed to create, manage, distribute, use, store, and revoke digital certificates and manage public-key encryption. That&#8217;s what <a href="https://en.wikipedia.org/wiki/Public_key_infrastructure" rel="noopener noreferrer" target="_blank">Wikipedia </a>says.<br />
Today, using certificates is a must. Google search gives you better search scores if your web site is using certificates and if your site is mobile-friendly. So, in this post I’ll describe how to deploy an Enterprise PKI on Windows 2016 server. This post is mostly for on-prem deployments, but it will give you some insights on how PKI works. I will create one Windows IIS web server joined to the domain and one Linux server (not joined to the domain) running Apache. I&#8217;ll create SSL sites on both and deploy the certificates, so the clients (Windows machines on your corp domain) won&#8217;t get that certificate warning when browsing these site.<br />
In order to do what we planed, we’ll use Active Directory Certificate Services (AD CS). We’ll create a lab with a domain controller, an offline Certificate Authority, an Enterprise Certificate Authority and two web servers. These two web servers (one running IIS and the other running Apache) will host two web sites (test1 and test2) that will have SSL certificates issued by our CA.<br />
The hostnames are :</p>
<ul>
<li>dc01.empire.local</li>
<li>offCA</li>
<li>entCA.empire.local</li>
<li>iis.empire.local</li>
<li>apache</li>
</ul>
<div style="border:1px solid red; padding:16px;">
<p style="text-align:center;"><strong><span style="color:#800000;">NOTE</span> </strong></p>
<p style="text-align:center;"><em><strong>In this post, I&#8217;ll refer offline CA as Root CA and Enterprise CA as Subordinate CA.</strong></a></em><a href="http://paul-barford.blogspot.com/"> </a></p>
</div>
<h1>Domain Controller(s)</h1>
<p>I won’t explain how to create a domain controller. Just make sure you have a domain controller(s) in your environment. My domain is called <strong>empire.local</strong> with <strong>EMPIRE</strong> as a NetBIOS domain name.</p>
<h1>Offline Root Certificate Authority</h1>
<p>Why do we need an offline Certificate Authority and enterprise CA? It’s per MS best practices. The offline CA will be the one that holds the PKI, but once it’s configured it can be brought offline. The actual certificates will be signed by the enterprise CA. In case the enterprise CA gets compromised, you’ll have to bring the offlince CA on-line and revoke the certificate for the enterprise CA.<br />
So, let’s build the offline CA. This server shouldn’t be part of the domain. Leave it as a workgroup member. From the <strong>Server Manager</strong>, click on <strong>Add Roles and Features</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-01.png"><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-3338" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-01.png" alt="" width="357" height="231" /></a><br />
Select <strong>Active Directory Certificate Services</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-02.png"><img decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-02.png" alt="" width="787" height="558" class="aligncenter size-full wp-image-3344" /></a><br />
Under role services, select <strong>Certification Authority</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-03.png"><img decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-03.png" alt="" width="780" height="563" class="aligncenter size-full wp-image-3345" /></a><br />
Once the installation is completed, click on the flag icon in the upper right corner to configure the CA.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-04.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-04.png" alt="" width="419" height="200" class="aligncenter size-full wp-image-3346" /></a><br />
Choose the defaults or if you want a separate local user, specify it here. You have to create that user first.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-05.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-05.png" alt="" width="757" height="557" class="aligncenter size-full wp-image-3347" /></a><br />
Choose to configure <strong>Certification Authority</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-06.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-06.png" alt="" width="763" height="560" class="aligncenter size-full wp-image-3348" /></a><br />
Choose <strong>Standalone CA</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-07.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-07.png" alt="" width="761" height="559" class="aligncenter size-full wp-image-3349" /></a><br />
Choose <strong>Root CA</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-08.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-08.png" alt="" width="749" height="557" class="aligncenter size-full wp-image-3350" /></a><br />
Select to <strong>Create a new private key</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-09.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-09.png" alt="" width="758" height="555" class="aligncenter size-full wp-image-3351" /></a><br />
Choose <strong>SHA256 </strong>and <strong>2048</strong>. Don’t use SHA1, it’s being deprecated.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-10.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-10.png" alt="" width="758" height="557" class="aligncenter size-full wp-image-3352" /></a><br />
Choose the common name for the CA. In my case it’s <strong>ROOT-CA</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-11.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-11.png" alt="" width="756" height="560" class="aligncenter size-full wp-image-3353" /></a><br />
Use validity for this CA. I used 10 instead of the default 5.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-12.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-12.png" alt="" width="758" height="559" class="aligncenter size-full wp-image-3354" /></a><br />
Choose where the database and the logs will be located. I used the defaults, best practice is to use a separate data drive.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-13.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-13.png" alt="" width="757" height="559" class="aligncenter size-full wp-image-3355" /></a><br />
Verify everything looks good and click <strong>Configure</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-14.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-14.png" alt="" width="764" height="554" class="aligncenter size-full wp-image-3356" /></a><br />
Once completed, go to <strong>C:\Windows\System32\CertSrv\CertEnroll</strong>. This is where you’ll have the root certificate (<strong>offCA_ROOT-CA.crt</strong>) and the Certificate Revocation List (<strong>ROOT-CA.crl</strong>).<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-15.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-15.png" alt="" width="718" height="203" class="aligncenter size-full wp-image-3357" /></a><br />
Go to the <strong>Administrative Tools</strong> under <strong>Control Panel</strong> and run the <strong>Certification Authority</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-16.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-16.png" alt="" width="544" height="198" class="aligncenter size-full wp-image-3358" /></a><br />
Now, we have to configure the Root (offline) CA so it is aware of the <strong>subordinate (enterprise) CA</strong>. Right click the name of the CA, choose <strong>Properties</strong> and then click on the <strong>Extensions</strong> tab. You’ll see something like this.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-17.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-17.png" alt="" width="602" height="628" class="aligncenter size-full wp-image-3359" /></a><br />
Click <strong>Add </strong>and enter the following in the <strong>Location</strong> field. Then click <strong>OK</strong>. Don’t click <strong>Insert</strong>.</p>
<pre class="brush: bash; title: ; notranslate">
http://entCA.empire.local/certdata/&lt;CaName&gt;&lt;CRLNameSuffix&gt;&lt;DeltaCRLAllowed&gt;.crl
</pre>
<p>Replace <strong>entCA.empire.local</strong> with the name of your subordinate (enterprise) server.<br />
After you click <strong>OK</strong>, check these two checkmarks.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-18.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-18.png" alt="" width="397" height="535" class="aligncenter size-full wp-image-3369" /></a><br />
By default, they are not checked. Click <strong>Apply </strong>and you’ll be prompted to restart the CA service. Go back to the properties of the <strong>Root CA</strong>, click on the <strong>Extensions </strong>tab, but this time switch to <strong>Authority Information Access (AIA)</strong> instead of <strong>CRL Distribution Point (CDP)</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-19.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-19.png" alt="" width="414" height="541" class="aligncenter size-full wp-image-3362" /></a><br />
Same thing here. Click <strong>Add </strong>and enter the following in the <strong>Location </strong>field. </p>
<pre class="brush: bash; title: ; notranslate">
http://entCA.empire.local/certdata/&lt;ServerDNSName&gt;&lt;CaName&gt;&lt;CertificateName&gt;.crt
</pre>
<p>Replace <strong>entCA.empire.local</strong> with your enterprise CA server name.  Click <strong>OK</strong>, don’t click <strong>Insert</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-20.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-20.png" alt="" width="456" height="322" class="aligncenter size-full wp-image-3363" /></a><br />
Then check <strong>Include in the AIA extension of issues certificates</strong> which by default is not checked. Click <strong>OK </strong>and that will restart the CA service.<br />
Select <strong>Revoked Certiicates</strong>, right-click, choose <strong>All Tasks</strong> and then <strong>Publish</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-21.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-21.png" alt="" width="444" height="274" class="aligncenter size-full wp-image-3365" /></a><br />
Click <strong>OK</strong> for the <strong>New CRL</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-22.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-22.png" alt="" width="405" height="537" class="aligncenter size-full wp-image-3366" /></a><br />
If you go back to<strong> C:\Windows\System32\CertSrv\CertEnroll</strong>, you’ll see that the time stamp on <strong>ROOT-CA.crl</strong> file has changed.<br />
Now, we need the root certificate (without the private key) exported so we can copy it to the <strong>enterprise CA</strong>. Right-click the CA, choose <strong>Properties </strong>and from the <strong>General </strong>tab, choose <strong>View Certificate</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-23.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-23.png" alt="" width="442" height="619" class="aligncenter size-full wp-image-3367" /></a><br />
Click on <strong>Details </strong>tab and then <strong>Copy to File</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-24.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-24.png" alt="" width="442" height="619" class="aligncenter size-full wp-image-3373" /></a><br />
In the <strong>Certificate Export Wizard</strong>, choose the first option (<strong>DER</strong>).<br />
Click <strong>Next </strong>and save it under <strong>c:\windows\system32\certsrv\certenroll</strong> with a name something like this.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-25.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-25.png" alt="" width="542" height="528" class="aligncenter size-full wp-image-3374" /></a><br />
Click <strong>Save </strong>then <strong>Finish</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-26.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-26.png" alt="" width="636" height="527" class="aligncenter size-full wp-image-3375" /></a><br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-27.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-27.png" alt="" width="531" height="518" class="aligncenter size-full wp-image-3378" /></a></p>
<h1>Enterprise (standalone) Certificate Authority</h1>
<p>Now, let’s move to the subordinate (enterprise) CA. This is the server that will actually issue and revoke certificates. Make sure this server is a member of the domain.<br />
From the server manager go to<strong> Add Roles and Features</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-28.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-28.png" alt="" width="357" height="231" class="aligncenter size-full wp-image-3377" /></a><br />
Choose <strong>Active Directory Certificate Services</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-29.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-29.png" alt="" width="780" height="558" class="aligncenter size-full wp-image-3379" /></a><br />
Choose both, <strong>Certification Authority</strong> and <strong>Certificate Authority Web Enrollment</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-30.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-30.png" alt="" width="775" height="557" class="aligncenter size-full wp-image-3380" /></a><br />
Web enrollment will require IIS. Choose defaults.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-31.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-31.png" alt="" width="788" height="559" class="aligncenter size-full wp-image-3381" /></a><br />
Once the installation is completed, click on the flag icon in the upper right corner to configure the CA.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-32.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-32.png" alt="" width="419" height="200" class="aligncenter size-full wp-image-3382" /></a><br />
Choose the Administrator or some other domain user if you want.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-33.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-33.png" alt="" width="766" height="556" class="aligncenter size-full wp-image-3383" /></a><br />
Select the <strong>Certification Authority</strong> and <strong>Certification Authority Web Enrollment</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-34.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-34.png" alt="" width="763" height="571" class="aligncenter size-full wp-image-3420" /></a><br />
Select <strong>Enterprise CA</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-35.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-35.png" alt="" width="752" height="555" class="aligncenter size-full wp-image-3385" /></a><br />
Select <strong>Subordinate CA</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-36.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-36.png" alt="" width="755" height="551" class="aligncenter size-full wp-image-3386" /></a><br />
<strong>Create a new Private key</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-37.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-37.png" alt="" width="749" height="554" class="aligncenter size-full wp-image-3387" /></a><br />
Choose <strong>SHA256 </strong>and <strong>2048</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-38.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-38.png" alt="" width="757" height="558" class="aligncenter size-full wp-image-3388" /></a><br />
Choose the common name. In my case it&#8217;s <strong>ENT-CA</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-39.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-39.png" alt="" width="754" height="555" class="aligncenter size-full wp-image-3389" /></a><br />
Choose where to save the request file. This will have to be signed by the <strong>Root CA</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-40.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-40.png" alt="" width="759" height="560" class="aligncenter size-full wp-image-3390" /></a><br />
Choose defaults. Again, best practice is to save it to a separate data drive.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-41.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-41.png" alt="" width="760" height="560" class="aligncenter size-full wp-image-3391" /></a><br />
Verify and click <strong>Configure</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-42.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-42.png" alt="" width="758" height="557" class="aligncenter size-full wp-image-3392" /></a><br />
You’ll see this warning. This means you have to sign the request file that we just saved under C:\<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-43.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-43.png" alt="" width="752" height="557" class="aligncenter size-full wp-image-3393" /></a><br />
Now, copy the files from the <strong>Root CA</strong> (the first server) to <strong>Enterprise CA</strong> (this server). You will need to copy those three files under <strong>C:\Windows\System32\CertSrv\CertEnroll</strong> to anywhere on the Enterprise CA server. Choose the desktop, we won’t need them after the configuration. Right click on the certificate file that we created (the one with <strong>NO-PVT-KEY</strong> in its name) in its name and a <strong>.cer</strong> as a file extenstion. Click on <strong>Install Certificate</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-44.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-44.png" alt="" width="529" height="275" class="aligncenter size-full wp-image-3394" /></a><br />
Choose <strong>Local Machine</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-45.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-45.png" alt="" width="530" height="523" class="aligncenter size-full wp-image-3395" /></a><br />
Choose <strong>Place all certificates in the following store</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-46.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-46.png" alt="" width="531" height="529" class="aligncenter size-full wp-image-3396" /></a><br />
Click <strong>Browse </strong>and select <strong>Trusted Root Certification Authority</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-47.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-47.png" alt="" width="537" height="527" class="aligncenter size-full wp-image-3397" /></a><br />
Click <strong>Next </strong>and <strong>Finish</strong>.<br />
Now, go to <strong>c:\inetpub\wwwroot\</strong> and create a folder <strong>certdata</strong>. Remember when we created the CDP and IAI extensions? We used something like <em>http://entCA.empire.local/certdata&#8230;</em> Well, we are creating that now. So, create that folder and move the other two files there.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-48.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-48.png" alt="" width="819" height="565" class="aligncenter size-full wp-image-3398" /></a><br />
OK, now go back to the offline <strong>Root CA</strong>. Copy the request file that was created when we installed CA on the <strong>Enterprise CA</strong>. That’s the file that’s on the C:\ drive of the <strong>Enterprise CA</strong>. Move it to the desktop of the <strong>offline Root CA</strong>.<br />
Launch the <strong>Certification Authority (Control Panel, Administrative Tools, Certification Authority) </strong>and select the name of the <strong>Root CA</strong>. Right-click, select <strong>All Tasks</strong> and then <strong>Submit New Request</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-49.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-49.png" alt="" width="451" height="289" class="aligncenter size-full wp-image-3399" /></a><br />
Browse to the file that we just copied on the desktop.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-50.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-50.png" alt="" width="661" height="558" class="aligncenter size-full wp-image-3400" /></a><br />
Click on <strong>Pending Requests</strong>. You’ll see our request is waiting for approval.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-51.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-51.png" alt="" width="774" height="306" class="aligncenter size-full wp-image-3401" /></a><br />
Select the requested item on the right and then right-click, <strong>All Tasks</strong> and <strong>Issue</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-52.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-52.png" alt="" width="752" height="320" class="aligncenter size-full wp-image-3402" /></a><br />
The request entry will be gone, but if you click on <strong>Issued Certificates</strong>, you’ll see the certificate there.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-53.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-53.png" alt="" width="783" height="239" class="aligncenter size-full wp-image-3403" /></a><br />
Double-click the certificate on the right and then click on <strong>Details </strong>tab.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-54.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-54.png" alt="" width="681" height="658" class="aligncenter size-full wp-image-3404" /></a><br />
Click <strong>Copy to File</strong>. In the export wizard choose this option.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-55.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-55.png" alt="" width="741" height="677" class="aligncenter size-full wp-image-3405" /></a><br />
Save it on the desktop. I named it as <strong>entCA-signed</strong>, which will remind me that this is a signed certificate for the Enterprise CA.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-56.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-56.png" alt="" width="741" height="683" class="aligncenter size-full wp-image-3406" /></a><br />
Go back to the <strong>Enterprise CA</strong> and copy this <strong>entCA-signed</strong> file to the desktop. Then start the <strong>Certification Authority (Control Panel, Administrative Tools, Certification Authority)</strong>. You will see that the CA service is stopped. Right click the enterprise CA name, choose <strong>All Tasks</strong> and then <strong>Install CA Certificate</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-57.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-57.png" alt="" width="537" height="339" class="aligncenter size-full wp-image-3407" /></a><br />
Browse to that file <strong>entCA-signed </strong>that we just copied from the <strong>offline Root CA</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-58.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-58.png" alt="" width="775" height="665" class="aligncenter size-full wp-image-3408" /></a><br />
Once imported, start the service from the toolbar (green triangle icon). The service should start successfully.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-59.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-59.png" alt="" width="604" height="291" class="aligncenter size-full wp-image-3409" /></a><br />
At this point we have to tell the domain controller that there is a new <strong>Enterprise CA</strong> in the environment. Log to the domain controller, and copy the file (ROOT-CERT-NO-PVT-KEY) from the <strong>Enterprise CA</strong>. I saved this file on the desktop on <strong>Enterprise CA</strong>, so do the same. Copy the file from the desktop of <strong>Enterprise CA</strong> to the desktop of the domain controller. On the domain controller, go to <strong>Control Panel</strong>, <strong>Administrative Tools</strong>, then <strong>Group Policy Management</strong>.<br />
Expand the GP to edit the default domain policy.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-60.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-60.png" alt="" width="747" height="549" class="aligncenter size-full wp-image-3410" /></a><br />
Right-click and <strong>Edit</strong>. Go to <strong>Computer Configuration</strong>, <strong>Policies</strong>, <strong>Windows Settings</strong>, <strong>Security Settings</strong>, <strong>Public Key Policies</strong> and <strong>Trusted Root Certification Authorities</strong>. Right click on it and choose <strong>Import</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-61.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-61.png" alt="" width="527" height="249" class="aligncenter size-full wp-image-3411" /></a><br />
Local machine is automatically selected.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-62.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-62.png" alt="" width="539" height="531" class="aligncenter size-full wp-image-3412" /></a><br />
Choose the certificate, the one without private key.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-63.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-63.png" alt="" width="625" height="508" class="aligncenter size-full wp-image-3413" /></a><br />
The <strong>Certificate Import Wizard</strong> will launch.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-64.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-64.png" alt="" width="540" height="524" class="aligncenter size-full wp-image-3414" /></a><br />
Make sure this is where the certificate will be stored.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-65.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-65.png" alt="" width="540" height="524" class="aligncenter size-full wp-image-3415" /></a><br />
Click <strong>Finish</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-66.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-66.png" alt="" width="537" height="519" class="aligncenter size-full wp-image-3416" /></a><br />
OK, what now? First, delete the files that you don’t need. The ones on the desktop of the <strong>Enterprise CA,</strong> the domain controller and the <strong>offline CA</strong>. and the request file on the c:\drive on the <strong>Enterprise CA</strong>. You can also shut down offline CA. it’s not needed for another 10 years.  </p>
<h1>IIS Windows Web Server</h1>
<p>OK, so we have the PKI in place, but let&#8217;s build an IIS web server that uses certificates, which means it will listen on port 443. This web server will be a member of a domain and the URL will be <strong>test1.empire.local</strong>. Users will access the site as https://site1.empire.local.<br />
Log in to the IIS server and install IIS. This server must be a member of the domain. From the <strong>Server Manager</strong> add the <strong>IIS </strong>role.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-67.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-67.png" alt="" width="771" height="563" class="aligncenter size-full wp-image-3430" /></a><br />
Create a folder called <strong>test1.empire.local</strong> under <strong>c:\inetpub\wwwroot</strong>. Create a text file called <strong>index.txt</strong> and type something.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-68.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-68.png" alt="" width="570" height="303" class="aligncenter size-full wp-image-3431" /></a><br />
Rename the <strong>index.txt</strong> as <strong>index.html</strong>.<br />
Start the <strong>Internet Information Services (IIS) Manager</strong> from <strong>Control Panel</strong>, <strong>Administrative Tools</strong> or click on Start then type <strong>inetmgr</strong>. Right-click on <strong>Sites </strong>and choose <strong>Add Website</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-69.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-69.png" alt="" width="355" height="314" class="aligncenter size-full wp-image-3432" /></a><br />
Configure it and click <strong>OK</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-70.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-70.png" alt="" width="589" height="572" class="aligncenter size-full wp-image-3433" /></a><br />
Once the site is started, make sure that you have the <strong>test1.empire.local</strong> in the DNS, so the client computers know that test1.empire.local resolves to an IP.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-71.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-71.png" alt="" width="1002" height="207" class="aligncenter size-full wp-image-3434" /></a><br />
From any machine that’s on the domain, go to http://test1.empire.local. Make sure it works.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-72.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-72.png" alt="" width="686" height="243" class="aligncenter size-full wp-image-3435" /></a><br />
Go back to the IIS server. Click on the IIS server name and double-click <strong>Server Certificates</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-73.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-73.png" alt="" width="563" height="440" class="aligncenter size-full wp-image-3436" /></a><br />
Click on <strong>Create Domain Certificate</strong> on the right side.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-79.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-79.png" alt="" width="296" height="279" class="aligncenter size-full wp-image-3438" /></a><br />
In the dialog box that shows up, fill out the values. The common name is the actual server name.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-74.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-74.png" alt="" width="668" height="515" class="aligncenter size-full wp-image-3439" /></a><br />
Click the <strong>Select </strong>button and specify our Enterprise CA. If you don&#8217;t see anything in the certification Authority box when you click Select, it means that the IIS server doesn&#8217;t know about the Enterprise CA because the default domain policy is not present. Try with <strong>gpforce /update</strong> first, to update the domain policy.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-75.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-75.png" alt="" width="667" height="520" class="aligncenter size-full wp-image-3442" /></a><br />
Click <strong>Finish</strong>.<br />
If everything goes according to the plan, you&#8217;ll see that you have your certificate issued.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-80.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-80.png" alt="" width="885" height="156" class="aligncenter size-full wp-image-3444" /></a><br />
Now, click on the actual web site that we created and click on <strong>Bindings </strong>on the right-side.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-76.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-76.png" alt="" width="908" height="422" class="aligncenter size-full wp-image-3445" /></a><br />
Click on <strong>Add </strong>button and fill out the values. Pretty much we are telling <strong>IIS </strong>that we want an SSL site that runs on port 443 with a certificate that we already got from the <strong>Enterprise CA</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-77.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-77.png" alt="" width="618" height="471" class="aligncenter size-full wp-image-3446" /></a><br />
Now, go back to any client on the network and browse to https://test1.empire.local. You&#8217;ll see this.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-78.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-78.png" alt="" width="675" height="290" class="aligncenter size-full wp-image-3447" /></a><br />
If you click on the lock icon in the address bar, you&#8217;ll see that we got the certificates right.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-81.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-81.png" alt="" width="355" height="247" class="aligncenter size-full wp-image-3448" /></a></p>
<h1>Apache Web Server</h1>
<p>I&#8217;ll build a web server running Apache in the environment. I won&#8217;t go into details how to do that. Each flavor of Linux/*BSD has its own way of doing it. I&#8217;ll use AWS Linux which is based on Red Hat 6. It really doesn&#8217;t matter what you use, as long as you know how to configure Apache. Make sure you have the URL in the DNS, e.g. test2.empire.local to resolve to some IP.<br />
For instructions on how to configure Apache on AWS/RHEL6/CentOS 6, you can check my <a href="https://blog.andreev.it/?p=1010" rel="noopener noreferrer" target="_blank">post</a>. For RHEL 7/CentOS chek this <a href="https://blog.andreev.it/?p=1962" rel="noopener noreferrer" target="_blank">link </a>and for FreeBSD use this <a href="https://blog.andreev.it/?p=1309" rel="noopener noreferrer" target="_blank">one</a>.<br />
First, we have to generate the private key for the server. I&#8217;ll put it under <strong>/etc/certs</strong> directory.Do this by typing:</p>
<pre class="brush: bash; title: ; notranslate">
mkdir /etc/certs
cd /etc/certs
openssl genrsa -out test2.empire.local.key 2048
</pre>
<p>Then we&#8217;ll generate a request file that the Enterprise CA will have to sign. </p>
<pre class="brush: bash; title: ; notranslate">
openssl req -new -key test2.empire.local.key -out test2.empire.local.csr
</pre>
<p>You&#8217;ll be prompted to fill out the blanks, similarly with what we did with the IIS server.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-82.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-82.png" alt="" width="554" height="194" class="aligncenter size-full wp-image-7924" /></a><br />
Remember, common name is the name of your server URL.<br />
Once you execute these two commands, you&#8217;ll have two files under /etc/certs. The private key and the the certificate signing request (.csr extension means that).<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-83.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-83.png" alt="" width="475" height="75" class="aligncenter size-full wp-image-7925" /></a><br />
The<strong> Enterprise CA</strong> will have to sign the request file and issue a certificate.<br />
Issuing this certificate is a little bit different. Go to the <strong>Enterprise CA</strong> and using a browser go to http://localhost/certsrv.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-84.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-84.png" alt="" width="786" height="455" class="aligncenter size-full wp-image-7926" /></a><br />
Click on <strong>Request a certificate</strong>. Then click on <strong>advanced certificate request</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-85.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-85.png" alt="" width="773" height="242" class="aligncenter size-full wp-image-7927" /></a><br />
Click on the second line,<strong> Submit a certificate&#8230;</strong><br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-86.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-86.png" alt="" width="757" height="322" class="aligncenter size-full wp-image-7928" /></a><br />
On the Linux/BSD server, open up the csr file under <strong>/etc/certs</strong> with your favorite editor (vi, nano, vim). It&#8217;s just a text file.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-87.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-87.png" alt="" width="500" height="312" class="aligncenter size-full wp-image-7929" /></a><br />
Select the text, copy it to the clipboard and paste it under <strong>Saved Request</strong> field.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-88.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-88.png" alt="" width="877" height="703" class="aligncenter size-full wp-image-7930" /></a><br />
For the <strong>Certificate Template</strong>, choose the <strong>Subordinate Certification Authority</strong> and click <strong>Submit</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-89.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-89.png" alt="" width="541" height="297" class="aligncenter size-full wp-image-7931" /></a><br />
Select <strong>Base 64 encoded</strong> and then you can download the certificate or the certificate chain by clicking the link. In my case, I&#8217;ll download the certificate only.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-90.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-90.png" alt="" width="675" height="300" class="aligncenter size-full wp-image-7932" /></a><br />
Save the file somewhere on the desktop (delete after use), edit it with notepad, select all and copy. This is how it looks like.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-91.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-91.png" alt="" width="601" height="629" class="aligncenter size-full wp-image-7933" /></a><br />
Go back to your Linux/BSD server and edit a new file under <strong>/etc/certs</strong>. I&#8217;ll name my file test2.empire.local.crt, so I know that this is a server certificate. Paste the text from notepad and save it. Edit the httpd.conf or httpd-vhosts.conf or whatever file you have for your web server and create an entry for your web site. In my case it looks like this.</p>
<pre class="brush: bash; title: ; notranslate">
&lt;VirtualHost *:443&gt;
    SSLEngine on
    SSLCertificateFile /etc/certs/test2.empire.local.crt
    SSLCertificateKeyFile /etc/certs/test2.empire.local.key
    ServerAdmin darth.vader@empire.local
    DocumentRoot /var/www/test2.empire.local
    ServerName test2.empire.local
    ErrorLog logs/test2.empire.local-error_log
    CustomLog logs/test2.empire.local-access_log common
&lt;/VirtualHost&gt;
</pre>
<p>Go to the root of your web site, in my case it&#8217;s <strong>/var/www/test2.empire.local</strong> and create an <strong>index.html</strong> (not .htm) file with something in it.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-92.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-92.png" alt="" width="409" height="93" class="aligncenter size-full wp-image-7934" /></a><br />
Finally, go to https://test2.empire.local and you should see the site.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/12/P094-93.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/12/P094-93.png" alt="" width="586" height="153" class="aligncenter size-full wp-image-7935" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2017/12/117-windows-enterprise-pki-windows-2016/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
