2.7. 使用 SSL 证书配置 Capsule 服务器
Red Hat Satellite 使用 SSL 证书启用 Satellite 服务器、外部胶囊服务器和所有主机之间的加密通信。根据您的机构要求,您必须使用默认或自定义证书配置 Capsule 服务器。
- 如果使用默认 SSL 证书,还必须为每个外部 Capsule 服务器配置不同的默认 SSL 证书。更多信息请参阅 第 2.7.1 节 “使用默认 SSL 证书配置 Capsule 服务器”。
- 如果使用自定义 SSL 证书,还必须为每个外部 Capsule 服务器配置不同的自定义 SSL 证书。更多信息请参阅 第 2.7.2 节 “使用自定义 SSL 证书配置 Capsule 服务器”。
2.7.1. 使用默认 SSL 证书配置 Capsule 服务器
使用本节为胶囊服务器配置由 Satellite 服务器默认证书颁发机构(CA)签名的 SSL 证书。
先决条件
- 胶囊服务器已注册到 Satellite 服务器。如需更多信息,请参阅 注册到 Satellite 服务器。
- 安装了胶囊服务器软件包。如需更多信息,请参阅安装 Capsule 服务器软件包。
流程
在 Satellite 服务器上,要为您的胶囊服务器存储所有源证书文件,请创建一个只能被
root
用户访问的目录,如/root/capsule_cert
:# mkdir /root/capsule_cert
在 Satellite 服务器上,为您的 Capsule 服务器生成
/root/capsule_cert/ Capsule.example.com-certs.tar
证书存档:# capsule-certs-generate \ --foreman-proxy-fqdn capsule.example.com \ --certs-tar /root/capsule_cert/capsule.example.com-certs.tar
保留 Capsule-
certs-generate 命令返回的
命令的副本,以将证书部署到您的胶囊服务器。satellite-
installerCapsule
-certs-generate 的输出示例
output omitted satellite-installer --scenario capsule \ --certs-tar-file "/root/capsule_cert/capsule.example.com-certs.tar" \ --foreman-proxy-register-in-foreman "true" \ --foreman-proxy-foreman-base-url "https://satellite.example.com" \ --foreman-proxy-trusted-hosts "satellite.example.com" \ --foreman-proxy-trusted-hosts "capsule.example.com" \ --foreman-proxy-oauth-consumer-key "s97QxvUAgFNAQZNGg4F9zLq2biDsxM7f" \ --foreman-proxy-oauth-consumer-secret "6bpzAdMpRAfYaVZtaepYetomgBVQ6ehY"
在 Satellite 服务器上,将证书归档文件复制到您的 Capsule 服务器中:
# scp /root/capsule_cert/capsule.example.com-certs.tar \ root@capsule.example.com:/root/capsule.example.com-certs.tar
在 Capsule 服务器上,若要部署证书,请输入 Capsule-
certs-generate 命令返回的
命令。satellite-
installer当到 Satellite 的网络连接或端口尚未打开时,您可以将
--foreman-proxy-register-in-foreman
选项设置为false
,以防止 Capsule 尝试连接到 Satellite 并报告错误。当网络和防火墙正确配置时,再次运行安装程序,并将此选项设置为true
。重要部署证书后不要删除证书存档文件。例如,在升级胶囊服务器时是必需的。
2.7.2. 使用自定义 SSL 证书配置 Capsule 服务器
如果将 Satellite 服务器配置为使用自定义 SSL 证书,还必须将每个外部 Capsule 服务器配置为使用不同的自定义 SSL 证书。
要使用自定义证书配置您的 Capsule 服务器,在每个 Capsule 服务器上完成以下步骤:
2.7.2.1. 为 Capsule 服务器创建自定义 SSL 证书
在受管主机上,为您的胶囊服务器创建一个自定义证书。如果您已经为 Capsule 服务器有自定义 SSL 证书,请跳过这个过程。
流程
要存储所有源证书文件,请创建一个只能被
root
用户访问的目录:# mkdir /root/capsule_cert
创建为证书签名请求(CSR)签名的私钥。
请注意,私钥必须未加密。如果您使用密码保护的私钥,请删除私钥密码。
如果您已有此胶囊服务器的私钥,请跳过这一步。
# openssl genrsa -out
/root/capsule_cert/capsule_cert_key.pem
4096为 CSR 创建
/root/capsule_cert/openssl.cnf
配置文件并包含以下内容:[ req ] req_extensions = v3_req distinguished_name = req_distinguished_name prompt = no [ req_distinguished_name ] commonName = capsule.example.com [ v3_req ] basicConstraints = CA:FALSE keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth, clientAuth, codeSigning, emailProtection subjectAltName = @alt_names [ alt_names ] DNS.1 = capsule.example.com
可选: 如果要向 CSR 添加可辨识名称(DN)详情,请在
[ req_distinguished_name ]
部分添加以下信息:[req_distinguished_name] CN = capsule.example.com countryName =My_Country_Name 1 stateOrProvinceName = My_State_Or_Province_Name 2 localityName = My_Locality_Name 3 organizationName = My_Organization_Or_Company_Name organizationalUnitName = My_Organizational_Unit_Name 4
生成 CSR:
# openssl req -new \ -key /root/capsule_cert/capsule_cert_key.pem \ 1 -config /root/capsule_cert/openssl.cnf \ 2 -out /root/capsule_cert/capsule_cert_csr.pem 3
将证书签名请求发送到证书颁发机构(CA)。同一 CA 必须为 Satellite 服务器和 Capsule 服务器签名证书。
提交请求时,指定证书的寿命。发送证书请求的方法会有所不同,因此请查阅 CA 查看首选方法。为了响应请求,您可以在单独的文件中接收 CA 捆绑包和签名证书。
2.7.2.2. 将自定义 SSL 证书部署到 Capsule 服务器
使用这个流程,使用证书颁发机构签名的自定义 SSL 证书配置您的 Capsule 服务器。satellite-installer
命令返回 Capsule -certs-generate
命令对于每个胶囊服务器都是唯一的。不要在多个胶囊服务器上使用相同的命令。
先决条件
- Satellite 服务器配置了自定义证书。如需更多信息,请参阅 在 连接的网络环境中安装 Satellite 服务器 中的 配置带有自定义 SSL 证书的 Satellite 服务器。
- 胶囊服务器已注册到 Satellite 服务器。如需更多信息,请参阅 注册到 Satellite 服务器。
- 安装了胶囊服务器软件包。如需更多信息,请参阅安装 Capsule 服务器软件包。
流程
在 Satellite 服务器上生成证书捆绑包:
# capsule-certs-generate \ --foreman-proxy-fqdn capsule.example.com \ --certs-tar ~/capsule.example.com-certs.tar \ --server-cert /root/capsule_cert/capsule_cert.pem \ 1 --server-key /root/capsule_cert/capsule_cert_key.pem \ 2 --server-ca-cert "/root/capsule_cert/ca_cert_bundle.pem \ 3 --certs-update-server
保留 Capsule-
certs-generate 命令返回的
命令的副本,以将证书部署到您的胶囊服务器。satellite-
installerCapsule
-certs-generate 的输出示例
output omitted satellite-installer --scenario capsule \ --certs-tar-file "/root/capsule.example.com-certs.tar" \ --foreman-proxy-register-in-foreman "true" \ --foreman-proxy-foreman-base-url "https://satellite.example.com" \ --foreman-proxy-trusted-hosts "satellite.example.com" \ --foreman-proxy-trusted-hosts "capsule.example.com" \ --foreman-proxy-oauth-consumer-key "My_OAuth_Consumer_Key" \ --foreman-proxy-oauth-consumer-secret "My_OAuth_Consumer_Secret"
在 Satellite 服务器上,将证书归档文件复制到您的 Capsule 服务器中:
# scp ~/capsule.example.com-certs.tar \ root@capsule.example.com:/root/capsule.example.com-certs.tar
在 Capsule 服务器上,若要部署证书,请输入 Capsule-
certs-generate 命令返回的
命令。satellite-
installer如果 Satellite 的网络连接或端口尚未打开,您可以将
--foreman-proxy-register-in-foreman
选项设置为false
,以防止 Capsule 尝试连接到 Satellite 并报告错误。当网络和防火墙正确配置时,再次运行安装程序,并将此选项设置为true
。重要部署证书后不要删除证书存档文件。例如,在升级胶囊服务器时是必需的。
2.7.2.3. 将自定义 SSL 证书部署到主机
将 Satellite 配置为使用自定义 SSL 证书后,您必须将证书部署到注册到 Satellite 的主机。
流程
更新每个主机上的 SSL 证书:
# dnf install http://capsule.example.com/pub/katello-ca-consumer-latest.noarch.rpm