4.3. 使用自定义 SSL 证书配置 Capsule 服务器,以便在没有 Puppet 的情况下进行负载平衡
下面的部分论述了如何配置使用自定义 SSL 证书进行负载平衡的胶囊服务器,而无需 Puppet。
4.3.1. 为 Capsule 服务器创建自定义 SSL 证书
此流程概述了如何为证书签名请求创建配置文件,并将负载均衡器和 Capsule 服务器作为 Subject Alternative Names (SAN)包含。在您要为负载均衡配置的每个 Capsule 服务器上完成这个步骤。
流程
要存储所有源证书文件,请创建一个只能被
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 x509_extensions = usr_cert prompt = no [ req_distinguished_name ] commonName = capsule.example.com 1 [ v3_req ] basicConstraints = CA:FALSE keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth, clientAuth, codeSigning, emailProtection subjectAltName = @alt_names [alt_names] 2 DNS.1 = loadbalancer.example.com DNS.2 = 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 捆绑包和签名证书。
- 将您从证书颁发机构接收的证书颁发机构和胶囊服务器证书文件复制到您的 Satellite 服务器。
在 Satellite 服务器上,验证 Capsule 服务器证书输入文件:
# katello-certs-check \ -c /root/capsule_cert/capsule_cert.pem \ 1 -k /root/capsule_cert/capsule_cert_key.pem \ 2 -b /root/capsule_cert/ca_cert_bundle.pem 3
如果将
commonName=
设置为通配符值,您必须将-t Capsule 选项添加到
katello-certs-check
命令中。保留示例 Capsule
-certs-generate
命令的副本,该命令由katello-certs-check
命令输出,以便为此胶囊服务器创建证书归档文件。
4.3.2. 使用自定义 SSL 证书配置 Capsule 服务器,以便在没有 Puppet 的情况下进行负载平衡
下面的部分论述了如何配置使用自定义 SSL 证书进行负载平衡的胶囊服务器,而无需 Puppet。在您要为负载均衡配置的每个 Capsule 服务器上完成这个步骤。
流程
将以下选项附加到从
katello
命令中:-certs-check
命令的输出中获取的 Capsule-certs-generate--foreman-proxy-cname loadbalancer.example.com
在 Satellite 服务器上,输入 Capsule
-certs-generate
命令来生成 Capsule 证书:# capsule-certs-generate \ --certs-tar /root/capsule_cert/capsule.tar \ --foreman-proxy-cname loadbalancer.example.com \ --foreman-proxy-fqdn capsule.example.com \ --server-ca-cert /root/capsule_cert/ca_cert_bundle.pem \ --server-cert /root/capsule_cert/capsule.pem \ --server-key /root/capsule_cert/capsule.pem
从输出保留示例
satellite-installer
命令的副本,用于安装 Capsule 服务器证书。将证书存档文件从 Satellite 服务器复制到 Capsule 服务器:
# scp /root/capsule.example.com-certs.tar root@capsule.example.com:capsule.example.com-certs.tar
将以下选项附加到您从 Capsule-
certs-generate 命令的输出中获取的
命令中:satellite-
installer--certs-cname "loadbalancer.example.com" \ --enable-foreman-proxy-plugin-remote-execution-script
在 Capsule 服务器上,输入
satellite-installer
命令:# satellite-installer --scenario capsule \ --certs-cname "loadbalancer.example.com" \ --certs-tar-file "capsule.example.com-certs.tar" \ --enable-foreman-proxy-plugin-remote-execution-script \ --foreman-proxy-foreman-base-url "https://satellite.example.com" \ --foreman-proxy-oauth-consumer-key "oauth key" \ --foreman-proxy-oauth-consumer-secret "oauth secret" \ --foreman-proxy-register-in-foreman "true" \ --foreman-proxy-trusted-hosts "satellite.example.com" \ --foreman-proxy-trusted-hosts "capsule.example.com"