8.2. 使用 HSM 安装子系统


8.2.1. 使用 nCipher nShield HSM 安装子系统

要安装使用 nCipher nShield HSM 的子系统实例,请按照以下步骤执行:

  1. 准备一个覆盖文件,对应于您的特定部署。以下 默认'hms.txt 文件是此类覆盖文件的示例:

    注意

    此文件仅充当一个 nCipher HSM 覆盖配置文件 示例,该文件可覆盖其他值,包括默认哈希算法。另外,根据 pkispawn 命令行中指定的子系统调用,将只使用 [CA]、[KRA]、[OCSP]、[TKS] 或 [TPS] 部分之一。

    例 8.1. 与 nCipher HSM 搭配使用的覆盖文件示例

    Copy to Clipboard Toggle word wrap
    ###############################################################################
    ###############################################################################
    ###############################################################################
    ##                                                                           ##
    ## 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>
  2. 使用配置文件,如 第 7.2.2.2 节 “两步安装” 所述。

    • Copy to Clipboard Toggle word wrap
      # pkispawn -s CA -f ./default_hsm.txt -vvv
    • Copy to Clipboard Toggle word wrap
      # pkispawn -s KRA -f ./default_hsm.txt -vvv
    • Copy to Clipboard Toggle word wrap
      # pkispawn -s OCSP -f ./default_hsm.txt -vvv
    • Copy to Clipboard Toggle word wrap
      # pkispawn -s TKS -f ./default_hsm.txt -vvv
    • Copy to Clipboard Toggle word wrap
      # pkispawn -s TPS -f ./default_hsm.txt -vvv
  3. 验证 HSM 是否包含以下证书:

    Copy to Clipboard Toggle word wrap
    $ 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 覆盖文件标头的示例

Copy to Clipboard Toggle word wrap
###############################################################################
###############################################################################
###############################################################################
##                                                                           ##
## 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                                        ##
##                                                                           ##
###############################################################################
###############################################################################
###############################################################################
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat, Inc.