6.4. 安装 Red Hat Directory Server
Red Hat Certificate System 使用 Red Hat Directory Server 来存储系统证书和用户数据。您可以在同一主机或网络中的不同主机上安装目录服务器和证书系统。
如果要在托管 Directory Server 的 RHEL 系统上启用 FIPS 模式,则必须在安装 Directory Server 前在 RHEL 主机上启用 FIPS 模式。
确保启用了 FIPS 模式:
# sysctl crypto.fips_enabled
如果返回的值为 1
,则启用 FIPS 模式。
6.4.1. 安装目录服务器软件包
执行以下步骤来安装 Red Hat Directory Server 软件包:
- 确保您已附加了一个向主机提供目录服务器的订阅。
启用 Directory Server 存储库:
# subscription-manager repos --enable=dirsrv-11-for-rhel-8-x86_64-rpms
安装 Directory 服务器和 openldap-clients 软件包:
# dnf module install redhat-ds:11
# dnf install openldap-clients
6.4.2. 目录服务器实例创建
注:安装 DS 实例前,请确保完成以下流程:
按照此过程为 PKI 服务器准备本地 DS 实例。
注: DS 安装自动生成 bootstrap 自签名签名证书,该证书为 SSL 连接发布 bootstrap 服务器证书。PKI 安装利用此安全提供的 完成安装。安装之后,bootstrap 服务器证书可以替换为由实际 CA 发布的服务器证书。
如果要禁用 bootstrap 证书生成和 SSL 连接,请在 sed
命令中设置 self_sign_cert = False
。您仍然可以稍后启用 SSL 连接,方法是通过 Bootstrap Cert 在 DS 中启用 SSL 连接。
6.4.2.1. 创建 DS 实例
6.4.2.1.1. 生成 DS 配置文件,如 ds.inf
:
$ dscreate create-template ds.inf
自定义 DS 配置文件,如下所示:
$ sed -i \ -e "s/;instance_name = ./instance_name = localhost/g" \ -e "s/;root_password = ./root_password = Secret.123/g" \ -e "s/;suffix = ./suffix = dc=example,dc=com/g" \ -e "s/;create_suffix_entry = ./create_suffix_entry = True/g" \ -e "s/;self_sign_cert = .*/self_sign_cert = True/g" \ ds.inf
其中
-
instance_name 指定 DS 实例的名称。在本例中,它设置为
localhost
。 -
root_password 指定 DS admin 的密码,即
cn=Directory Manager
。在本例中,它被设置为Secret.123。
-
后缀 指定 DS 实例的命名空间。在本例中,它被设置为
dc=example,dc=com
。 -
self_sign_cert 指定是否为 SSL 连接创建自签名证书。在本例中,它被设置为
True
。启用 SSL 连接。
如需更多信息,请参阅 DS 配置文件本身(即 ds.inf
)和 DS 文档中的 参数描述。
6.4.2.1.2. 创建实例
最后,创建实例:
$ dscreate from-file ds.inf
6.4.2.2. 创建 PKI 子树
DS 实例最初为空。使用 LDAP 客户端添加 root 条目和 PKI 基础条目,例如:
$ ldapadd -H ldap://$HOSTNAME -x -D "cn=Directory Manager" -w Secret.123 << EOF dn: dc=pki,dc=example,dc=com objectClass: domain dc: pki EOF
安装子系统时,将创建各个 PKI 子系统的子树。创建所有 PKI 子系统时,LDAP 树类似如下:
dc=example,dc=com + dc=pki + dc=ca + dc=kra + dc=ocsp + dc=tks + dc=tps + dc=acme + dc=est
6.4.2.3. 启用 SSL 连接
如果您之前设置了 self_sign_cert = False
,并且现在决定创建 bootstrap 证书,以便使用 SSL 连接到 DS 安装 PKI,请遵循 DS 中启用 SSL 连接
注: bootstrap 服务器证书可能会在安装后由实际 CA 发布的服务器证书替换。
6.4.2.4. 配置复制
6.4.2.5. 删除 DS 实例
删除 DS 实例:
$ dsctl localhost remove --do-it
6.4.2.6. 日志文件
DS 日志文件位于 /var/log/dirsrv/slapd-localhost
中:
- access
- audit
- errors
6.4.2.7. 另请参阅
6.4.3. 附加红帽订阅并启用证书系统软件包存储库
在安装和更新证书系统前,您必须启用对应的存储库:
将红帽订阅附加到系统:
如果您的系统已经注册或具有附加了证书系统的订阅,请跳过这一步。
将该系统注册到红帽订阅管理服务。
您可以使用
--auto-attach
选项为操作系统自动应用可用的订阅。# subscription-manager register --auto-attach Username: admin@example.com Password: The system has been registered with id: 566629db-a4ec-43e1-aa02-9cbaa6177c3f Installed Product Current Status: Product Name: Red Hat Enterprise Linux Server Status: Subscribed
列出可用的订阅并记录提供红帽认证系统的池 ID。例如:
# subscription-manager list --available --all ... Subscription Name: Red Hat Enterprise Linux Developer Suite Provides: ... Red Hat Certificate System ... Pool ID: 7aba89677a6a38fc0bba7dac673f7993 Available: 1 ...
如果您有很多订阅,命令的输出可能会非常长。您可以选择将输出重定向到文件中:
# subscription-manager list --available --all > /root/subscriptions.txt
使用上一步中的池 ID 将证书系统订阅附加到系统:
# subscription-manager attach --pool=7aba89677a6a38fc0bba7dac673f7993 Successfully attached a subscription for: Red Hat Enterprise Linux Developer Suite
启用证书系统存储库:
# subscription-manager repos --enable certsys-10.x-for-rhel-8-x86_64-rpms Repository 'certsys-10-for-rhel-8-x86_64-rpms' is enabled for this system.
启用证书系统模块流:
# dnf module enable redhat-pki
第 7 章 安装和配置 Red Hat Certificate System 中描述了安装所需的软件包。
为合规,仅启用红帽批准的存储库。只有 Red Hat 批准的软件仓库只能通过 subscription-manager
工具启用。