Introduction
This article describes how to migrate a private key from an existing Microsoft Active Directory Certificate Services (AD CS) Certificate Authority (CA) to Fortanix Data Security Manager (DSM).
Prerequisites
This document assumes that the following features are already enabled and in use:
- Microsoft Domain Name System (DNS) server role must be enabled and configured for the server.
- Microsoft ADCS server role must be enabled, and the CA must be configured.
Back-Up Existing CA Certificates
Check the certificates that are issued by the existing Windows CA server. The following figure shows there are five certificates that the CA server has issued so far. Figure 1: Windows CA server certificates
Back up the existing CA certificate using the following steps:
- On the Windows Server where Microsoft AD CS role is installed:
- Go to Start.
- Find and run
certsrv.msc
. - Press Enter to open the Certification Authority window.
Figure 2: Certificate authority
- Right-click the CA and in the menu select All Tasks -> Back up CA…
Figure 3: Back up CA
- In the Certification Authority Backup Wizard, click Next to choose a location to save the certificate and database.
Figure 4: CA backup wizard
- Select the check boxes “Private key and CA certificate” and “Certificate database and certificate database log”.
Figure 5: CA backup wizard
- Click Next to set the password for the private key. Click Next again and then click Finish. Now the certificate and database backup will be available in the backup location.
Export the Certificate and Remove it from Trusted Root CA
In this section, you will learn how to export the CA certificate and remove the AD CS role from the server.
View the Certificates of the Local Computer
- Go to Start.
- Find and run
mmc
. Press Enter.Figure 6: Run MMC
- In the Console window that opens, click the File menu, and select Add/Remove Snap-in.
Figure 7: Add snap-in
- From the Available snap-ins section, select Certificates and click Add to configure the certificate.
Figure 8: Configure certificate
- In the Certificates snap-in window, select Computer account and click Next.
Figure 9: Manage certificate for computer account
- In the Select Computer window, select Local computer that the snap-in will manage. Click Finish.
Figure 10: Select computer
- Click Ok to close the window.
Figure 11: Certificate snap-in configured
- Now you will see all the certificates of the local computer.
Figure 12: Certificates of local computer
Export the Certificate
- Under the Console Root folder in the left panel, click the folder Trusted Root Certification Authorities and click the Certificates folder on the right.
Figure 13: Trusted root CA certificates
- From the available certificates, right-click the fortanix-server-CA certificate, and in the menu go to All Tasks and click Export to export the certificate to a local folder. Remove it from the Trusted Root Certification Authorities folder.
Figure 14: Export certificate
- Under the Console Root folder in the left panel, select the Personal folder, and delete any available certificates.
Remove AD CS Role from the Server
- To remove the AD CS role:
- Go to Server Manager Dashboard.
- In the top-right menu, click Manage and select Remove Roles and Features.
Figure 15: Remove roles and features
- In the Remove Roles and Features Wizard screen, select Server Roles in the left panel, and clear the checkbox for Active Directory Certificate Services to remove the AD CS role.
- Click Next in the following screens to remove the role and feature.
Figure 16: Remove AD CS
- Reboot the server.
Configure Certificate Authority
Import Key in Fortanix DSM
- Using the command prompt, open the folder where the private key was saved.
- Using OpenSSL command extract the CA key with
.p12
extension to.key
and thenrsa
with.pem
. - Log in to Fortanix DSM and create a group.
- Create an app with interface type CNG and make a note of the API key required for the next step.
- Create a security object and import the RSA key that was generated in step 2 above and click IMPORT.
Figure 17: Import CA
- Install Microsoft CNG Key Storage Provider by following the article here and run the following commands.
You will see activity logs similar to Figure 18.Figure 18: App authentication activity logs
Install X.509 Certificate in Local User Trusted Root CA Store
To install the X.509 certificate that was exported in Section 4.2 in the local user Trusted Root CA Store:
- Right-click the certificate and click Install.
- Click Next.
Figure 19: Install certificate
- Select Place all certificates in the following store and click Browse.
- Select Trusted Root Certification Authorities and click Ok.
Figure 20: Select certificate store
- Click Next.
- Click Finish.
- Click Ok to close the import success message.
- You will now see the certificate, that is,
fortanix-server-CA
has been successfully imported in the Trusted Root CA.
Install CA Certificate in the Personal Store
To install the certificate into your store:
- Run the following command from the command prompt terminal:
certutil -addstore my <certificate name>
Wherefortanix-server.CA
is the exported certificate in Base-64 encoded X.509 (.CER
) - Once you run the command above you can find the exported CA in the Personal Trust Store as shown in Figure 21.
Figure 21: CA installed in personal trust store
- You can find the cert serial number from the following command.
certutil -store my
- Now repair the certificate store by running the following command from the console.
certutil -f -repairstore -csp "Fortanix KMS CNG Provider" my "<cert serial number>"
- The repair operation will not be allowed because the private key is restricted to be exported from Fortanix DSM, protecting the key integrity.
Add AD CS Role to the Server
- Add the AD CS role to the server.
Figure 22: Add AD CS role
- Configure AD CS with the following settings:
- In the Private Key window, select Use existing private key and then select Select a certificate and use its associated private key.
Figure 23: Configure AD CS
- In the Private Key window, select Use existing private key and then select Select a certificate and use its associated private key.
- In the Existing Certificate window, the imported certificate is shown. Select the certificate and select Allow administrator interaction when the private key is accessed by the CA.
Figure 24: Configure AD CS
- In the Certificate Database window click Next.
- In the Confirmation window click Configure.
Figure 25: AD CS configuration
- When the CA installation is complete, click Close in the installation results window.
- You can find the CA configured.
Figure 26: CA configured
- Once the CA certificate is successfully configured, you can then check the Fortanix DSM Certificate logs.
Figure 27: Certificate logs
- To test the operation, request a certificate from a client machine.
Figure 28: Request a certificate
- We are using Certificate Enrollment Web service to request a certificate from a client machine, fill in all the details in the form and click Submit.
Figure 29: Request a certificate
- Once the certificate is issued, click Install this certificate.
Figure 30: Certificate issued
- Now go back to the CA server to see if the Certificate is issued. We need to use the mmc console again.
Figure 31: Certificate installed
Restore Issued Certificates
To restore certificates:
- Go to the Certificate Authority (CA) service and right-click the CA.
- In the menu that opens, click All Tasks -> Restore CA.
Figure 32: Restore CA
- In the Certification Authority Restore Wizard, click OK to stop the Active Directory Certificate Services.
Figure 33: Stop active directory certificate services
- Click Next.
Figure 34: CA restore wizard
- In the Items to Restore section, select Certificate database and certificate database log. Enter C:\ directory as the restore location. Click Next.
Figure 35: Items to restore
- Click Finish to close the wizard and being the restoration process.
Figure 36: Begin restoration
- The CA restoration is completed. Click Yes to start Active Directory Certificate Services.
Figure 37: Restoration complete
- The SubCA certificate is restored.
Figure 38: Certificate restored
Any previously issued certificates will be listed.
Comments
Please sign in to leave a comment.