2.5. 使用 SSL 证书配置 Capsule 服务器
Red Hat Satellite 使用 SSL 证书启用 Satellite 服务器、外部胶囊服务器和所有主机之间的加密通信。根据您的机构要求,您必须使用默认或自定义证书配置 Capsule 服务器。
- 如果使用默认 SSL 证书,还必须为每个外部 Capsule 服务器配置不同的默认 SSL 证书。更多信息请参阅 第 2.5.1 节 “使用默认 SSL 证书配置 Capsule 服务器”。
- 如果使用自定义 SSL 证书,还必须为每个外部 Capsule 服务器配置不同的自定义 SSL 证书。更多信息请参阅 第 2.5.2 节 “使用自定义 SSL 证书配置 Capsule 服务器”。
2.5.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.5.2. 使用自定义 SSL 证书配置 Capsule 服务器 复制链接链接已复制到粘贴板!
如果将 Satellite 服务器配置为使用自定义 SSL 证书,还必须将每个外部 Capsule 服务器配置为使用不同的自定义 SSL 证书。
要使用自定义证书配置您的 Capsule 服务器,在每个 Capsule 服务器上完成以下步骤:
2.5.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 ]
CN = _{ssl-common-name}_
[ v3_req ]
basicConstraints = CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth, clientAuth, codeSigning, emailProtection
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = _{ssl-common-name}_
可选: 如果要向 CSR 添加可辨识名称(DN)详情,请在
[ req_distinguished_name ]部分添加以下信息:[req_distinguished_name] CN = capsule.example.com countryName =My_Country_Name1 stateOrProvinceName = My_State_Or_Province_Name2 localityName = My_Locality_Name3 organizationName = My_Organization_Or_Company_Name organizationalUnitName = My_Organizational_Unit_Name4 生成 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.pem3 将证书签名请求发送到证书颁发机构(CA)。同一 CA 必须为 Satellite 服务器和 Capsule 服务器签名证书。
提交请求时,指定证书的寿命。发送证书请求的方法会有所不同,因此请查阅 CA 查看首选方法。为了响应请求,您可以在单独的文件中接收 CA 捆绑包和签名证书。
2.5.2.2. 将自定义 SSL 证书部署到 Capsule 服务器 复制链接链接已复制到粘贴板!
使用这个流程,使用证书颁发机构签名的自定义 SSL 证书配置您的 Capsule 服务器。satellite-installer 命令返回 Capsule -certs-generate 命令对于每个胶囊服务器都是唯一的。不要在多个胶囊服务器上使用相同的命令。
先决条件
- Satellite 服务器配置了自定义证书。如需更多信息,请参阅 在 连接的网络环境中安装 Satellite 服务器 中的 使用自定义 SSL 证书配置 Satellite 服务器。
- 胶囊服务器已注册到 Satellite 服务器。如需更多信息,请参阅 注册到 Satellite 服务器。
- 安装了胶囊服务器软件包。如需更多信息,请参阅安装 Capsule 服务器软件包。
流程
在 Satellite 服务器上,验证自定义 SSL 证书输入文件:
# katello-certs-check \ -t capsule \ -c /root/capsule_cert/capsule_cert.pem \1 -k /root/capsule_cert/capsule_cert_key.pem \2 -b /root/capsule_cert/ca_cert_bundle.pem3 如果您在
/root/capsule_cert/openssl.cnf配置文件中为证书的 Common NameCN =设置通配符值,您必须将-t Capsule 选项添加到katello-certs-check命令中。如果命令成功,它会返回两个 Capsule
-certs-generate 命令,其中之一必须使用它来为您的胶囊服务器生成证书存档文件。katello-certs-check的输出示例Validation succeeded. To use them inside a NEW $CAPSULE, run this command: capsule-certs-generate --foreman-proxy-fqdn "$CAPSULE" \ --certs-tar "~/CAPSULE-certs.tar" \ --server-cert "/root/capsule_cert/capsule_cert.pem" \ --server-key "/root/capsule_cert/capsule_cert_key.pem" \ --server-ca-cert "/root/capsule_cert/ca_cert_bundle.pem" \ To use them inside an EXISTING $CAPSULE, run this command INSTEAD: capsule-certs-generate --foreman-proxy-fqdn "$CAPSULE" \ --certs-tar "~/CAPSULE-certs.tar" \ --server-cert "/root/capsule_cert/capsule_cert.pem" \ --server-key "/root/capsule_cert/capsule_cert_key.pem" \ --server-ca-cert "/root/capsule_cert/ca_cert_bundle.pem" \ --certs-update-server在受管主机上,从
katello-certs-check命令的输出中根据您的要求,输入 Capsule-certs-generate命令,为新的或现有胶囊生成证书。在这个命令中,将
CAPSULE更改为 Capsule 服务器的 FQDN。保留 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 /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.5.2.3. 将自定义 SSL 证书部署到主机 复制链接链接已复制到粘贴板!
在将 Capsule 服务器配置为使用自定义 SSL 证书后,还必须在注册到此 Capsule 服务器的每个主机上安装 katello-ca-consumer 软件包。
流程
在每个主机上安装
katello-ca-consumer软件包:# dnf install http://capsule.example.com/pub/katello-ca-consumer-latest.noarch.rpm