Manual Chapter :
Managing External HSM Keys for LTM
Applies To:
Show VersionsBIG-IP APM
- 17.1.1, 17.1.0, 17.0.0, 16.1.5, 16.1.4, 16.1.3, 16.1.2, 16.1.1, 16.1.0, 16.0.1, 16.0.0
BIG-IP LTM
- 17.1.1, 17.1.0, 17.0.0, 16.1.5, 16.1.4, 16.1.3, 16.1.2, 16.1.1, 16.1.0, 16.0.1, 16.0.0
BIG-IP AFM
- 17.1.1, 17.1.0, 17.0.0, 16.1.5, 16.1.4, 16.1.3, 16.1.2, 16.1.1, 16.1.0, 16.0.1, 16.0.0
BIG-IP DNS
- 17.1.1, 17.1.0, 17.0.0, 16.1.5, 16.1.4, 16.1.3, 16.1.2, 16.1.1, 16.1.0, 16.0.1, 16.0.0
BIG-IP ASM
- 17.1.1, 17.1.0, 17.0.0, 16.1.5, 16.1.4, 16.1.3, 16.1.2, 16.1.1, 16.1.0, 16.0.1, 16.0.0
Managing External HSM Keys for LTM
Overview: Managing external HSM keys for LTM
You can use the nShield to store and manage token-, module-, and
softcard-protected keys.
For additional information about using nShield, refer to
the nShield website: (hsm).
About key
protection
There are three types of key protection available for use with the
BIG-IP system and nShield:
- Module-protected keysare directly protected by the external HSM through the security world and can be used at any time without further authorization.
- Softcard-protected keysare protected by a softcard and can be used by only an operator who possesses the assigned passphrases.
- Token-protected keysare protected by a cardset and can be used by only an operator who possesses the Operator Card Set (OCS) token and any assigned passphrases.
All options are equally secure, and the main difference is the
authorization requirement. As a general rule, if you have no particular security or
regulatory requirement, you can default to module protection. nShield prefers the use of
physical tokens for authorization. In the case of Operator Cards, nShield recommends
making a 1/N card set, where N is greater than the total number of nShields. For more
information about card sets, refer to the nShield user guides.
Configuring the key
protection type
On the BIG-IP system, you can choose among the nShield-supported types of key
protection: module, softcard, and OCS. By default, the installation script sets up
the appliance to create and use module-protected keys. F5 recommends that you keep
only one set of cardset files (cards* or softcard*) in the
$NFAST_KMDATA/local
directory.In this
release, only one type of key protection (PKCS#11 slot) can be configured for active
use. You need to configure the key protection type for a slot by enabling the type
you want, and disabling the others.
- Log in to the command-line interface of the BIG-IP system using an account with administrator privileges.
- Complete one of these steps, depending on your preferred key protection option:moduleThe module-protected key option is enabled by default. To enable this protection type, no further action is required, and you can proceed to the next section.OCS
- Disable softcard key protection by moving any previously createdsoftcard*files from the/opt/nfast/kmdata/localdirectory to the/opt/nfast/kmdata/directory.
- Enable OCS key protection by creating the OCS cardset using the nShield-providedcreateocsutility.
softcard- Disable OCS key protection by moving any previously createdcards*files from the/opt/nfast/kmdata/localdirectory to the/opt/nfast/kmdatadirectory.
- Enable softcard key protection by creating the softcard cardset using the nShield-providedppmkutility.
The softcard passphrase used in theppmkcommand must match the passphrase used for setting up the nShield client on the BIG-IP system (used in the commandtmsh create/modify sys crypto fips external-hsm password <).password>If OCS is configured with a passphrase for nShield HSM, the user must enter it when prompted fornShield HSM slot password, even if the user only wants to use module keys.To revert back to module protection, changeCKNFAST_NO_ACCELERATOR_SLOTS=1toCKNFAST_NO_ACCELERATOR_SLOTS=0and remove any softcard or OCS files out of/opt/nfast/kmdata/local. - After you make any configuration changes, you must restart thepkcs11andtmmservices.tmsh restart sys service pkcs11d tmsh restart sys service tmm
Generating a key/certificate using
tmsh
You can use the Traffic Management
Shell (
tmsh
) to
generate a key and certificate.- Log in to the command-line interface of the system using an account with administrator privileges.
- Open the TMOS Shell (tmsh).tmsh
- Generate the key.create sys crypto key<key_name>gen-certificate common-name<cert_name>security-type nethsmThis example generates an external HSM key namedtest_keyand a certificate namedtest_nshield.comwith the security type ofnethsm:create sys crypto key test_key gen-certificate common-name test_nshield.com security-type nethsm
- Verify that the key was created.list sys crypto key test_key.keyInformation about the key displays:sys crypto key test_key.key { key-id <32-digit string> key-size 2048 key-type rsa-private security-type nethsm }
When you generate a key/certificate
using
tmsh
, the system
creates a HSM private key. It also creates a local key, which points to the HSM key,
residing in the HSM.Creating a self-signed digital certificate
If you are configuring the BIG-IP system to manage client-side HTTP traffic, you perform this
task to create a self-signed certificate to authenticate and secure the client-side HTTP
traffic. If you are also configuring the system to manage server-side HTTP traffic, you
must repeat this task to create a second self-signed certificate to authenticate and
secure the server-side HTTP traffic.
- On the Main tab, click.The Traffic Certificate Management screen opens.
- ClickCreate.
- In theNamefield, type a unique name for the SSL certificate.
- From theIssuerlist, selectSelf.
- In theCommon Namefield, type a name.This is typically the name of a web site, such aswww.siterequest.com.
- In theDivisionfield, type your department name.
- In theOrganizationfield, type your company name.
- In theLocalityfield, type your city name.
- In the orState or Provincefield, type your state or province name.
- From theCountrylist, select the name of your country.
- In theE-mail Addressfield, type your email address.
- In theLifetimefield, type a number of days, or retain the default,365.
- In theSubject Alternative Namefield, type a name.This name is embedded in the certificate for X509 extension purposes.By assigning this name, you can protect multiple host names with a single SSL certificate.
- From theSecurity Typelist, selectNetHSM.
- From theKey Typelist,RSAis selected as the default key type.
- From theSizelist, select a size, in bits.
- ClickFinished.
Requesting a certificate from a certificate authority
You perform this task to generate a certificate signing request (CSR) that can then be submitted to a third-party trusted certificate authority (CA).
F5 Networks recommends that you consult the CA to determine the specific information required for each step in this task.
- On the Main tab, click.The Traffic Certificate Management screen opens.
- ClickCreate.
- In theNamefield, type a unique name for the SSL certificate.
- From theIssuerlist, selectCertificate Authority.
- In theCommon Namefield, type a name.This is typically the name of a web site, such aswww.siterequest.com.
- In theDivisionfield, type your department name.
- In theOrganizationfield, type your company name.
- In theLocalityfield, type your city name.
- In the orState or Provincefield, type your state or province name.
- From theCountrylist, select the name of your country.
- In theE-mail Addressfield, type your email address.
- In theLifetimefield, type a number of days, or retain the default,365.
- In theSubject Alternative Namefield, type a name.This name is embedded in the certificate for X509 extension purposes.By assigning this name, you can protect multiple host names with a single SSL certificate.
- In theChallenge Passwordfield, type a password.
- In theConfirm Passwordfield, re-type the password you typed in theChallenge Passwordfield.
- From theSecurity Typelist, selectNetHSM.
- From theKey Typelist,RSAis selected as the default key type.
- From theSizelist, select a size, in bits.
- ClickFinished.The Certificate Signing Request screen displays.
- Do one of the following to download the request into a file on your system.
- In theRequest Textfield, copy the certificate.
- ForRequest File, click the button.
- Follow the instructions on the relevant certificate authority web site for either pasting the copied request or attaching the generated request file.
- ClickFinished.The Certificate Signing Request screen displays.
The generated certificate signing request is submitted to a trusted certificate
authority for signature.
Deleting a key from the BIG-IP
You perform this task to delete an
existing key from the BIG-IP.
- On the Main tab, click.The Traffic Certificate Management screen opens.
- From theSSL Certificate List, select the check box next to the key you wish to delete.
- ClickDelete.
The key you selected is deleted from
BIG-IP.
The key stored in NetHSM is
not deleted.
Creating a client
SSL profile to use an external HSM key and certificate
After you have added the external HSM key and
certificate to the BIG-IP system configuration, you can use the key and certificate as
part of a client SSL profile. This task describes using the browser interface.
Alternatively, you can use the Traffic Management Shell (
tmsh
) command-line utility.- On the Main tab, click.The Client screen opens.
- ClickCreate.The New Client SSL Profile screen opens.
- In theNamefield, type a name for the profile.
- From theParent Profilelist, selectclientssl.
- From theConfigurationlist, selectAdvanced.This selection makes it possible for you to modify additional default settings.
- For the Configuration area, select theCustomcheck box.The settings in the Configuration area become available for modification.
- Using theCertificate Key Chainsetting, specify one or more certificate key chains:
- From theCertificatelist, select the name of a certificate that you imported.
- From theKeylist, select the name of the key that you imported.
- From theChainlist, select the chain that you want to include in the certificate key chain.
- ClickAdd.
- ClickFinished.
After you have created the client SSL profile, you
must assign the profile to a virtual server, so that the virtual server can process SSL
traffic according to the specified profile settings.
Migrating existing software-protected or unprotected keys to the
nShield HSM
Before you begin this task, make sure that the nShield
client is installed and configured on the BIG-IP system.
If you
already have regular RSA keys, you can migrate them to the nShield HSM.
A nShield HSM device that is configured with the
Strict FIPS 140-2 Level 3
compliance flag prevents importation of extraneous private keys.- Log in to the command-line interface of the system using an account with administrator privileges.
- Migrate the key.fipskey.nethsm --export -i <input_key_full_path_filename> -o output_key_filenameThis example generates the four files that follow:fipskey.nethsm --export -i regular_key -o hsm_key
- /config/ssl/ssl.key/hsm_key.key(local key)
- /config/ssl/ssl.csr/hsm_key.csr(CSR file)
- /config/ssl/ssl.crt/hsm_key.crt(self-signed certificate)
- /opt/nfast/kmdata/local/(protected key)protected_key_filename
If you migrated a key that has a certificate that is
already issued by a reputable issuing CA, you should migrate the key, but continue using
the old certificate. After you migrate the existing key to the nShield HSM, you must
load the key into the BIG-IP system using
tmsh
, and then modify the client SSL profile, or create a new client SSL
profile that uses the new key and the existing certificate.Importing existing SSL keys into nShield device for use by the BIG-IP
system
You
import existing SSL keys when you have pre-existing keys you want the BIG-IP system to
use. You need to perform these steps for each key you want to import into the nShield
system.
- Log in to the command-line interface of the system using an account with administrator privileges.
- Copy certificate(s) and key(s) you want to import onto the BIG-IP system and place them in the/var/tmpdirectory on the BIG-IP system./var/tmp/user.key/var/tmp/user.crt
- Ensure adequate permissions are set so that other users on the system are not able to view the.keyfiles copied.chmod 600 /var/tmp/user.key
- Import the key into nShield external HSM using thegeneratekeyutility./opt/nfast/bin/generatekey --import pkcs11 certreq=yesThe system interactively prompts you for information.
- When prompted to enter the name of the PEM file that contains the RSA key, enter the full path to the key copied to the BIG-IP system (pemreadfile).For example,/var/tmp/user.key.
- When prompted to enter the file name where the key will be written, enter the full path to the pseudo key (embedsavefile).This is the pseudo key required by BIG-IP system.For example,/var/tmp/imported_user.key.
- When prompted to enter the key name, type a name for the key (plainname).This is the name with which the key is associated in the nShield RFS. No path is required, asplainnameis not written to a file on disk.For example,userkey.When the key import is complete, thegeneratekeyutility will generate two files.
- imported_user.key
- imported_user_req
- Modify the ownership and permissions of the key you created. After successful import, take note of the path to key to modify ownership.chown nfast:nfast /opt/nfast/kmdata/local/key_pkcs11_uced028e5251b7b6891e7e59dec5428d871f92241b-c70e6451e8d793ca80a497267ccb9bc73bd55edbchmod 755 /opt/nfast/kmdata/local/key_pkcs11_uced028e5251b7b6891e7e59dec5428d871f92241b-c70e6451e8d793ca80a497267ccb9bc73bd55edbIf this step is omitted, you might see permission errors when runningrfs-sync.
- Sync the nShield generated pseudo-key (embedsavefile) to the RFS.[root@hostname:Active:Standalone] tmp # rfs-sync --update[root@hostname:Active:Standalone] tmp # rfs-sync --commitIf the BIG-IP system this procedure is performed on is also the RFS, therfs-synccommands above will report0 committed. This is expected behavior, as the keys imported are automatically stored in the RFS directory.
- Import the pseudo key and SSL certificate usingtmshfor use by BIG-IP client SSL profile using this syntax:tmsh install sys crypto key [name] from-local-file [/path/to/pseudo_key.key]tmsh install sys crypto cert [name] from-local-file [/path/to/real_certificate.crt]For example:tmsh install sys crypto key import.key from-local-file /var/tmp/imported_user.keytmsh install sys crypto cert import.crt from-local-file /var/tmp/user.crt
- Save the configuration.tmsh save sys configIf you need to import more SSL certificates and keys, repeat all preceding steps for each certificate and key pair.
- Create an SSL profile that references the above key and certificate.
- Create a virtual server that uses the above SSL profile (or assign to an existing virtual server).
- Verify that the virtual server passes traffic correctly.
- You can safely remove the certificates and keys from/var/tmpdirectory used in this procedure as they are no longer required by the BIG-IP system.Once the pseudo key has been installed withtmsh, the copy in/var/tmpis no longer used.Unless the SSL key file is deleted in a secure manner, it might be possible for someone to recover the file from the disk. Consider using theshredutility (typeman shredat the command line for details) to delete any key files copied to the BIG-IP system once they have been successfully imported into the nShield device.When you create a new nShield key for BIG-IP HA, you must run the commandrfs-sync --updateon all standby BIG-IP devices to update the local nShield encrypted file object cache. Without this action, SSL traffic using this key will fail when BIG-IP fails over to one of the unsynced standby devices.
Importing a pre-existing NetHSM key to the BIG-IP
- On the Main tab, click.The SSL Certificate/Key Source page opens.
- WithinImport Type, selectKey.The key name should be the same as the NetHSM key label.
- WithinKey Name, selectOverwrite Existingand from the drop-down menu, select the key you would like to overwrite.
- Within Key Source, selectFrom NetHSM.For this option to be available, the system must have External HSM licensed, and either SafeNet/nShield External HSM configured.
- ClickImport.
You can also import an existing key by using tmsh commands
tmsh install sys
crypto key nethsm_key_label from-nethsm security-type
or tmsh
install sys crypto key nethsm_key_label from-nethsm
. Use the NetHSM key label as the key name. For example:root@(hostname)(Standalone)(Active)(/Common)(tmos)# install sys crypto key nethsm_key_label (tab) Options: from-editor from-nethsm Properties: from-local-file from-url root@(ssl8519)(cfg-sync Standalone)(Active)(/Common)(tmos)# install sys crypto key nethsm_key_label from-nethsm security-type nethsm