Microsoft IIS: nShield HSM Integration Guide
Table of Contents
- Introduction
- Procedures
Introduction
Microsoft Internet Information Services (IIS) for Windows Server is a Web server application. nShield Hardware Security Modules (HSMs) integrate with IIS 10.0 to provide full key life-cycle management with FIPS-certified hardware and to reduce the cryptographic load on the host server CPU. Integration of the nShield HSM with IIS 10.0 provides the following benefits:
-
Uses hardware validated to the FIPS 140-3 standards
-
Improves server performance by offloading cryptographic processing
-
Enables secure storage of the IIS keys
-
Enables management of the full life cycle of the keys
Product configuration
We have successfully tested the nShield HSM integration with IIS in the following configuration:
Product | Version |
---|---|
Operating System |
Windows 2019 Server |
IIS version |
10.0 |
Supported nShield features
We have successfully tested nShield HSM integration with the following features:
Feature | Support |
---|---|
Softcards |
No |
Module-only key |
Yes |
OCS cards |
Yes |
Supported nShield hardware and software versions
We have successfully tested with the following nShield hardware and software versions:
Connect XC
Security World Software | Firmware | Image | OCS | Softcard | Module |
---|---|---|---|---|---|
12.60.11 |
12.50.11 |
12.60.10 |
✓ |
✓ |
Connect +
Security World Software | Firmware | Image | OCS | Softcard | Module |
---|---|---|---|---|---|
12.60.11 |
12.50.8 |
12.60.10 |
✓ |
✓ |
Requirements
Before installing the software, we recommend that you familiarize yourself with the IIS documentation and setup process, and that you have the nShield documentation available. We also recommend that there is an agreed organizational Certificate Practices Statement and a Security Policy/Procedure in place covering administration of the HSM. In particular, these documents should specify the following aspects of HSM administration:
-
The number and quorum of Administrator Cards in the Administrator Card Set (ACS), and the policy for managing these cards
-
Whether the application keys are protected by the HSM module key or an Operator Card Set (OCS) protection
-
Whether the Security World should be compliant with FIPS 140-2 Level 3
-
Key attributes such as the key algorithm, key length and key usage.
For more information, see the User Guide for the HSM.
Procedures
Integration procedures include:
-
Installing the nShield HSM.
-
Installing the Security World Software, and configuring the Security World.
-
Installing IIS.
-
Install and register the CNG provider
-
Creating a certificate request
-
Getting the signed certificate
-
Installing the certificate.
-
Integrate an nShield HSM with an existing IIS deployment
Install the nShield HSM
Install the HSM and Security World software using the instructions in the Installation Guide for the HSM. We recommend that you do this before installing and configuring IIS.
Install the Security World Software and configure the Security World
-
Install the latest version of the Security World Software as described in the User Guide for the HSM.
-
Initialize a Security World as described in the User Guide for the HSM.
You can also use the CNG Configuration Wizard to create a Security World. If you are using an OCS, to adhere to IIS requirements it must be a 1-of-N with no passphrase, where N is the number of cards in the set.
Install IIS
To install Microsoft Internet Information Services:
-
Open Server Manager by selecting Start > Server Manager .
-
Select Manage and then select Add Roles and Features .
-
On the Before you begin screen, select Next .
-
On the Select installation type screen, ensure the default selection of Role or Feature Based Installation is selected and select Next .
-
On the Server Selection screen, select a server from the server pool and select Next .
-
On the Select server roles screen, select the Web Server (IIS) Role and select Next
-
When prompted to install Remote Server Administration Tools, select Add Features and select Next .
-
On the Select features screen, keep the default selection and select Next .
-
On the Web Server Role (IIS) screen, select Next .
-
On the Select Role Service screen, select Next .
-
On the confirmation screen, select Install .
-
Once the installation completes, Select Close .
Install and register the CNG provider
-
Open a command window as administrator and type the following to put the HSM in
pre-initialization
mode. This operation takes about a minute to complete.>enquiry -m 1 Module #1: enquiry reply flags none enquiry reply level Six serial number BD10-03E0-D947 mode operational ... >nopclearfail -I -m 1 Module 1, command ClearUnitEx: OK >enquiry -m 1 Module #1: enquiry reply flags none enquiry reply level Six serial number BD10-03E0-D947 mode pre-initialization ...
-
Select the Start button to access all applications. Look for the recently installed nShield utilities.
-
Double-click the CNG configuration wizard and run it as Administrator.
-
Select Next on the CNG Install welcome screen.
-
Select Next on the Enable HSM Pool Mode screen. Leave the Enable HSM Pool Mode for CNG Providers check box un-checked.
-
At the Security World screen, select:
-
Use the existing security world if you already have a Security World that you intend to use for Always Encrypted. The corresponding
world
andmodule_xxxx-xxxx-xxxx
files most be present in the%NFAST_KMDATA%\local
folder. Be prepared to present the quorum of Administrator cards. -
Create a new Security World if you do not currently have a Security World or would like to create a new Security World.
In this integration, we used an existing Security World. For instructions on how to create and configure a new Security World, see the Installation Guide and User Guide for your HSM.
Select Next .
-
-
The Set Module States pop-up shows the available HSM(s). Select the desired HSM. The state of the selected HSM should be
(pre-)initialisation
. Select Next . -
At the Module Programming Options screen, clear Enable this module as a remote target and select Next . It will take about a minute before the screen changes.
NotePlease be aware that this is not to be confused with the nShield Remote Administration utility. -
Insert the first Administrator Card in the HSM, enter the passphrase and select Next . Repeat this step for the other Administrator Cards as required.
Loading or creating the Security World takes about a minute.
-
Return the HSM to
Operational
mode.This operation takes about a minute to complete.
>enquiry -m 1 Module #1: enquiry reply flags none enquiry reply level Six serial number BD10-03E0-D947 mode initialization ... >nopclearfail -O -m 1 Module 1, command ClearUnitEx: OK C:\Windows\system32>enquiry -m 1 Module #1: enquiry reply flags none enquiry reply level Six serial number BD10-03E0-D947 mode operational ...
The module state will change to
Usable
.Select Next .
-
Select the protection method.
NoteDue to limitations of IIS itself, any OCS protection must be passphrase-less 1/n quorum, and any softcard protection is not supported. For this reason, use only OCS or module protection. -
Operator Card Set protection
-
Select Operator Card Set in the Key Protection Setup , then select Next .
-
Enter the OCS name, K of N values, select Persistent and Usable remotely , then select Next .
-
Insert a blank Operator Card in the HSM.
-
In Insert Next Card , enter a name to for the OCS card. Leave the Card requires a pass phrase checkbox unchecked as OCS protection must be passphrase-less, then select Next .
-
-
Module protection
-
In Key Protection Setup , select Module protection , then select Next .
-
Select Next and Finish .
-
The nShield CNG providers are installed and the key Storage Provider is registered.
-
-
Open a command window as administrator and type the following to confirm that the KSP has been successfully registered. Look for nCipher Security World Key Storage Provider .
> cnglist.exe --list-providers Microsoft Key Protection Provider Microsoft Passport Key Storage Provider Microsoft Platform Crypto Provider Microsoft Primitive Provider Microsoft Smart Card Key Storage Provider Microsoft Software Key Storage Provider Microsoft SSL Protocol Provider Windows Client Key Protection Provider nCipher Primitive Provider nCipher Security World Key Storage Provider
-
Check the registry in
CNGRegistry
:HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Cryptography\Providers\nCipherSecurityWorldKeyStorageProvider
Create a certificate request
IIS Manager does not support the creation of certificates protected by CNG Keys and these need to be created using the Microsoft command line utilities. Commands executed in this section are run on a PowerShell in Windows.
Note
|
Due to limitations of IIS itself, no GUI prompts (even via nShield Service Agent) can be displayed, so any OCS protection must be passphrase-less 1/n quorum. For this reason, use only OCS or module protection. |
Complete the following steps to create a certificate request:
-
To make sure the nCipher Primitive Provider and nCipher Security World Key Storage Providers are listed, run:
% cnglist.exe --list-providers Microsoft Key Protection Provider Microsoft Passport Key Storage Provider Microsoft Platform Crypto Provider Microsoft Primitive Provider Microsoft Smart Card Key Storage Provider Microsoft Software Key Storage Provider Microsoft SSL Protocol Provider Windows Client Key Protection Provider nCipher Primitive Provider nCipher Security World Key Storage Provider
NoteIf the nCipher Primitive Provider
andnCipher Security World Key Storage Provider
are not listed, please follow the steps in theInstall and register the CNG provider
section. -
Set up a template file:
-
Generate a request for an SSL certificate linked to a 2K RSA key by creating a file called
request.inf
with the following information:[Version] Signature= "$Windows NT$" [NewRequest] Subject = "CN=interop.com,C=US,ST=Florida,L=Sunrise,O=InteropCom,OU=WebServer" HashAlgorithm = SHA256 KeyAlgorithm = RSA KeyLength = 2048 ProviderName = "nCipher Security World Key Storage Provider" KeyUsage = 0xf0 MachineKeySet = True [EnhancedKeyUsageExtension] OID = 1.3.6.1.5.5.7.3.1
Your
request.inf
file does not have to contain exactly the code given above. This is an example, not a definitive model. -
Specify the subject details of the Domain Controller which is issuing the certificate.
-
Specify the key algorithm and key length as required, for example RSA 2048.
-
Specify the Provider name as nCipher Security World Key Storage Provider .
-
When you have set up the template successfully, save it as
request.inf
on theC:\
drive.
-
-
Open a command prompt and go to the local drive, in this case
C:\
. -
To create the certificate request for the Certification Authority, execute the command:
% certreq.exe -new request.inf IISCertRequest.csr CertReq: Request Created
A certificate request called
IISCertRequest.csr
is generated and placed on theC:\
drive. This file is used to be sent to a Certificate Authority.
Get the signed certificate
-
Submit the CSR file to a CA such as VeriSign, Entrust, and so on.
-
The CA authenticates the request and returns a signed certificate or a certificate chain.
-
Save the reply from the CA in the current working directory.
In this guide the signed certificate file is
IISCertRequest.cer
.
Install the certificate
Make the certificate available to be used in IIS and bind the certificate with the https settings in IIS.
Commands used in this section are run from a Windows PowerShell.
Make the certificate available for use in IIS
To make the certificate available for use in IIS, run the following command:
% certreq --accept IISCertRequest.cer
Where
IISCertRequest.cer
is the binary certificate exported from the CA.
Running this command makes the CA certificate trusted on the Web Server.
Installed Certificate:
Serial Number: 67790b108e551446903d999aabeaaf5e003fb66f
Subject: C=US, CN=Hostname
NotBefore: 6/22/2021 1:22 PM
NotAfter: 6/22/2022 1:22 PM
Thumbprint: cd3135f897ab0b44dfe6f451bcd63076ed4228e8
Bind the certificate with a secure IIS web server
-
Go to Start > Internet Information Service Manager .
-
Select the hostname, then double-click Server Certificates and verify the certificate you accepted in the previous step is listed.
-
Click Default website under Sites on the left-hand side of the IIS Manager screen.
-
Select Bindings link on the right-hand side of the IIS Manager.
-
On the Site Bindings screen, select Add if the https protocol is not listed, but if it is, select it.
-
If you have to add it select the protocol as HTTPS and select the certificate from the list.
If you are editing the settings, select the certificate from the list.
-
Select OK to complete the certificate binding for SSL connection.
-
Select Close on the Site Bindings screen.
-
Restart the IIS server.
-
Open the browser and type
https://machinename:443
. -
Accept the certificate on the browser to continue with SSL connection with IIS server.
Integrate an nShield HSM with an existing IIS deployment
This section describes how to upgrade an existing IIS server installation to use an nShield HSM to protect the private key. It is assumed that the existing certificate must continue to be used by the server after the Prerequisites to integrate are:
-
An IIS setup with software-protected certificate and private key
-
nShield Software installed and a Security World created using The CNG Configuration Wizard, or the front panel of an nShield Connect
Export the software-protected certificate
Complete the following procedure to export the software-protected certificate:
-
Type
MMC
at the command prompt and select OK .The Microsoft Management Console opens.
-
On the initial screen, select File > Add/Remove Snap-in and select Add .
-
Select Certificates from Available Standalone Snap-ins and select Add .
-
On the Certificates snap-in screen, select Computer account and select Next .
-
On the Select Computer screen, select Local computer , select Finish then OK .
-
Navigate to the Certificates directory ( Certificates (Local Computer) > Personal > Certificates ).
-
Right-select the certificate file and select All Tasks > Export .
-
The Welcome to the Certificate Export Wizard screen appears. Select Next .
-
On the Export Private Key screen, select No, do not export the private key and select Next .
-
On the Export File Format screen, select Base-64 encoded X.509 (.Cer) and select Next .
-
On the File to Export screen, select an absolute path and filename to save the exported Certificate.
Select Next .
-
The Completing the Certificate Export Wizard screen appears.
Select Finish .
-
After exporting the certificate, delete the certificate from the certificate store.
Import a Microsoft CAPI key into the nCipher Security World Key Storage Provider
To import a Microsoft CAPI key into the nCipher Security World Key Storage Provider:
-
Navigate to the
C:\Program Files (x86)\nCipher\nfast\bin
folder and runcngimport.exe
:C:\Program Files (x86)\nCipher\nfast\bin\cngimport -m -M -k "MS CAPI key" "imp_key_name"
The Microsoft CNG key is in the
C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys
folder.Example:
C:\Program Files (x86)\nCipher\nfast\bin\cngimport -m -M -k "48753e97af4e829f_b2885b-321a-42b9-9122-81d377654436" "Importedkeyname"
-
To check the success of the import, list the keys in the Security World:
C:\Program Files (x86)\nCipher\nfast\bin\cnglist64.exe --list-key Importedkeyname: RSA machine
Import a certificate into the certificate store
-
Go to the command prompt and type
MMC
, then select OK to open the Microsoft Management Console. -
On the initial screen, select File > Add/Remove Snap-in and select Add .
-
From Available Standalone Snap-ins , select Certificates and select Add .
-
On the Certificates snap-in screen, select Computer account and select Next .
-
On the Select Computer screen, select Local computer , select Finish and select OK .
-
Navigate to the Certificates directory ( Certificates (Local Computer) > Personal > Certificates ).
-
Right-select the certificate folder and select All Tasks > Import .
-
The Welcome to the Certificate Import Wizard screen appears. Select Next .
-
Navigate to the location of the certificate from the Origin Server and select Next .
-
On the Certificate Store screen, select Place all certificates in the following store .
-
Make sure that the default selection in Certificate Store is Personal , then select Next .
-
The Completing the Certificate Import Wizard screen appears.
Select Next , then select OK .
-
Run the following command from the Windows terminal:
C:\Program Files (x86)\nCipher\nfast\bin>certutil -f -csp "nCipher Security World Key Storage Provider" -repairstore my <serial number of certificate>
-
Open the IIS Manager from Start > Internet Information Services (IIS) Manager .
-
Under Sites on the left-hand side of the IIS Manager screen, select the required web site.
-
On the right-hand side of the IIS Manager screen, select Bindings .
-
On the Site Bindings screen, select Add .
-
Select the protocol HTTPS .
-
Select the certificate from the drop-down list.
-
To complete the certificate binding for SSL connection, select OK .
-
Open the browser and type
https://machinename:443
.If necessary, accept the certificate in the browser to continue with SSL connection to the IIS Web Server.
-
Integration GuideMicrosoft IIS nShield HSM Integration Guide
-
ProductsnShield Connect
-
ProductsnShield as a Service