16.3. 为 CA、OCSP、KRA 或 TKS 管理用户和组
用户可以执行的操作由它们所属的组决定;例如,CA 的代理管理证书和配置文件,而管理员管理 CA 服务器配置。
四个子系统 - CA、OCSP、KRA 和 TKS - 使用 Java 管理控制台管理组和用户。TPS 具有基于 Web 的管理员服务,用户和组则通过其网页进行配置。
16.3.1. 管理组
16.3.1.1. 创建新组
登录到管理控制台。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pkiconsole https://server.example.com:8443/subsystem_type
pkiconsole https://server.example.com:8443/subsystem_type
注意pkiconsole
已被弃用。- 从左侧的导航菜单中选择 Users and Groups。
- 选择 Groups 选项卡。
单击
,然后填写组信息。只能添加已存在于内部数据库中的用户。
- 编辑 ACL 以授予组特权。请参阅 第 16.5.3.1 节 “编辑 ACL” 了解更多信息。如果没有将 ACI 添加到组的 ACL 中,则组不会对证书系统的任何部分没有访问权限。
16.3.1.2. 更改组中的成员
可以从所有组中添加或删除成员。管理员的组必须至少有一个用户条目。
- 登录到管理控制台。
- 从左侧的导航树中选择" 用户和组 "。
- 点 Groups 选项卡。
- 从名称列表中选择组,然后单击 。
进行适当的更改。
- 要更改组描述,请在 Group description 字段中键入新描述。
- 若要从组中删除用户,请选择用户,然后单击 。
- 要添加用户,请单击 。从对话框中选择要添加的用户, 。
16.3.2. 管理用户(管理员、代理和审核员)
每个子系统的用户单独维护。只是因为个人是一个子系统中的管理员,并不表示个人具有另一子系统的任何权限(甚至用户条目)。用户可以配置,并使用其用户证书,作为子系统的代理、管理员或审核员信任。
16.3.2.1. 创建用户
安装证书系统后,只有设置期间创建的用户已存在。这部分论述了如何创建用户。
出于安全性和审计的原因,为证书系统用户和管理员创建单独的帐户。
16.3.2.1.1. 使用命令行创建用户
使用命令行创建用户:
添加用户帐户。例如,将
example
用户添加到 CA 中:Copy to Clipboard Copied! Toggle word wrap Toggle overflow pki -d ~/.dogtag/pki-instance_name/ca/alias/ -c password -n caadmin \ ca-user-add example --fullName "Example User"
# pki -d ~/.dogtag/pki-instance_name/ca/alias/ -c password -n caadmin \ ca-user-add example --fullName "Example User" --------------------- Added user "example" --------------------- User ID: example Full name: Example User
此命令使用
caadmin
用户添加新帐户。(可选)将用户添加到组中。例如,将
example
用户添加到Certificate Manager Agents
组中:Copy to Clipboard Copied! Toggle word wrap Toggle overflow pki -d ~/.dogtag/pki-instance_name/ -p password -n "caadmin" \ user-add-membership example Certificate Manager Agents
# pki -d ~/.dogtag/pki-instance_name/ -p password -n "caadmin" \ user-add-membership example Certificate Manager Agents
创建证书请求:
如果您的证书系统环境中存在密钥恢复授权(KRA):
Copy to Clipboard Copied! Toggle word wrap Toggle overflow CRMFPopClient -d /home/example-user/certs_db -p password -n "CN=user_name" -q POP_SUCCESS -b kra.transport -w "AES KeyWrap/Wrapped" -v -o ~/user_name.req -oaep
# CRMFPopClient -d /home/example-user/certs_db -p password -n "CN=user_name" -q POP_SUCCESS -b kra.transport -w "AES KeyWrap/Wrapped" -v -o ~/user_name.req -oaep
此命令会在
~/user_name.req
文件中以CRMF
格式存储证书签名请求(CSR)。注意如果为其配置了服务器,则 use
-oaep
。如果现代 HSM 首选 AES/CBC/PKCS5Padding,则使用 AES KeyWrap/WrapWrapped。如果您的证书系统环境中没有密钥恢复授权(KRA):
创建 NSS 数据库目录:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow export pkiinstance=ca1 echo ${pkiinstance} export agentdir=~/.dogtag/${pkiinstance}/agent1.dir echo ${agentdir} pki -d ${agentdir}/ -C ${somepwdfile} client-init
# export pkiinstance=ca1 # echo ${pkiinstance} # export agentdir=~/.dogtag/${pkiinstance}/agent1.dir # echo ${agentdir} # pki -d ${agentdir}/ -C ${somepwdfile} client-init
将 CSR 存储在由
-o
选项指定的 PKCS-1/0 格式的文件中,为初始化 NSS 数据库目录的路径,使用-P
选项用于密码文件,-p
作为密码,以及主题 DN:Copy to Clipboard Copied! Toggle word wrap Toggle overflow PKCS10Client -d ${agentdir}/ -P ${somepwdfile} -n "cn=agent1,uid=agent1" -o ${agentdir}/agent1.csr
# PKCS10Client -d ${agentdir}/ -P ${somepwdfile} -n "cn=agent1,uid=agent1" -o ${agentdir}/agent1.csr PKCS10Client: Certificate request written into /.dogtag/ca1/agent1.dir/agent1.csr PKCS10Client: PKCS#10 request key id written into /.dogtag/ca1/agent1.dir/agent1.csr.keyId
创建注册请求:
使用以下内容创建
~/cmc.role'crmf.cfg
文件:Copy to Clipboard Copied! Toggle word wrap Toggle overflow #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 space. input=~/user_name.req #output: full path for the CMC request in binary format output=~/cmc.role_crmf.req #tokenname: name of token where agent signing cert can be found (default is internal) tokenname=internal #nickname: nickname for agent certificate which will be used #to sign the CMC full request. nickname=PKI Administrator for Example.com #dbdir: directory for cert9.db, key4.db and pkcs11.txt dbdir=~/.dogtag/pki-instance_name/ #password: password for cert9.db which stores the agent #certificate password=password #format: request format, either pkcs10 or crmf format=crmf
#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 space. input=~/user_name.req #output: full path for the CMC request in binary format output=~/cmc.role_crmf.req #tokenname: name of token where agent signing cert can be found (default is internal) tokenname=internal #nickname: nickname for agent certificate which will be used #to sign the CMC full request. nickname=PKI Administrator for Example.com #dbdir: directory for cert9.db, key4.db and pkcs11.txt dbdir=~/.dogtag/pki-instance_name/ #password: password for cert9.db which stores the agent #certificate password=password #format: request format, either pkcs10 or crmf format=crmf
根据您的环境以及上一步中使用的 CSR 格式设置参数。
将之前创建的配置文件传递给
CMCRequest
工具,以创建 CMC 请求:Copy to Clipboard Copied! Toggle word wrap Toggle overflow CMCRequest ~/cmc.role_crmf.cfg
# CMCRequest ~/cmc.role_crmf.cfg
通过 CMS (CMC)请求提交证书管理:
使用以下内容创建
~/HttpClient'role_crmf.cfg
文件:Copy to Clipboard Copied! Toggle word wrap Toggle overflow #host: host name for the http server
# #host: host name for the http server host=server.example.com #port: port number port=8443 #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=~/cmc.role_crmf.req #output: full path for the response in binary format output=~/cmc.role_crmf.resp #tokenname: name of token where SSL client authentication cert can be found (default is internal) #This parameter will be ignored if secure=false tokenname=internal #dbdir: directory for cert9.db, key4.db and pkcs11.txt #This parameter will be ignored if secure=false dbdir=~/.dogtag/pki-instance_name/ #clientmode: true for client authentication, false for no client authentication #This parameter will be ignored if secure=false clientmode=true #password: password for cert9.db #This parameter will be ignored if secure=false and clientauth=false password=password #nickname: nickname for client certificate #This parameter will be ignored if clientmode=false nickname=PKI Administrator for Example.com #servlet: servlet name servlet=/ca/ee/ca/profileSubmitCMCFull
根据您的环境设置参数。
向 CA 提交请求:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow HttpClient ~/HttpClient_role_crmf.cfg
# HttpClient ~/HttpClient_role_crmf.cfg Total number of bytes read = 3776 after SSLSocket created, thread token is Internal Key Storage Token client cert is not null handshake happened writing to socket Total number of bytes read = 2523 MIIJ1wYJKoZIhvcNAQcCoIIJyDCCCcQCAQMxDzANBglghkgBZQMEAgEFADAxBggr ... The response in data format is stored in ~/cmc.role_crmf.resp
验证结果:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow CMCResponse ~/cmc.role_crmf.resp
# CMCResponse ~/cmc.role_crmf.resp Certificates: Certificate: Data: Version: v3 Serial Number: 0xE Signature Algorithm: SHA256withRSA - 1.2.840.113549.1.1.11 Issuer: CN=CA Signing Certificate,OU=pki-instance_name Security Domain Validity: Not Before: Friday, July 21, 2017 12:06:50 PM PDT America/Los_Angeles Not After: Wednesday, January 17, 2018 12:06:50 PM PST America/Los_Angeles Subject: CN=user_name ... Number of controls is 1 Control #0: CMCStatusInfoV2 OID: {1 3 6 1 5 5 7 7 25} BodyList: 1 Status: SUCCESS
(可选)以用户身份将证书导入到自己的
~/.dogtag/pki-instance_name/
数据库:Copy to Clipboard Copied! Toggle word wrap Toggle overflow certutil -d ~/.dogtag/pki-instance_name/ -A -t "u,u,u" -n "user_name certificate" -i ~/cmc.role_crmf.resp
# certutil -d ~/.dogtag/pki-instance_name/ -A -t "u,u,u" -n "user_name certificate" -i ~/cmc.role_crmf.resp
将证书添加到用户记录中:
列出用户签发的证书,以发现证书的序列号。例如,列出在证书主体中包含
示例
用户名的证书:Copy to Clipboard Copied! Toggle word wrap Toggle overflow pki -d ~/.dogtag/pki-instance_name/ -c password -n caadmin ca-user-cert-find example ----------------- 1 entries matched ----------------- Cert ID: 2;6;CN=CA Signing Certificate,O=EXAMPLE;CN=PKI Administrator,E=example@example.com,O=EXAMPLE Version: 2 Serial Number: 0x6 Issuer: CN=CA Signing Certificate,O=EXAMPLE Subject: CN=PKI Administrator,E=example@example.com,O=EXAMPLE ---------------------------- Number of entries returned 1
pki -d ~/.dogtag/pki-instance_name/ -c password -n caadmin ca-user-cert-find example ----------------- 1 entries matched ----------------- Cert ID: 2;6;CN=CA Signing Certificate,O=EXAMPLE;CN=PKI Administrator,E=example@example.com,O=EXAMPLE Version: 2 Serial Number: 0x6 Issuer: CN=CA Signing Certificate,O=EXAMPLE Subject: CN=PKI Administrator,E=example@example.com,O=EXAMPLE ---------------------------- Number of entries returned 1
下一步需要证书的序列号。
使用证书仓库中的序列号将证书添加到证书系统数据库中的用户帐户。例如,对于 CA 用户:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pki -c password -n caadmin ca-user-cert-add example --serial 0x6
pki -c password -n caadmin ca-user-cert-add example --serial 0x6
16.3.2.1.2. 使用控制台创建用户
使用 PKI 控制台创建用户:
登录到管理控制台。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pkiconsole https://server.example.com:8443/subsystem_type
pkiconsole https://server.example.com:8443/subsystem_type
注意pkiconsole
已被弃用。- 在 Configuration 选项卡中,选择" 用户和组 "。点 。
在 Edit User Information 对话框中填写信息。
大多数信息都是标准用户信息,如用户名、电子邮件地址和密码。此窗口还包含名为 User State 的字段,它可以包含任何字符串,用于添加用户的附加信息;基本上,此字段可以显示是否是活动用户。
- 选择用户所属的组。用户的组成员资格决定了用户具有哪些特权。将代理、管理员和审核员分配给适当的子系统组。
存储用户的证书。
- 通过 CA 端到端服务页面请求用户证书。
- 如果没有为用户配置文件配置自动注册,则批准证书请求。
- 使用通知电子邮件中提供的 URL 检索证书,并将 base-64 编码证书复制到本地文件或剪贴板。
- 选择新用户条目,然后单击 。
- 单击 ,并粘贴 base-64 编码证书。
16.3.2.2. 更改证书系统用户证书
- 登录到管理控制台。
- 选择 "用户和组 "。
- 从用户 ID 列表中选择要编辑的用户,然后单击 。
- 单击 以添加新证书。
-
在 Import Certificate 窗口中,将新证书粘贴到文本区域中。包含
-----BEGIN CERTIFICATE-----
和-----END CERTIFICATE-----
标记行。
16.3.2.3. 续订管理员、代理和审核员用户证书
更新证书的方法有两种。重新生成证书 会取其原始密钥及其原始配置集和请求,并使用新的有效期和过期日期重新创建相同的密钥。重新加密 证书将初始证书请求重新提交到原始配置文件,但会生成一个新密钥对。管理员可以通过重新密钥来更新管理员证书。
每个子系统都有一个 bootstrap 用户,该用户在创建子系统时创建。在使用默认续订配置文件之一之前,可为此用户请求新证书。
可以使用原始证书的序列号直接在最终用户注册表单中续订管理用户的证书。
在 CA 的最终用户表单中续订 admin 用户证书,如 第 5.4.1.1.2 节 “基于证书的续订” 所述。这必须与首次发布的证书(或克隆)相同。
通过在结束日期页面中使用基于证书的续订表单,可以续订代理证书。自我续订用户 SSL 客户端证书.此表单可识别和更新浏览器证书存储中存储的证书。
注意您还可以使用
certutil
续订证书,如 第 18.3.3 节 “使用certutil
续订证书” 所述。certutil
使用带有原始密钥的输入文件,而不是使用存储在浏览器中的证书来启动续订。将更新的用户条目添加到内部 LDAP 数据库中的用户条目。
打开子系统的控制台。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pkiconsole https://server.example.com:admin_port/subsystem_type
pkiconsole https://server.example.com:admin_port/subsystem_type
注意pkiconsole
已被弃用。- 配置 | 用户和组 | 用户 | 管理员 | 证书 | 导入
- 在 Configuration 选项卡中,选择" 用户和组 "。
- 在 Users 选项卡中,使用更新的证书双击用户条目,然后单击 。
- 单击 ,并粘贴 base-64 编码证书。
这也可以通过使用 ldapmodify
直接将更新的认证添加到内部 LDAP 数据库中的用户条目,方法是替换用户条目中的 userCertificate
属性,如 uid=admin,ou=people,dc=subsystem-base-DN
。
16.3.2.4. 续订过期的管理员、代理和审核员用户证书
当有效用户证书已过期时,您无法再使用 Web 服务页面或需要身份验证的 pki
命令行工具。在这种情况下,您可以使用 pki-server cert-fix
命令来续订过期的证书。
在继续操作前,请确保:
- 您有一个有效的 CA 证书。
- 您有 root 权限。
流程
禁用自我测试。
运行以下命令:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pki-server selftest-disable -i PKI_instance
# pki-server selftest-disable -i PKI_instance
或者从 CA 的
CS.cfg
文件中删除以下行并重启 CA 子系统:Copy to Clipboard Copied! Toggle word wrap Toggle overflow selftests.container.order.startup=CAPresence:critical, SystemCertsVerification:critical
selftests.container.order.startup=CAPresence:critical, SystemCertsVerification:critical
检查客户端的 NSS 数据库中过期的证书,并找到证书的序列号(证书 ID)。
列出用户证书:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow certutil -L -d /root/nssdb/
# certutil -L -d /root/nssdb/
获取您要续订的过期证书序列号:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow certutil -L -d /root/nssdb/ -n Expired_cert | grep Serial
# certutil -L -d /root/nssdb/ -n Expired_cert | grep Serial Serial Number: 16 (0x10)
续订证书。本地 LDAP 服务器需要 LDAP 目录管理器的密码。
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pki-server cert-fix --ldap-url ldap://host389 --agent-uid caadmin -i PKI_instance -p PKI_https_port --extra-cert 16
# pki-server cert-fix --ldap-url ldap://host389 --agent-uid caadmin -i PKI_instance -p PKI_https_port --extra-cert 16
重新启用自我测试。
运行以下命令:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pki-server selftest-enable -i PKI_instance
# pki-server selftest-enable -i PKI_instance
或者将以下行添加到 CA 的 CS.cfg 文件中并重启 CA 子系统:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow selftests.container.order.startup=CAPresence:critical, SystemCertsVerification:critical
selftests.container.order.startup=CAPresence:critical, SystemCertsVerification:critical
要验证您在证书续订中是否成功,您可以运行以下命令来显示有关证书的足够信息:
pki ca-cert-find
# pki ca-cert-find
要查看特定证书的完整详情,包括属性、扩展、公钥 modulus、哈希等,您也可以运行:
pki ca-cert-show 16 --pretty
# pki ca-cert-show 16 --pretty
16.3.2.5. 删除证书系统用户
用户可以从内部数据库中删除。从内部数据库中删除用户会从用户所属的所有组中删除该用户。要从特定组中删除用户,请修改组成员资格。
通过执行以下操作,从内部数据库中删除特权用户:
- 登录到管理控制台。
- 从左侧的导航菜单中选择 Users and Groups。
- 从用户 ID 列表中选择用户,然后单击 。
- 提示时确认删除。