8.2. 使用 HSM 安装子系统
8.2.1. 使用 nCipher nShield HSM 安装子系统
要安装使用 nCipher nShield HSM 的子系统实例,请按照以下步骤执行:
准备一个覆盖文件,对应于您的特定部署。以下
默认'hms.txt
文件是此类覆盖文件的示例:注意此文件仅充当一个 nCipher HSM 覆盖配置文件 示例,该文件可覆盖其他值,包括默认哈希算法。另外,根据
pkispawn
命令行中指定的子系统调用,将只使用 [CA]、[KRA]、[OCSP]、[TKS] 或 [TPS] 部分之一。例 8.1. 与 nCipher HSM 搭配使用的覆盖文件示例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Provide HSM parameters # Provide PKI-specific HSM token names # Provide PKI-specific passwords # Provide non-CA-specific passwords # ONLY required if specifying a non-default PKI instance name # ONLY required if specifying non-default PKI instance ports # ONLY required if specifying non-default 389 Directory Server ports # ONLY required if PKI is using a Security Domain on a remote system # ONLY required for PKI using an existing Security Domain # NOTE: pki_security_domain_password = pki_admin_password of CA Security Domain Instance ONLY required if specifying non-default PKI instance ports # Provide CA-specific HSM token names # ONLY required if 389 Directory Server for CA resides on a remote system # Provide KRA-specific HSM token names # ONLY required if 389 Directory Server for KRA resides on a remote system # Provide OCSP-specific HSM token names # ONLY required if 389 Directory Server for OCSP resides on a remote system # Provide TKS-specific HSM token names # ONLY required if 389 Directory Server for TKS resides on a remote system # Provide TPS-specific parameters # Provide TPS-specific HSM token names # ONLY required if 389 Directory Server for TPS resides on a remote system # ONLY required if TPS requires a CA on a remote machine # ONLY required if TPS requires a KRA # ONLY required if TPS requires a KRA on a remote machine # ONLY required if TPS requires a TKS on a remote machine #
############################################################################### ############################################################################### ############################################################################### ## ## ## EXAMPLE: Configuration File used to override ## ## '/usr/share/pki/server/etc/default.cfg' when using an nCipher ## ## Hardware Security Module (HSM): ## ## ## ## # modutil -dbdir . -list ## ## ## ## Listing of PKCS #11 Modules ## ## ----------------------------------------------------------- ## ## 1. NSS Internal PKCS #11 Module ## ## slots: 2 slots attached ## ## status: loaded ## ## ## ## slot: NSS Internal Cryptographic Services ## ## token: NSS Generic Crypto Services ## ## ## ## slot: NSS User Private Key and Certificate Services ## ## token: NSS Certificate DB ## ## ## ## 2. nfast ## ## library name: /opt/nfast/toolkits/pkcs11/libcknfast.so ## ## slots: 2 slots attached ## ## status: loaded ## ## ## ## slot: <serial_number> Rt1 ## ## token: accelerator ## ## ## ## slot: <serial_number> Rt1 slot 0 ## ## token: <HSM_token_name> ## ## ----------------------------------------------------------- ## ## ## ## ## ## Based on the example above, substitute all password values, ## ## as well as the following values: ## ## ## ## <hsm_libfile>=/opt/nfast/toolkits/pkcs11/libcknfast.so ## ## <hsm_modulename>=nfast ## ## <hsm_token_name>=NHSM6000 ## ## ## ############################################################################### ############################################################################### ############################################################################### [DEFAULT] ########################## # Provide HSM parameters # ########################## pki_hsm_enable=True pki_hsm_libfile=<hsm_libfile> pki_hsm_modulename=<hsm_modulename> pki_token_name=<hsm_token_name> pki_token_password=<pki_token_password> ######################################## # Provide PKI-specific HSM token names # ######################################## pki_audit_signing_token=<hsm_token_name> pki_ssl_server_token=<hsm_token_name> pki_subsystem_token=<hsm_token_name> ################################## # Provide PKI-specific passwords # ################################## pki_admin_password=<pki_admin_password> pki_client_pkcs12_password=<pki_client_pkcs12_password> pki_ds_password=<pki_ds_password> ##################################### # Provide non-CA-specific passwords # ##################################### pki_client_database_password=<pki_client_database_password> ############################################################### # ONLY required if specifying a non-default PKI instance name # ############################################################### #pki_instance_name=<pki_instance_name> ############################################################## # ONLY required if specifying non-default PKI instance ports # ############################################################## #pki_http_port=<pki_http_port> #pki_https_port=<pki_https_port> ###################################################################### # ONLY required if specifying non-default 389 Directory Server ports # ###################################################################### #pki_ds_ldap_port=<pki_ds_ldap_port> #pki_ds_ldaps_port=<pki_ds_ldaps_port> ###################################################################### # ONLY required if PKI is using a Security Domain on a remote system # ###################################################################### #pki_ca_hostname=<pki_ca_hostname> #pki_issuing_ca_hostname=<pki_issuing_ca_hostname> #pki_issuing_ca_https_port=<pki_issuing_ca_https_port> #pki_security_domain_hostname=<pki_security_domain_hostname> #pki_security_domain_https_port=<pki_security_domain_https_port> ########################################################### # ONLY required for PKI using an existing Security Domain # ########################################################### # NOTE: pki_security_domain_password = pki_admin_password # of CA Security Domain Instance #pki_security_domain_password=<pki_admin_password> [Tomcat] ############################################################## # ONLY required if specifying non-default PKI instance ports # ############################################################## #pki_ajp_port=<pki_ajp_port> #pki_tomcat_server_port=<pki_tomcat_server_port> [CA] ####################################### # Provide CA-specific HSM token names # ####################################### pki_ca_signing_token=<hsm_token_name> pki_ocsp_signing_token=<hsm_token_name> ########################################################################### # ONLY required if 389 Directory Server for CA resides on a remote system # ########################################################################### #pki_ds_hostname=<389 hostname> [KRA] ######################################## # Provide KRA-specific HSM token names # ######################################## pki_storage_token=<hsm_token_name> pki_transport_token=<hsm_token_name> ############################################################################ # ONLY required if 389 Directory Server for KRA resides on a remote system # ############################################################################ #pki_ds_hostname=<389 hostname> [OCSP] ######################################### # Provide OCSP-specific HSM token names # ######################################### pki_ocsp_signing_token=<hsm_token_name> ############################################################################# # ONLY required if 389 Directory Server for OCSP resides on a remote system # ############################################################################# #pki_ds_hostname=<389 hostname> [TKS] ######################################## # Provide TKS-specific HSM token names # ######################################## ############################################################################ # ONLY required if 389 Directory Server for TKS resides on a remote system # ############################################################################ #pki_ds_hostname=<389 hostname> [TPS] ################################### # Provide TPS-specific parameters # ################################### pki_authdb_basedn=<dnsdomainname where hostname.b.c.d is dc=b,dc=c,dc=d> ######################################## # Provide TPS-specific HSM token names # ######################################## ############################################################################ # ONLY required if 389 Directory Server for TPS resides on a remote system # ############################################################################ #pki_ds_hostname=<389 hostname> ########################################################## # ONLY required if TPS requires a CA on a remote machine # ########################################################## #pki_ca_uri=https://<pki_ca_hostname>:<pki_ca_https_port> ####################################### # ONLY required if TPS requires a KRA # ####################################### #pki_enable_server_side_keygen=True ########################################################### # ONLY required if TPS requires a KRA on a remote machine # ########################################################### #pki_kra_uri=https://<pki_kra_hostname>:<pki_kra_https_port> ########################################################### # ONLY required if TPS requires a TKS on a remote machine # ########################################################### #pki_tks_uri=https://<pki_tks_hostname>:<pki_tks_https_port>
使用配置文件,如 第 7.2.2.2 节 “两步安装” 所述。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pkispawn -s CA -f ./default_hsm.txt -vvv
# pkispawn -s CA -f ./default_hsm.txt -vvv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pkispawn -s KRA -f ./default_hsm.txt -vvv
# pkispawn -s KRA -f ./default_hsm.txt -vvv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pkispawn -s OCSP -f ./default_hsm.txt -vvv
# pkispawn -s OCSP -f ./default_hsm.txt -vvv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pkispawn -s TKS -f ./default_hsm.txt -vvv
# pkispawn -s TKS -f ./default_hsm.txt -vvv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pkispawn -s TPS -f ./default_hsm.txt -vvv
# pkispawn -s TPS -f ./default_hsm.txt -vvv
验证 HSM 是否包含以下证书:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow certutil -L -d /etc/pki/pki-tomcat/alias -h token -f token.pwd
$ certutil -L -d /etc/pki/pki-tomcat/alias -h token -f token.pwd Certificate Nickname Trust Attributes SSL,S/MIME,JAR/XPI token:ca_signing CTu,Cu,Cu token:ca_ocsp_signing u,u,u token:subsystem u,u,u token:ca_audit_signing u,u,Pu token:sslserver/pki.example.com u,u,u
8.2.2. 使用 Gemalto Safenet LunaSA HSM 安装子系统
要安装使用 Gemalto Safenet LunaSA HSM 的子系统实例,请按照 第 8.2.1 节 “使用 nCipher nShield HSM 安装子系统” 中详述的流程操作。覆盖文件应该与 例 8.1 “与 nCipher HSM 搭配使用的覆盖文件示例” 中提供的示例类似,这与特定部署相关的值不同。以下示例提供了一个 LunaSA 标头示例,它被替换为 nCipher 覆盖文件的标头,并用于 [DEFAULT], [Tomcat], [CA], [KRA], [OCSP], [TKS], [TKS], 和 [TPS] 部分。
例 8.2. LunaSA 覆盖文件标头的示例
############################################################################### ############################################################################### ############################################################################### ## ## ## EXAMPLE: Configuration File used to override ## ## '/usr/share/pki/server/etc/default.cfg' when using a LunaSA ## ## Hardware Security Module (HSM): ## ## ## ## # modutil -dbdir . -list ## ## ## ## Listing of PKCS #11 Modules ## ## ----------------------------------------------------------- ## ## 1. NSS Internal PKCS #11 Module ## ## slots: 2 slots attached ## ## status: loaded ## ## ## ## slot: NSS Internal Cryptographic Services ## ## token: NSS Generic Crypto Services ## ## ## ## slot: NSS User Private Key and Certificate Services ## ## token: NSS Certificate DB ## ## ## ## 2. lunasa ## ## library name: /usr/safenet/lunaclient/lib/libCryptoki2_64.so ## ## slots: 4 slots attached ## ## status: loaded ## ## ## ## slot: LunaNet Slot ## ## token: dev-intca ## ## ## ## slot: Luna UHD Slot ## ## token: ## ## ## ## slot: Luna UHD Slot ## ## token: ## ## ## ## slot: Luna UHD Slot ## ## token: ## ## ----------------------------------------------------------- ## ## ## ## ## ## Based on the example above, substitute all password values, ## ## as well as the following values: ## ## ## ## <hsm_libfile>=/usr/safenet/lunaclient/lib/libCryptoki2_64.so ## ## <hsm_modulename>=lunasa ## ## <hsm_token_name>=dev-intca ## ## ## ############################################################################### ############################################################################### ###############################################################################
###############################################################################
###############################################################################
###############################################################################
## ##
## EXAMPLE: Configuration File used to override ##
## '/usr/share/pki/server/etc/default.cfg' when using a LunaSA ##
## Hardware Security Module (HSM): ##
## ##
## # modutil -dbdir . -list ##
## ##
## Listing of PKCS #11 Modules ##
## ----------------------------------------------------------- ##
## 1. NSS Internal PKCS #11 Module ##
## slots: 2 slots attached ##
## status: loaded ##
## ##
## slot: NSS Internal Cryptographic Services ##
## token: NSS Generic Crypto Services ##
## ##
## slot: NSS User Private Key and Certificate Services ##
## token: NSS Certificate DB ##
## ##
## 2. lunasa ##
## library name: /usr/safenet/lunaclient/lib/libCryptoki2_64.so ##
## slots: 4 slots attached ##
## status: loaded ##
## ##
## slot: LunaNet Slot ##
## token: dev-intca ##
## ##
## slot: Luna UHD Slot ##
## token: ##
## ##
## slot: Luna UHD Slot ##
## token: ##
## ##
## slot: Luna UHD Slot ##
## token: ##
## ----------------------------------------------------------- ##
## ##
## ##
## Based on the example above, substitute all password values, ##
## as well as the following values: ##
## ##
## <hsm_libfile>=/usr/safenet/lunaclient/lib/libCryptoki2_64.so ##
## <hsm_modulename>=lunasa ##
## <hsm_token_name>=dev-intca ##
## ##
###############################################################################
###############################################################################
###############################################################################