7.11. 创建并配置 TPS 实例
本节描述了针对 SubCA 安装和配置 TPS 实例。
TPS 系统证书将由 SubCA 发布,TPS 将加入 SubCA 安全域。
在本例中,TPS 安装在 rhcs10.example.com 上,其内部目录服务器位于 rhds11.example.com 上。
确保文件 /opt/pki_rsa/ca-chain.pem 包含完整的 CA 证书链(SubCA 和 RootCA 证书):
# ls -l /opt/pki_rsa/ca-chain.pem
# cat /opt/pki_rsa/ca-chain.pem
7.11.1. 替换临时 DS 证书(TPS) 复制链接链接已复制到粘贴板!
在安装 TPS 之前,我们为 TPS 的目录服务器发布官方 SSL 服务器证书来替换临时 bootstrap。为此,我们首先要为目录服务器证书创建一个证书签名请求(CSR),然后将此请求提交到 CA。
确保您使用 DS 服务器的 FQDN,如 cn=rhds11.example.com / host=rhds11.example.com。
为真实 DS 证书生成 CSR
在 rhds11.example.com 上,为真实 DS 证书生成 PKCS10 证书签名请求:
停止 DS :
# dsctl slapd-CC-RSA-TPS-LDAP stop使用
certutil工具生成 CSR:# certutil -R -d /etc/dirsrv/slapd-CC-RSA-TPS-LDAP -s "CN=rhds11.example.com" -g 2048 -f /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/pwdfile.txt -a -o /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/Server-Cert-tps.csr -z /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/noise.txt重要编辑上面获取的
Server-Cert-tps.csr输出文件,以删除"Begin Certificate Request"前的几行。例如:
# vi /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/Server-Cert-tps.csrCSR 文件必须以"-----BEGIN CERTIFICATE REQUEST-----"行开头,并以"-----END CERTIFICATE REQUEST-----"行结尾。
远程将
Server-Cert-tps.csr文件复制到 CA 所在的系统中。例如:# scp /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/Server-Cert-tps.csr root@rhcs10.example.com:/root/.dogtag/pki_rsa_bootstrap/certs_db/Server-Cert-tps.csr
发出真实 DS 证书
在 rhcs10.example.com 上,发布实际的 SSL 服务器证书:
生成 CMC 请求:
创建
CMCRequest配置文件。例如:# vim /root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps_pkcs10.cfg### numRequests: Total number of PKCS10 requests or CRMF requests. numRequests=1 ### input: full path for the PKCS10 request or CRMF request, ### The content must be in Base-64 encoded format. ### Multiple files are supported. They must be separated by a space. ### For input on a different host, specify where to find the CSR. input=/root/.dogtag/pki_rsa_bootstrap/certs_db/Server-Cert-tps.csr ### output: full path for the CMC request in binary format ### For output on a different host, specify the destination. output=/root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps_pkcs10.req ### tokenname: name of the token where the agent signing cert can be found (default is internal) tokenname=internal ### nickname: nickname for the agent certificate that will be used to sign the CMC full request. nickname=PKI Bootstrap Administrator for RSA-SubCA ### dbdir: directory for cert8.db, key3.db and secmod.db dbdir=/root/.dogtag/pki_rsa_bootstrap/certs_db ### password: password for cert8.db that stores the agent certificate password=SECret.123 ### format: request format, either pkcs10 or crmf format=pkcs10使用
CMCRequest命令生成请求:# CMCRequest /root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps_pkcs10.cfg cert/key prefix = path = /root/.dogtag/pki_rsa_bootstrap/certs_db CryptoManger initialized token internal logged in... got signerCert: PKI Bootstrap Administrator for RSA-SubCA createPKIData: begins k=0 createPKIData: format: pkcs10 useSharedSecret is false... signData: begins: getPrivateKey: got signing cert signData: got signer privKey createSignedData: begins getSigningAlgFromPrivate: begins. getSigningAlgFromPrivate: found signingKeyType=RSA getSigningAlgFromPrivate: using SignatureAlgorithm: RSASignatureWithSHA256Digest createSignedData: digest created for pkidata createSignedData: digest algorithm =RSASignatureWithSHA256Digest createSignedData: building cert chain signData: signed request generated. getCMCBlob: begins getCMCBlob: generating signed data The CMC enrollment request in base-64 encoded format: . . . Output omitted . . . The CMC enrollment request in binary format is stored in /root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps_pkcs10.req
提交 CMC 请求:
创建
HttpClient配置文件。例如:# vim /root/.dogtag/pki_rsa_bootstrap/certs_db/HttpClient_dirsrv-tps.cfg### host: host name for the http server host=rhcs10.example.com ### port: port number port=31443 ### secure: true for secure connection, false for nonsecure connection secure=true ### input: full path for the enrollment request, the content must be in binary format input=/root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps_pkcs10.req ### output: full path for the response in binary format output=/root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps_pkcs10.resp ### tokenname: name of the token where the SSL client authentication cert can be found (default is internal) ### This parameter will be ignored if secure=false tokenname=internal ### dbdir: directory for cert8.db, key3.db and secmod.db ### This parameter will be ignored if secure=false dbdir=/root/.dogtag/pki_rsa_bootstrap/certs_db ### clientmode: true for client authentication, false for no client authentication ### This parameter will be ignored if secure=false clientmode=true ### password: password for cert8.db ### This parameter will be ignored if secure=false and clientauth=false password=SECret.123 ### nickname: nickname for client certificate ### This parameter will be ignored if clientmode=false nickname=PKI Bootstrap Administrator for RSA-SubCA ### servlet: servlet name servlet=/ca/ee/ca/profileSubmitCMCFull?profileId=caCMCserverCert使用
HttpClient命令提交请求:# HttpClient /root/.dogtag/pki_rsa_bootstrap/certs_db/HttpClient_dirsrv-tps.cfg Total number of bytes read = 3096 after SSLSocket created, thread token is NSS FIPS 140-2 User Private Key client cert is not null handshake happened writing to socket ##Response Headers begin## HTTP/1.1 200 Content-Type: application/pkcs7-mime Content-Length: 2492 Date: Tue, 29 Sep 2020 15:20:21 GMT Connection: close ##end## . . . Output omitted . . . The response in binary format is stored in /root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps_pkcs10.resp
处理 CMC 响应:
使用
CMCResponse处理响应,以 PEM 格式单独以链的形式显示所有证书:重要使用 "-v" 选项运行 CMCResponse 将链中每个证书的 PEM 返回为 Cert:0, Cert:1 等。在所有 PEM 下,输出也会以用户打印格式显示链中的每个证书。由于证书没有以固定顺序显示,因此为了确定其在链中的位置,您必须检查每个 "Certificate" 下的"Subject: "。对应的 PEM 显示在上面的同一位置。
# CMCResponse -d /root/.dogtag/pki_rsa_bootstrap/certs_db -i /root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps_pkcs10.resp -v Cert:0 ... === Cert:1 ... === Cert:2 ... === Certificates: Certificate: Data: Version: v3 Serial Number: 0xA383694 Signature Algorithm: SHA256withRSA - 1.2.840.113549.1.1.11 Issuer: CN=CA Signing Certificate,OU=rhcs10-RSA-TPS,O=Example-rhcs10-RSA-TPS Validity: Not Before: Tuesday, April 5, 2022 8:41:36 AM EDT America/New_York Not After: Monday, March 25, 2024 8:41:36 AM EDT America/New_York Subject: CN=rhds11.example.com . . . Output omitted . . . Certificate: Data: Version: v3 Serial Number: 0x5C8FAD4 Signature Algorithm: SHA256withRSA - 1.2.840.113549.1.1.11 Issuer: CN=CA Signing Certificate,OU=rhcs10-RSA-RootCA,O=Example-rhcs10-RSA-RootCA Validity: Not Before: Tuesday, April 5, 2022 8:36:21 AM EDT America/New_York Not After: Saturday, April 5, 2042 8:36:21 AM EDT America/New_York Subject: CN=CA Signing Certificate,OU=rhcs10-RSA-RootCA,O=Example-rhcs10-RSA-RootCA . . . Output omitted . . . Certificate: Data: Version: v3 Serial Number: 0x80296C3 Signature Algorithm: SHA256withRSA - 1.2.840.113549.1.1.11 Issuer: CN=CA Signing Certificate,OU=rhcs10-RSA-RootCA,O=Example-rhcs10-RSA-TPS Validity: Not Before: Tuesday, April 5, 2022 8:39:43 AM EDT America/New_York Not After: Friday, April 5, 2041 8:39:43 AM EDT America/New_York Subject: CN=CA Signing Certificate,OU=rhcs10-RSA-TPS,O=Example-rhcs10-RSA-RootCA . . . Output omitted . . . Number of controls is 1 Control #0: CMCStatusInfoV2 OID: {1 3 6 1 5 5 7 7 25} BodyList: 1 Status: SUCCESS CMC Full Response.将新
Server-CertDS 证书保存到 bootstrap 证书目录(例如/root/.dogtag/pki_rsa_bootstrap/certs_db/)中的文件中。.pem文件必须以 header-----BEGIN CERTIFICATE-----开头,并以 footer-----END CERTIFICATE-----结束。例如:# vi /root/.dogtag/pki_rsa_bootstrap/certs_db/Server-Cert-tps.pem其中
Server-Cert-tps.pem是 Directory Server 实例的新Server-Cert证书,充当 TPS 的 internaldb。注意RootCA 的签名证书应与以下命令的输出匹配:
# certutil -L -d /var/lib/pki/rhcs10-RSA-RootCA/alias/ -n "CA Signing Cert - rhcs10-RSA-RootCA" -a
远程将新的
Server-Cert证书复制到 rhds11.example.com。例如:# scp /root/.dogtag/pki_rsa_bootstrap/certs_db/Server-Cert-tps.pem root@rhds11.example.com:/etc/dirsrv/slapd-CC-RSA-TPS-LDAP/
替换临时 DS 证书
在 rhds11.example.com 上,将临时 DS 证书替换为实际的 DS 证书:
将
dirsrv目录的内容保存到备份目录中:# cp -r /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/ /etc/dirsrv/save-rsa/slapd-CC-RSA-TPS-LDAP/删除旧的 DS 证书:
# certutil -D -d /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/ -f /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/pwdfile.txt -n "Server-Cert"# certutil -D -d /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/ -f /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/pwdfile.txt -n "Self-Signed-CA"逐个导入新创建的 DS 证书和 CA 证书。例如:
# certutil -d /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/ -f /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/pwdfile.txt -A -t "CT,C,C" -n "CA Signing Cert - rhcs10-RSA-RootCA" -i /opt/pki_rsa/rootCA.pem# certutil -d /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/ -f /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/pwdfile.txt -A -t "CT,C,C" -n "CA Signing Cert - rhcs10-RSA-SubCA" -i /opt/pki_rsa/subCA.pem# certutil -d /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/ -f /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/pwdfile.txt -A -t "u,u,u" -n "Server-Cert" -i /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/Server-Cert-tps.pem列出证书:
# certutil -L -d /etc/dirsrv/slapd-CC-RSA-TPS-LDAP/ Certificate Nickname Trust Attributes SSL,S/MIME,JAR/XPI CA Signing Cert - rhcs10-RSA-RootCA CT,C,C CA Signing Cert - rhcs10-RSA-SubCA CT,C,C Server-Cert u,u,u启动 DS :
# dsctl slapd-CC-RSA-TPS-LDAP start测试以确认 LDAP 服务器已启动并在运行(如果是单独的系统,则在 CA 主机上进行测试):
# ldapsearch -x -D "cn=Directory Manager" -H ldaps://rhds11.example.com:17636 -b "dc=example,dc=com" -w SECret.123如果在单独的系统上测试,请在
ldapsearch命令前面包含 CA 证书链,例如:# LDAPTLS_CACERT=/opt/pki_rsa/ca-chain.pem ldapsearch -x -D "cn=Directory Manager" -H ldaps://rhds11.example.com:17636 -b "dc=example,dc=com" -w SECret.123
7.11.2. 配置 TPS 身份验证数据库 复制链接链接已复制到粘贴板!
TPS 依赖于身份验证数据库来验证智能卡令牌。
如需更多信息,请参阅 第 2.5.2.4 节 “令牌数据库”。
7.11.2.1. 为 TPS 身份验证数据库设置 LDAP 服务器 复制链接链接已复制到粘贴板!
在安装 TPS 之前,我们安装一个将托管 TPS AuthDB 的目录服务器实例。
本节中提到的 TPS 身份验证数据库仅使用演示目的的简化步骤创建。
以 root 用户身份在 rhds11.example.com 上:
安装目录服务器实例,CA 将用它来验证令牌。红帽目录服务器分别侦听 LDAP/LDAPS 端口 9389 和 9636。
在所选位置(如
/root/pki_rsa)创建 TPS AuthDB 目录服务器安装文件:# vim /root/pki_rsa/tps-auth-db-ldap.cfg编辑上一步中创建的
.cfg文件。取消注释以下参数并把它设置为自定义安装:[general] full_machine_name = rhds11.example.com [slapd] port = 9389 secure_port = 9636 instance_name = CC-RSA-TPS-AUTH-DB root_password = SECret.123 self_sign_cert = True [backend-userroot] suffix = dc=example,dc=com create_suffix_entry = True安装 Directory 服务器实例:
# dscreate from-file /root/pki_rsa/tps-auth-db-ldap.cfg Starting installation... Completed installation for CC-RSA-TPS-AUTH-DB
添加 ACI (Access Control 指令)规则以允许匿名绑定访问。默认情况下禁用它。
在所选位置(如
/root/pki_rsa/dirsrv/)创建ldapaci.ldif文件,其内容如下:dn: dc=example,dc=com changetype: modify add: aci aci: (targetattr!="userPassword || aci")(version 3.0; acl "Enable anonymous access"; allow (read, search, compare) userdn="ldap:///anyone";)运行
ldapmodify命令来添加 ACI:# ldapmodify -x -h rhds11.example.com -p 9389 -D 'cn=Directory Manager' -W -f /root/pki_rsa/dirsrv/ldapaci.ldif
7.11.2.2. 替换临时 DS 证书(TPS AuthDB) 复制链接链接已复制到粘贴板!
在安装 TPS 之前,我们为 TPS 身份验证数据库发布官方 SSL 服务器证书,以替换临时 bootstrap 证书。为此,我们首先要为目录服务器证书创建一个证书签名请求(CSR),然后将此请求提交到 CA。
确保您使用 DS 服务器的 FQDN,如 cn=rhds11.example.com / host=rhds11.example.com。
为真实 DS 证书生成 CSR
在 rhds11.example.com 上,为真实 DS 证书生成 PKCS10 证书签名请求:
停止 DS :
# dsctl slapd-CC-RSA-TPS-AUTH-DB stop使用
certutil工具生成 CSR:# certutil -R -d /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB -s "CN=rhds11.example.com" -g 2048 -f /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/pwdfile.txt -a -o /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/Server-Cert-tps-auth.csr -z /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/noise.txt重要编辑上面获取的
Server-Cert-tps-auth.csr输出文件,以在"Begin Certificate Request"之前删除几行。例如:
# vi /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/Server-Cert-tps-auth.csrCSR 文件必须以"-----BEGIN CERTIFICATE REQUEST-----"行开头,并以"-----END CERTIFICATE REQUEST-----"行结尾。
远程将
Server-Cert-tps-auth.csr文件复制到 CA 所在的系统中。例如:# scp /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/Server-Cert-tps-auth.csr root@rhcs10.example.com:/root/.dogtag/pki_rsa_bootstrap/certs_db/Server-Cert-tps-auth.csr
发出真实 DS 证书
在 rhcs10.example.com 上,发布实际的 SSL 服务器证书:
生成 CMC 请求:
创建
CMCRequest配置文件。例如:# vim /root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps-auth_pkcs10.cfg### numRequests: Total number of PKCS10 requests or CRMF requests. numRequests=1 ### input: full path for the PKCS10 request or CRMF request, ### The content must be in Base-64 encoded format. ### Multiple files are supported. They must be separated by a space. ### For input on a different host, specify where to find the CSR. input=/root/.dogtag/pki_rsa_bootstrap/certs_db/Server-Cert-tps-auth.csr ### output: full path for the CMC request in binary format ### For output on a different host, specify the destination. output=/root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps-auth_pkcs10.req ### tokenname: name of the token where the agent signing cert can be found (default is internal) tokenname=internal ### nickname: nickname for the agent certificate that will be used to sign the CMC full request. nickname=PKI Bootstrap Administrator for RSA-SubCA ### dbdir: directory for cert8.db, key3.db and secmod.db dbdir=/root/.dogtag/pki_rsa_bootstrap/certs_db ### password: password for cert8.db that stores the agent certificate password=SECret.123 ### format: request format, either pkcs10 or crmf format=pkcs10使用
CMCRequest命令生成请求:# CMCRequest /root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps-auth_pkcs10.cfg cert/key prefix = path = /root/.dogtag/pki_rsa_bootstrap/certs_db CryptoManger initialized token internal logged in... got signerCert: PKI Bootstrap Administrator for RSA-SubCA createPKIData: begins k=0 createPKIData: format: pkcs10 useSharedSecret is false... signData: begins: getPrivateKey: got signing cert signData: got signer privKey createSignedData: begins getSigningAlgFromPrivate: begins. getSigningAlgFromPrivate: found signingKeyType=RSA getSigningAlgFromPrivate: using SignatureAlgorithm: RSASignatureWithSHA256Digest createSignedData: digest created for pkidata createSignedData: digest algorithm =RSASignatureWithSHA256Digest createSignedData: building cert chain signData: signed request generated. getCMCBlob: begins getCMCBlob: generating signed data The CMC enrollment request in base-64 encoded format: . . . Output omitted . . . The CMC enrollment request in binary format is stored in /root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps-auth_pkcs10.req
提交 CMC 请求:
创建
HttpClient配置文件。例如:# vim /root/.dogtag/pki_rsa_bootstrap/certs_db/HttpClient_dirsrv-tps-auth.cfg### host: host name for the http server host=rhcs10.example.com ### port: port number port=31443 ### secure: true for secure connection, false for nonsecure connection secure=true ### input: full path for the enrollment request, the content must be in binary format input=/root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps-auth_pkcs10.req ### output: full path for the response in binary format output=/root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps-auth_pkcs10.resp ### tokenname: name of the token where the SSL client authentication cert can be found (default is internal) ### This parameter will be ignored if secure=false tokenname=internal ### dbdir: directory for cert8.db, key3.db and secmod.db ### This parameter will be ignored if secure=false dbdir=/root/.dogtag/pki_rsa_bootstrap/certs_db ### clientmode: true for client authentication, false for no client authentication ### This parameter will be ignored if secure=false clientmode=true ### password: password for cert8.db ### This parameter will be ignored if secure=false and clientauth=false password=SECret.123 ### nickname: nickname for client certificate ### This parameter will be ignored if clientmode=false nickname=PKI Bootstrap Administrator for RSA-SubCA ### servlet: servlet name servlet=/ca/ee/ca/profileSubmitCMCFull?profileId=caCMCserverCert使用
HttpClient命令提交请求:# HttpClient /root/.dogtag/pki_rsa_bootstrap/certs_db/HttpClient_dirsrv-tps-auth.cfg Total number of bytes read = 3096 after SSLSocket created, thread token is NSS FIPS 140-2 User Private Key client cert is not null handshake happened writing to socket ##Response Headers begin## HTTP/1.1 200 Content-Type: application/pkcs7-mime Content-Length: 2492 Date: Tue, 29 Sep 2020 15:20:21 GMT Connection: close ##end## . . . Output omitted . . . The response in binary format is stored in /root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps-auth_pkcs10.resp
处理 CMC 响应:
使用
CMCResponse处理响应,以 PEM 格式单独以链的形式显示所有证书:重要使用 "-v" 选项运行 CMCResponse 将链中每个证书的 PEM 返回为 Cert:0, Cert:1 等。在所有 PEM 下,输出也会以用户打印格式显示链中的每个证书。由于证书没有以固定顺序显示,因此为了确定其在链中的位置,您必须检查每个 "Certificate" 下的"Subject: "。对应的 PEM 显示在上面的同一位置。
# CMCResponse -d /root/.dogtag/pki_rsa_bootstrap/certs_db -i /root/.dogtag/pki_rsa_bootstrap/certs_db/cmc.dirsrv-tps-auth_pkcs10.resp -v Cert:0 ... === Cert:1 ... === Cert:2 ... === Certificates: Certificate: Data: Version: v3 Serial Number: 0xA383694 Signature Algorithm: SHA256withRSA - 1.2.840.113549.1.1.11 Issuer: CN=CA Signing Certificate,OU=rhcs10-RSA-TPS,O=Example-rhcs10-RSA-TPS Validity: Not Before: Tuesday, April 5, 2022 8:41:36 AM EDT America/New_York Not After: Monday, March 25, 2024 8:41:36 AM EDT America/New_York Subject: CN=rhds11.example.com . . . Output omitted . . . Certificate: Data: Version: v3 Serial Number: 0x5C8FAD4 Signature Algorithm: SHA256withRSA - 1.2.840.113549.1.1.11 Issuer: CN=CA Signing Certificate,OU=rhcs10-RSA-RootCA,O=Example-rhcs10-RSA-RootCA Validity: Not Before: Tuesday, April 5, 2022 8:36:21 AM EDT America/New_York Not After: Saturday, April 5, 2042 8:36:21 AM EDT America/New_York Subject: CN=CA Signing Certificate,OU=rhcs10-RSA-RootCA,O=Example-rhcs10-RSA-RootCA . . . Output omitted . . . Certificate: Data: Version: v3 Serial Number: 0x80296C3 Signature Algorithm: SHA256withRSA - 1.2.840.113549.1.1.11 Issuer: CN=CA Signing Certificate,OU=rhcs10-RSA-RootCA,O=Example-rhcs10-RSA-TPS Validity: Not Before: Tuesday, April 5, 2022 8:39:43 AM EDT America/New_York Not After: Friday, April 5, 2041 8:39:43 AM EDT America/New_York Subject: CN=CA Signing Certificate,OU=rhcs10-RSA-TPS,O=Example-rhcs10-RSA-RootCA . . . Output omitted . . . Number of controls is 1 Control #0: CMCStatusInfoV2 OID: {1 3 6 1 5 5 7 7 25} BodyList: 1 Status: SUCCESS CMC Full Response.将新
Server-CertDS 证书保存到 bootstrap 证书目录(例如/root/.dogtag/pki_rsa_bootstrap/certs_db/)中的文件中。.pem文件必须以 header-----BEGIN CERTIFICATE-----开头,并以 footer-----END CERTIFICATE-----结束。例如:# vi /root/.dogtag/pki_rsa_bootstrap/certs_db/Server-Cert-tps-auth.pem其中
Server-Cert-tps-auth.pem是 Directory Server 实例的新Server-Cert证书,充当 TPS 的身份验证 db。注意RootCA 的签名证书应与以下命令的输出匹配:
# certutil -L -d /var/lib/pki/rhcs10-RSA-RootCA/alias/ -n "CA Signing Cert - rhcs10-RSA-RootCA" -a
远程将新的
Server-Cert证书复制到 rhds11.example.com。例如:# scp /root/.dogtag/pki_rsa_bootstrap/certs_db/Server-Cert-tps-auth.pem root@rhds11.example.com:/etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/
替换临时 DS 证书
在 rhds11.example.com 上,将临时 DS 证书替换为实际的 DS 证书:
将
dirsrv目录的内容保存到备份目录中:# cp -r /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/ /etc/dirsrv/save-rsa/slapd-CC-RSA-TPS-AUTH-DB/删除旧的 DS 证书:
# certutil -D -d /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/ -f /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/pwdfile.txt -n "Server-Cert"# certutil -D -d /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/ -f /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/pwdfile.txt -n "Self-Signed-CA"逐个导入新创建的 DS 证书和 CA 证书。例如:
# certutil -d /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/ -f /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/pwdfile.txt -A -t "CT,C,C" -n "CA Signing Cert - rhcs10-RSA-RootCA" -i /opt/pki_rsa/rootCA.pem# certutil -d /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/ -f /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/pwdfile.txt -A -t "CT,C,C" -n "CA Signing Cert - rhcs10-RSA-SubCA" -i /opt/pki_rsa/subCA.pem# certutil -d /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/ -f /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/pwdfile.txt -A -t "u,u,u" -n "Server-Cert" -i /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/Server-Cert-tps-auth.pem列出证书:
# certutil -L -d /etc/dirsrv/slapd-CC-RSA-TPS-AUTH-DB/ Certificate Nickname Trust Attributes SSL,S/MIME,JAR/XPI CA Signing Cert - rhcs10-RSA-RootCA CT,C,C CA Signing Cert - rhcs10-RSA-SubCA CT,C,C Server-Cert u,u,u启动 DS :
# dsctl slapd-CC-RSA-TPS-AUTH-DB start测试以确认 LDAP 服务器已启动并在运行(如果是单独的系统,则在 CA 主机上进行测试):
# ldapsearch -x -D "cn=Directory Manager" -H ldaps://rhds11.example.com:9636 -b "dc=example,dc=com" -w SECret.123如果在单独的系统上测试,请在
ldapsearch命令前面包含 CA 证书链,例如:# LDAPTLS_CACERT=/opt/pki_rsa/ca-chain.pem ldapsearch -x -D "cn=Directory Manager" -H ldaps://rhds11.example.com:9636 -b "dc=example,dc=com" -w SECret.123
7.11.3. 安装 TPS 实例 复制链接链接已复制到粘贴板!
要安装 TPS , 请使用单步方法或两步方法。以下流程描述了单步方法。如果要使用两步方法进行安装,请参阅 ] 和 xref:_rootca_two_step[。
BEFORE 安装 TPS,如果您打算将 AIA 扩展指向外部 OCSP 实例,而不是 CA 的内部 OCSP,请确保首先按照 第 7.7.4 节 “设置默认 AIA 扩展以指向此 OCSP” 中的步骤操作。
先决条件
- 以 root 用户身份登录 rhcs10.example.com。
- 在我们的示例中,您有 第 7.1.2.7 节 “为 TPS 安装 DS 实例”,CC-RSA-TPS-LDAP 是 TPS 的内部数据库。
流程
在所选位置(如
/root/pki_rsa)创建一个 TPS 安装文件:# cd /root/pki_rsa# vi tps_inst.cfg注意除非明确指定,否则系统证书别名将自动命名为
pki_instance_name的值。为了避免共享 HSM 上的证书别名冲突,请为每个实例创建使用不同的实例名称。
以下安装文件中指定的值是示例。除了更改 HSM 密码外,还要相应地编辑值,如 ports, directory, nicknames, domains…
[DEFAULT] pki_instance_name=rhcs10-RSA-TPS pki_https_port=25443 pki_http_port=25080 ### Crypto Token pki_hsm_enable=True pki_hsm_libfile=/opt/nfast/toolkits/pkcs11/libcknfast.so pki_hsm_modulename=nfast pki_token_name=NHSM-CONN-XC pki_token_password=<YourHSMpassword> pki_audit_signing_token=NHSM-CONN-XC pki_audit_signing_key_algorithm=SHA256withRSA pki_audit_signing_key_size=2048 pki_audit_signing_key_type=rsa pki_audit_signing_signing_algorithm=SHA256withRSA pki_subsystem_token=NHSM-CONN-XC pki_subsystem_key_algorithm=SHA256withRSA pki_subsystem_signing_algorithm=SHA256withRSA pki_subsystem_key_size=2048 pki_subsystem_key_type=rsa pki_sslserver_token=NHSM-CONN-XC pki_sslserver_key_algorithm=SHA256withRSA pki_sslserver_signing_algorithm=SHA256withRSA pki_sslserver_key_size=2048 pki_sslserver_key_type=rsa ### CA cert chain concatenated in PEM format pki_cert_chain_path=/opt/pki_rsa/ca-chain.pem ### Bootstrap Admin pki_admin_password=SECret.123 pki_admin_key_type=rsa pki_admin_key_size=2048 pki_admin_key_algorithm=SHA256withRSA ### Bootstrap Admin client dir pki_client_admin_cert_p12=/opt/pki_rsa/rhcs10-RSA-TPS/tps_admin_cert.p12 pki_client_database_dir=/opt/pki_rsa/rhcs10-RSA-TPS/certs_db pki_client_database_password=SECret.123 pki_client_database_purge=False pki_client_dir=/opt/pki_rsa/rhcs10-RSA-TPS pki_client_pkcs12_password=SECret.123 ### Internal LDAP pki_ds_bind_dn=cn=Directory Manager pki_ds_ldap_port=17389 pki_ds_ldaps_port=17636 pki_ds_password=SECret.123 pki_ds_remove_data=True pki_ds_secure_connection=True pki_ds_secure_connection_ca_pem_file=/opt/pki_rsa/ca-chain.pem pki_ds_secure_connection_ca_nickname=CA Signing Cert - rhcs10-RSA-SubCA ### Security Domain pki_security_domain_hostname=rhcs10.example.com pki_security_domain_https_port=31443 pki_security_domain_password=SECret.123 pki_security_domain_user=caadmin [Tomcat] pki_ajp_port=14019 pki_tomcat_server_port=14015 [TPS] pki_import_admin_cert=False pki_admin_nickname=PKI Bootstrap Administrator for RSA-TPS pki_admin_name=tpsadmin pki_admin_uid=tpsadmin pki_admin_email=tpsadmin@example.com pki_ds_hostname=rhds11.example.com pki_ds_base_dn=dc=RSA-TPS pki_ds_database=CC-RSA-TPS-LDAP pki_share_db=False ### basedn of the TPS token authentication database pki_authdb_basedn = dc=example,dc=com pki_authdb_hostname=rhds11.example.com pki_authdb_port=9636 pki_authdb_secure_conn=True pki_ca_uri=https://rhcs10.example.com:31443 pki_tks_uri=https://rhcs10.example.com:24443 pki_kra_uri=https://rhcs10.example.com:28443 pki_enable_server_side_keygen=True pki_import_shared_secret=True运行
pkispawn工具来安装 TPS 子系统:# pkispawn -s TPS -f tps_inst.cfg --debug这将在
/var/lib/pki/rhcs10-RSA-TPS中创建 TPS 实例。
为便于参考,如果您想要使用两步方法安装 TPS:
首先使用
--skip-configuration选项运行pkispawn工具来安装 RHCS TPS 实例:# pkispawn -s TPS -f tps_inst.cfg --skip-configuration --debug- 在两个安装步骤间自定义配置文件
运行
pkispawn工具来配置 TPS:# pkispawn -s TPS -f tps_inst.cfg --skip-installation --debug
验证
显示安装的 TPS 实例的状态:
# pki-server status rhcs10-RSA-TPS请注意安全代理、Admin 和 pkiconsole URL。
- 验证 TPS 代理网页是否可以访问。
将 TPS bootstrap 管理员证书导入到 nssdb 中:
# pki -d /root/.dogtag/pki_rsa_bootstrap/certs_db client-cert-import --pkcs12 /opt/pki_rsa/rhcs10-RSA-TPS/tps_admin_cert.p12 --pkcs12-password SECret.123 ---------------------------------------- Imported certificates from PKCS #12 file ----------------------------------------
只有在完成下一小节中详述的设置步骤后,才能执行实际的智能卡令牌注册测试。
7.11.4. 测试令牌侧密钥生成 复制链接链接已复制到粘贴板!
本节使用令牌密钥生成(而不是 服务器端密钥生成)简单演示令牌 密钥注册。为了测试令牌侧密钥生成,我们将创建一个新的测试用户,然后通过 tpsclient 工具格式化并注册该用户的令牌。
准备测试令牌侧密钥生成
临时更新
userKey配置集以仅生成签名证书:停止 TPS:
# pki-server stop rhcs10-RSA-TPS编辑
/var/lib/pki/rhcs10-RSA-TPS/tps/conf/CS.cfg配置文件,并将op.enroll.userKey.keyGen.keyType.num参数从 2 改为 1。例如:op.enroll.userKey.keyGen.keyType.num=1启动 TPS:
# pki-server start rhcs10-RSA-TPS
创建一个用于测试令牌注册的新用户,如 jdoe :
首先检查 TPS WebUI 是否启动:
# pki -U https://rhcs10.example.com:25443 -d /root/.dogtag/pki_rsa_bootstrap/certs_db/ -n "PKI Bootstrap Administrator for RSA-TPS" -c SECret.123 tps-user-show tpsadmin --------------- User "tpsadmin" --------------- User ID: tpsadmin Full name: tpsadmin Email: tpsadmin@example.com Type: adminType State: 1 TPS Profiles: All Profiles为 POSIX 用户创建一个 .cfg 文件,如下所示:
# vi ldap_user1_add.cfg在文件中添加以下内容并保存:
dn: uid=jdoe,dc=example,dc=com objectClass: extensibleobject objectclass: inetorgperson objectclass: organizationalPerson objectClass: person objectClass: posixAccount objectClass: top homeDirectory: /var/empty gidNumber: 99997 uidNumber: 99996 sn: jdoe uid: jdoe cn: TPS jdoe mail: user3@redhat.com givenName: jdoe userPassword: SECret.123 shrTok:
配置匿名绑定访问:
创建一个包含以下内容的 ldif 文件:
dn: ou=People,dc=example,dc=com changetype: modify add: aci aci: (targetattr!="userPassword || aci")(version 3.0; acl "Enable anonymous access"; allow (read, search, compare) userdn="ldap:///anyon e";)运行以下命令来启用匿名绑定访问:
ldapadd -h rhds11-5.example.com -p 389 -c -D "cn=Directory Manager" -w SECret.123 -f ldapci.ldif
使用之前创建的
.cfg文件运行ldapadd命令,以添加 jdoe 用户:# LDAPTLS_CACERT=/opt/pki_rsa/ca-chain.pem ldapadd -x -D 'cn=directory manager' -H ldaps://rhds11.example.com:9636 -w SECret.123 -f ldap_user1_add.cfg
测试令牌侧密钥生成
使用 tpsclient 工具格式化和注册令牌来测试令牌侧密钥生成。
在单独的 非FIPS的系统上,安装
tpsclient软件包。例如:# dnf install -y redhat-pki-tps注意如果您在 Fedora 系统中测试,提供
tpsclient工具的对应软件包将是dogtag-pki-tools。将 TPS 服务器主机名和 IP 地址添加到
/etc/hosts文件中:# echo "<TPS server IP> rhcs10.example.com" >> /etc/hosts为新创建的用户测试格式和注册:
准备,以格式化 jdoe 的令牌。创建
.txt文件:# vi token_format.txt添加以下内容:主机和端口值应与您自己的端口匹配;该端口应当是非 SSL 端口。
op=var_set name=ra_host value=rhcs10.example.com op=var_set name=ra_port value=25080 op=var_set name=ra_uri value=/tps/tps op=token_set cuid=40906145C76224192D2B msn=01020304 app_ver=6FBBC105 key_info=0101 major_ver=0 minor_ver=0 op=token_set auth_key=404142434445464748494a4b4c4d4e4f op=token_set mac_key=404142434445464748494a4b4c4d4e4f op=token_set kek_key=404142434445464748494a4b4c4d4e4f op=ra_format uid=jdoe pwd=SECret.123 num_threads=1 extensions=tokenType=userKey为 jdoe 准备注册令牌。创建
.txt文件:# vi token_enroll.txt添加以下内容:主机和端口值应与您自己的端口匹配;该端口应当是非 SSL 端口。
op=var_set name=ra_host value=rhcs10.example.com op=var_set name=ra_port value=25080 op=var_set name=ra_uri value=/tps/tps op=token_set cuid=40906145C76224192D2B msn=01020304 app_ver=6FBBC105 key_info=0101 major_ver=0 minor_ver=0 op=token_set auth_key=404142434445464748494a4b4c4d4e4f op=token_set mac_key=404142434445464748494a4b4c4d4e4f op=token_set kek_key=404142434445464748494a4b4c4d4e4f op=ra_enroll uid=jdoe pwd=SECret.123 num_threads=1 extensions=tokenType=userKey op=exit格式化 jdoe的令牌。该操作应该会成功。:
# tpsclient < token_format.txt注册 jdoe的令牌。该操作应该会成功:
# tpsclient < token_enroll.txt
测试后恢复更改
验证后删除添加的测试令牌:
-
登录到位于
https://rhcs10.example.com:25443/tps/ui/的 TPS WebUI - 单击 Tokens,然后选中令牌 in 复选框。
- 单击 Remove,然后确认。
-
登录到位于
或者,您可以使用 CLI 命令删除测试令牌。例如:
# pki -d /root/.dogtag/pki_rsa_bootstrap/certs_db/ -n "PKI Bootstrap Administrator for RSA-TPS" -c SECret.123 -p 25443 tps-token-find ----------------- 1 entries matched ----------------- Token ID: 40906145C76224192D2B User ID: jdoe Type: userKey Status: ACTIVE Next States: DAMAGED, PERM_LOST, SUSPENDED, TERMINATED Applet ID: 1.4.58768072 Key Info: 0101 Policy: RE_ENROLL=YES;RENEW=NO;FORCE_FORMAT=NO;PIN_RESET=NO;RESET_PIN_RESET_TO_NO=NO Date Created: Tue Dec 19 13:17:46 EST 2023 Date Modified: Tue Dec 19 13:17:50 EST 2023 ---------------------------- Number of entries returned 1 ----------------------------# pki -d /root/.dogtag/pki_rsa_bootstrap/certs_db/ -n "PKI Bootstrap Administrator for RSA-TPS" -c SECret.123 -p 25443 tps-token-del 40906145C76224192D2B ------------------------------------ Deleted token "40906145C76224192D2B" ------------------------------------将
op.enroll.userKey.keyGen.keyType.num恢复到 2:停止 TPS:
# pki-server stop rhcs10-RSA-TPS编辑
/var/lib/pki/rhcs10-RSA-TPS/tps/conf/CS.cfg配置文件,并将op.enroll.userKey.keyGen.keyType.num参数从 1 改为 2。例如:op.enroll.userKey.keyGen.keyType.num=2启动 TPS:
# pki-server start rhcs10-RSA-TPS
7.11.5. 为 TPS 配置 OAEP 支持 复制链接链接已复制到粘贴板!
将 TPS 配置为使用 OAEP (Optimal Asymmetric Encryption Padding)密钥传输协议通过编辑 TPS 的 CS.cfg 配置文件来完成。
本节适用于支持 AES 密钥 wrapping/unwrapping 的 HSM,如带有固件 v12.72.1 的 Entrust nShield Connect XC 单元。
前提条件
- 以 root 用户身份登录 rhcs10.example.com。
流程
停止 TPS:
# pki-server stop rhcs10-RSA-TPS-
编辑
/var/lib/pki/rhcs10-RSA-TPS/tps/conf/CS.cfg配置文件并添加以下行:
keyWrap.useOAEP=true
启动 TPS:
# pki-server start rhcs10-RSA-TPS
7.11.6. 为 TMS Server-Side-Keygen 配置 AES 支持 复制链接链接已复制到粘贴板!
这个 Red Hat Certificate System 版本(特别是 Token Management System 和 JAVA applet)已被改进,以支持最新的 HSM 以用于全局平台安全频道协议 3 (SCP03)智能卡令牌。这是因为添加了 AES Key Wrap With Padding (KWP)模式来处理密钥注入,这在 TMS Server-Side-Keygen 功能中主要使用。
您可以在以下位置找到新的 JAVA 小程序:/usr/share/pki/tps/applets/1.5.64260792.ijc
TPS CS.cfg
要使用这个小程序,您必须配置 TPS CS.cfg 配置文件,如下所示:
注册:
op.enroll.<tps profile>.update.applet.requiredVersion.prot.3=1.5.64260792对于格式:
op.format.<tps profile>.update.applet.requiredVersion.prot.3=1.5.64260792
请注意,您必须将任何其他配置集(包括外部注册)配置为使用此小程序。
例如:
op.enroll.userKey.update.applet.directory=/usr/share/pki/tps/applets
op.enroll.userKey.update.applet.emptyToken.enable=true
op.enroll.userKey.update.applet.enable=true
op.enroll.userKey.update.applet.encryption=true
op.enroll.userKey.update.applet.requiredVersion=1.4.58768072
op.enroll.userKey.update.applet.requiredVersion.prot.3=1.5.64260792
TPS server.xml
KWP 实现需要花费一些时间将私钥解封到令牌上。因此,需要增加 server.xml 文件中的连接超时值。例如,在 /var/lib/pki/rhcs10-RSA-TPS/conf/server.xml 中为 Secure Connector 设置以下 connectionTimeout 值:
connectionTimeout="300000”
尝试的值的建议取决于要注入的私钥的大小。最好是值两次,以确保支持各种密钥大小。
如果成功注册比等待时间更重要,您可以通过将 "-1" 分配给 connectionTimeout 来绕过超时:
connectionTimeout="-1”
TKS CS.cfg
tks.defKeySet.prot3.devKeyType=AES
tks.defKeySet.prot3.divers=gpkmc
tks.defKeySet.prot3.diversVer1Keys=none
tks.defKeySet.prot3.masterKeyType=AES
7.11.7. 设置密钥大小 复制链接链接已复制到粘贴板!
将所有 keysize 设置为大于或等于 2048 非常重要。例如:
op.enroll.userKey.keyGen.encryption.keySize=2048
op.enroll.userKey.keyGen.signing.keySize=2048
7.11.8. 设置 TPS phoneHome 复制链接链接已复制到粘贴板!
编辑
phoneHome.xml配置文件。例如:# vi /var/lib/pki/rhcs10-RSA-TPS/tps/conf/phoneHome.xml为 TPS 设置正确的 http 端口。例如:
<Operation>http://rhcs10.example.com:25080/tps/tps</Operation>它现在类似如下:
# cat phoneHome.xml <ServiceInfo> <IssuerName>Example Corp</IssuerName> <Services> <Operation>http://rhcs10.example.com:25080/tps/tps</Operation> <UI></UI> <EnrolledTokenBrowserURL>http://fedoraproject.org</EnrolledTokenBrowserURL> <EnrolledTokenURL></EnrolledTokenURL> <TokenType>userKey</TokenType> </Services> </ServiceInfo>- 保存并重启 TPS。
7.11.9. 创建 TPS 角色用户 复制链接链接已复制到粘贴板!
- 按照 第 7.12 节 “创建 PKI 角色用户” 中的步骤,在 TPS 中创建单角色管理员 agent,在 TPS 中创建审计用户。
7.11.10. 安装后 复制链接链接已复制到粘贴板!
如果要安装其他 RHCS 实例,请继续下一小节。完成所有需要的 RHCS 实例安装后,请访问 第 7.13 节 “安装后” 以完成额外的设置。