In this Tutorial we’re going to configure a Two-Tier Enterprise PKI with Microsoft Server 2019 intended for Lab use. The advantage of a Two-Tier Enterprise PKI Hierarchy is that clients only trust the Root CA. So if a Subordinate server gets compromised the Root CA does not have to be replaced. During normal operation the Root CA will be offline and Certificate requests are handled by the Subordinate CA. The Root CA is a non-domain joined device and will only be turned on issue a certificate for the Subordinate CA or to update the Certificate Revocation List (CRL).
-
Overview
-
Setup Standalone Root CA
-
Setup Enterprise Subordinate CA
-
Setup Group policy
-
Deploy Policy Templates
In this setup we are going to build this Lab setup.
Before you start with this tutorial create the following servers and install them with Microsoft Server 2019. In this tutorial we are only configuring the servers.
Servername | OS | Role | Notes |
---|---|---|---|
DC01 | MS Server 2019 | Domain Controller | |
OFFENT-CA01 | MS Server 2019 | Offline Standalone Root CA | non-domain joined |
SUBENT-CA02 | MS Server 2019 | Online Enterprise Subordinate CA | Domain joined |
Offline Root CA
Setup Offline Root CA
First we will create the CApolicy.inf
. This is a configuration file that defines multiple settings that are applied to the root CA certificate and all other certificates issued by the root CA. This file needs to be created before the ADCS is installed on the root CA. For more information about the Syntax go here.
- Start Powershell and type the following line and press Enter:
notepad c:\windows\capolicy.inf
-
Select yes to create the new file
-
Because this is a lab setup I will only setup some basic settings for the Root CA. I will configure the following settings:
-
Renewalinformation for the CA certificate.
-
The validity period for the base CRL.
-
Disable the AlternateSignatureAlgorithm
-
Disable the DefaultTemplates, these are not used because this is an offline CA.
For this lab I will use a random generated OID which is based on the Microsoft OID. Because these generated OID may not be unique you should request a private enterprise number at IANA (link). This number can be added to the CAPolicy.inf.
[Version]
Signature="$Windows NT$"
[Certsrv_Server]
RenewalKeyLength=4096
RenewalValidityPeriod=Years
RenewalValidityPeriodUnits=20
CRLPeriod=Years
CRLPeriodUnits=1
AlternateSignatureAlgorithm=0
LoadDefaultTemplates=0
-
Save the file as capolicy.inf using All files and ANSI Encoding.
-
Now we the role can be added and configured. Start the Server manager and select Add roles and features
-
The Add Roles and Features Wizard will start, press Next to continue.
-
Select Role-based or feature-based installation and press Next
-
Use the default settings and press Next to continue.
-
Select Active Directory Certificate Services
-
A pop-up will appear, press Add Features to continue.
-
Press Next to continue
-
Press Next to continue.
-
Check if the Servername is correct and press Next to continue.
-
Check if the Servername is correct and press Next to continue.
-
Press install to add the Active Directory Certificate Services to the server.
-
When the installation has completed, press the link Configure Active Directory Certificate Services on the destination server
-
Use the default settings and press Next
-
Select Certification Authority and press Next
-
Because this server is non-domain joined only Standalone CA can be selected. Press Next to continue.
-
As this server is the root of the PKI hierarchy select Root CA and press Next
-
Select Create a new private key and press Next to continue.
-
Because this is the Root CA Certificate I use a longer Key length of 4096. This will increase the security.
-
Use the default settings and press Next to continue.
-
Because this server will be used in a Test Environment I extend the validity period to 10 years. Press Next to continue.
-
Use the default settings and press Next to continue.
-
Press Configure to configure the server.
-
Press Close to continue.
-
Press Tools in the Server Manager and select Certification Authority
-
Right click the Servername and select Properties
-
Select the Extensions tab
-
In the Extensions tab select the extension CRL Distribution Point (CDP) and remove all locations except the
C:\*
Location. -
Because this server will be offline it cannot be contacted, therefore a location needs to be added to the subordinate server. Press Add to add the CDP on the Subordinate Server.
-
Enter the following location and press OK
http://<ServerDNSName>/CertEnroll/<CaName><CRLNameSuffix><DeltaCRLAllowed>.crl
Replace with the dnsname of the Subordinateserver in this demo the location will be:
http://subent-ca02.vmlabblog.com/CertEnroll/%3CCaName%3E%3CCRLNameSuffix%3E%3CDeltaCRLAllowed%3E.crl
Check the boxes beginning with Include in CRLs* and Include in the CDP* and press Apply
-
Press No when asked to restart the service.
-
Select in Select extension the Authority Information Access (AIA) and remove all locations except the
C:\*
Location. -
Press Add to add the AIA location on the Subordinate Server.
-
Enter the following location and press OK
http://<ServerDNSName>/CertEnroll/<ServerDNSName>_<CaName><CertificateName>.crt
Replace with the dnsname of the Subordinateserver in this demo the location will be:
http://SUBENT-CA02.vmlabblog.com/CertEnroll/<ServerDNSName>_<CaName><CertificateName>.crt
-
Check the box Include in the AIA extension of issued certificates and press Apply
-
Press Yes when asked to restart the service.
-
Select the General and select the Root Certificate and press View Certificate.
-
Select the tab Details and press Copy to File….
-
In the Certificate Export Wizard press Next.
-
Select DER encoded binary X.509 (.CER) and press Next.
-
In File name enter C:\Windows\System32\CertSrv\CertEnroll<CA-NAME>-CA.cer and press Next.
-
Press Finish to export the RootCA Certificate.
-
A popup will appear when the export was successful, press OK to continue.
The setup of the Offline RootCA is now completed.
Subordinate CA
With the Offline Root CA completed, we can now setup of the Subordinate CA server. This server is authorized by the Root CA to issue the certificates. During the setup the CA role will be added and configured. The server will also be authorized by the Root CA The Subordinate CA Server is the SUBENT-CA02. Make sure that the server Subordinate server is domain joined before you start with the ADCS setup and that you have a domain account which is member of the Enterprise admins group.
Setup Subordinate CA
-
Start the Server manager and select Add roles and features
-
The Add Roles and Features Wizard will start, press Next to continue.
-
Select Role-based or feature-based installation and press Next
-
Use the default settings and press Next to continue.
-
Select Active Directory Certificate Services
-
A pop-up will appear, press Add Features to continue.
-
Select Web Server (IIS)
-
A pop-up will appear, press Add Features to continue.
-
Press Next to continue
-
Press Next to continue.
-
Check if the Servername before you start, this cannot be changed after the AD CS role has been installed and press Next to continue
-
Keep the default role services Certication Authority and press Next
-
On the Web Server Role (IIS) page press Next
-
On the Role Services page select Basic Authentication and Windows Authentication. Press Next to continue.
-
In the confirmation screen press Install to start the installation.
-
When the installation has completed, press the link Configure Active Directory Certificate Services on the destination server
-
Make sure your Domain credentials have been entered and not your local admin credentials. Otherwise you will not be able to configure a Enterprise CA. Press Next to continue.
-
Select the box Certification Authority and press Next to continue.
-
Select Enterprise CA and press Next to continue. (if Enterprise CA is not available check if the server is domain joined and the credentials entered in step 17)
-
Select Subordinate CA and press Next to continue.
-
Select Create a new private key and press Next.
-
Use the default settings and press Next to continue.
-
Use the default settings and press Next to continue
-
Select the folder to save the Certificate Request and press Next to continue. (default is **c:**)
-
Use the default settings and press Next to continue.
-
Press Configure to apply the configuration.
-
When the configuration has succeeded a warning is shown. This is just a notification that the untill a certificate of the RootCA has been obtained and applied to the subordinate ca the Configuration is not completed.
-
Switch over to the Offline Root CA (OFFENT-CA01) and browse to the folder
c:\windows\system32\certsrv\certenroll
. There should be three files, select and copy all files -
Switch back to the Subordinate CA (SUBENT-CA02) and browse to the folder
c:\windows\system32\certsrv\certenroll
. Paste all the files copied in the previous step. -
Rightclick the Root CA certificate which you just copied and select Install Certificate
-
Select Local Machine and press Next
-
Press Browse and select the Trusted Root Certification Authorities store. Press Next to continue.
-
Press Finish to continue.
-
After some time a popup will appear when the import has finished. Press OK to continue
-
Create a new folder in
C:\inetpub\wwwroot
with the nameCertEnroll
-
Copy the RootCA Certificate and Certifate Revocation List from
C:\Windows\System32\CertSrv\CertEnroll
toC:\inetpub\wwwroot\CertEnroll
-
Browse to the location entered in step 20 (default
c:\
) and copy the *.Req file to the C: Drive on RootCA server. -
On the Root CA Server open Certification Authority rightclick the servername and select All Tasks -> Submit new request…
-
Browse to the request file on the C: driver and press Open
-
Select Pending Requests. Rightclick the pending request and select All Tasks -> Issue
-
Select Issued Certificates. Rightclick the issued certificate and select Open
-
Select Details and press Copy to file…
-
Press Next to continue
-
Select Cryptographic Message Syntax Standard – PKCS #7 Certificates (.P7B) and check the box Include all certificates in the certification path if possible. Press Next to continue
-
Press Browse…
-
Enter a name for the certificate and press Save (the default location is the Documents folder)
-
Press Next to continue.
-
Press Finish to export the CA Certificate.
-
After some time a popup will appear when the export has finished. Press OK to continue.
-
Copy the CA Certificate from the RootCA ( step 46) and switch to the subordinate server to paste the file.
-
On the Subordinate CA open the Certification Authority. Rightclick the Servername and select All Tasks -> Install CA Certificate
-
Select the copied CA Certificate and press Open
-
Rightclick the Servername and select All Tasks -> Start Service
Setup Group Policy
The CA Servers are now configured. Now the domain computers/servers need to trust the certificates which are created by the Subordinate Server. This is done by adding the Root CA certificate to the “Trusted Root Certification Authorities” store. The certificate can be added in multiple ways, but the easiest way is by adding it with a Group Policy. In this example a separate policy is created on the Domain Controller in the root of the domain. This is not required but just an example on how it’s possible.
-
Open Group Policy Management
-
Expand Group Policy Management > Forest: > Domains and Rightclick your domain. Select Create a GPO in this domain, and link it here…
-
Enter a name for the policy for example Root CA Distribution policy and press OK
-
Select the created policy and press Edit
-
Go to: Computer Configuration > Policies > Windows Settings > Security Settings > Public Key Policies and Rightclick Trusted Root Certification Authorities and select Import
-
Press Next to continue
-
Press Browse
-
Browse to
<subordinate-ca>\c$\inetpub\wwwroot\CertEnroll
and select the RootCA certificate. Press Open to continue -
Press Next to continue
-
Use the default settings and press Next
-
Press Finish to import the Root CA Certificate.
-
After some time when the import has finished a popup will appear. Press OK to continue The Root CA Certificate is now distributed to all domain devices.
Deploy Policy Templates
After Setting up an Enterprise CA some Certificate policies are available without additional configuration. In this post I will demonstrate how to add Certificate Template and publish it.
Deploy Policy Templates
-
On the Subordinate CA start the Certification Authority and select Certificate Templates. In the right pane all the out of the box templates are visible. These can be requested by Users, Computers, etc depending on the type.
-
To add a new template rightclick Certificat Templates and select Manage
-
An overview with all available templates will appear.
-
To avoid editing the original template Right click the template and select Duplicate Template
-
Give the new template a unique name and press OK
-
Rightclick Certificat Templates and select New > Certificate Template to Issue
-
Select in the Enable Certificate Templates list the template which was created and press OK
-
The certificate is now visible in the Certificate Templates Pane
Test the certificate
-
Logon to a domain joined computer. Start MMC and select file > Add/Remove Snap-in.
-
Select the Certificates snap-in and press Add.
-
Select My user account in the Certificates snap-in popup and press Finish. Press OK to close the snap-in manager. (Only select my user account for user templates, for computer related templates select Computer account)
-
Right click Personal and select All Tasks > Request New Certificate
-
Press Next
-
Press Next (by default Active Directory Enrollment Policy is selected)
-
In the Request Certificates overview all available user related policy templates are displayed. The created template should appear. Check the box of the created template and press Enroll
-
The template will be requested. After a while the status should be Succeeded. Press Finish to continue.
-
The new certificate is now visible.
-
When you double click the Certificate and select Certification Path you should see the RootCA, SubordinateCA and requested Certificate. All Certificates should be OK
This was the final post of the Setup Server 2019 Enterprise CA tutorial.