4.4. 使用自定义 SSL 证书配置胶囊服务器以使用 Puppet 负载平衡


下面的部分论述了如何配置使用自定义 SSL 证书进行 Puppet 负载平衡的胶囊服务器。

4.4.1. 为胶囊服务器创建自定义 SSL 证书

此流程概述了如何为证书签名请求创建配置文件,并包含负载均衡器和胶囊服务器,作为主题备用名称(SAN)。在您要为负载均衡配置的每个胶囊服务器上完成这个步骤。

流程

  1. 在 Capsule Server 上,创建包含所有源证书文件的目录,仅可供 root 用户访问:

    # mkdir /root/capsule_cert
    # cd /root/capsule_cert
    Copy to Clipboard Toggle word wrap
  2. 创建为证书签名请求(CSR)签名的私钥。

    请注意,私钥必须未加密的。如果您使用受密码保护的私钥,请删除私钥密码。

    如果您已拥有此胶囊服务器的私钥,请跳过这一步。

    # openssl genrsa -out /root/capsule_cert/capsule.pem 4096
    Copy to Clipboard Toggle word wrap
  3. 使用以下内容创建证书请求配置文件:

    [ req ]
    default_bits       = 4096
    distinguished_name = req_distinguished_name
    req_extensions     = req_ext
    prompt = no
    
    [ req_distinguished_name ]
    countryName=2 Letter Country Code
    stateOrProvinceName=State or Province Full Name
    localityName=Locality Name
    0.organizationName=Organization Name
    organizationalUnitName=Capsule Organization Unit Name
    commonName=capsule.example.com  
    1
    
    emailAddress=Email Address
    
    [ req_ext ]
    #authorityKeyIdentifier=keyid,issuer
    #basicConstraints=CA:FALSE
    keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
    subjectAltName = @alt_names
    
    [alt_names]                  
    2
    
    DNS.1 = loadbalancer.example.com
    DNS.2 = capsule.example.com
    Copy to Clipboard Toggle word wrap
    1
    证书的通用名称必须与胶囊服务器的 FQDN 匹配。在每一胶囊服务器上运行 命令时,请确保进行更改。您还可以设置通配符值 *。如果设置通配符值,您必须在使用 katello -certs-check 命令时添加 -t Capsule 选项。
    2
    [alt_names] 下,将负载均衡器的 FQDN 包含为 DNS.1,并将胶囊服务器的 FQDN 作为 DNS.2
  4. 为 SAN 证书创建证书签名请求(CSR):

    # openssl req -new \
    -key /root/capsule_cert/capsule.pem \ 
    1
    
    -config SAN_config.cfg \          
    2
    
    -out /root/capsule_cert/capsule.pem   
    3
    Copy to Clipboard Toggle word wrap
    1
    胶囊服务器的私钥,用于为证书进行签名
    2
    证书请求配置文件
    3
    证书签名请求文件
  5. 将证书请求发送到证书颁发机构:

    提交请求时,指定证书的寿命。发送证书请求的方法各不相同,因此请查阅证书颁发机构以获取首选方法。为了响应请求,预计可以在单独的文件中接收证书颁发机构捆绑包和签名证书。

  6. 将您从认证机构接收的证书颁发机构和胶囊服务器证书文件复制到卫星服务器上以验证它们。
  7. 在卫星服务器上,验证胶囊服务器证书输入文件:

    # katello-certs-check \
    -c /root/capsule_cert/capsule.pem \      
    1
    
    -k /root/capsule_cert/capsule.pem \      
    2
    
    -b /root/capsule_cert/ca_cert_bundle.pem 
    3
    Copy to Clipboard Toggle word wrap
    1
    由您的认证机构提供的胶囊服务器证书文件
    2
    用于为证书签名的胶囊服务器私钥
    3
    由认证机构提供的证书颁发机构捆绑包

    如果将 commonName= 设置为通配符值 *,您必须将 -t Capsule 选项添加到 katello-certs-check 命令中。

    保留由 katello-certs-check 命令输出的示例 capsule-certs-generate 命令的副本,用于为这个胶囊服务器创建证书存档文件。

如果在 Satellite 配置中使用 Puppet,则必须完成以下步骤:

配置胶囊服务器以生成和签署 Puppet 证书

对于您要配置用于负载平衡的所有其他胶囊服务器的系统,请完成此步骤。在这一流程中的示例中,此胶囊服务器的 FQDN 为 capsule-ca.example.com

  1. 将以下选项附加到您从 katello-certs-check 命令的输出中获取的 capsule-certs-generate 命令:

    --foreman-proxy-cname loadbalancer.example.com
    Copy to Clipboard Toggle word wrap
  2. 在卫星服务器上,输入 capsule-certs-generate 命令来生成胶囊证书。例如:

    # capsule-certs-generate \
    --foreman-proxy-fqdn capsule-ca.example.com \
    --certs-tar /root/capsule_cert/capsule-ca.tar \
    --server-cert /root/capsule_cert/capsule-ca.pem \
    --server-key /root/capsule_cert/capsule-ca.pem \
    --server-ca-cert /root/capsule_cert/ca_cert_bundle.pem \
    --foreman-proxy-cname loadbalancer.example.com
    Copy to Clipboard Toggle word wrap

    保留用于安装 Capsule Server 证书的输出中的 example satellite-installer 命令的副本。

  3. 将证书存档文件从卫星服务器复制到胶囊服务器。
  4. 将以下选项附加到 satellite-installer 命令中,从 capsule-certs-generate 命令的输出中获取:

    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-ca-server "capsule-ca.example.com" \
    --foreman-proxy-puppetca "true" \
    --puppet-server-ca "true" \
    --enable-foreman-proxy-plugin-remote-execution-ssh
    Copy to Clipboard Toggle word wrap
  5. 在 Capsule Server 上,输入 satellite-installer 命令,例如:

    satellite-installer --scenario capsule \
    --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-ca.example.com" \
    --foreman-proxy-oauth-consumer-key "oauth key" \
    --foreman-proxy-oauth-consumer-secret "oauth secret" \
    --certs-tar-file "certs.tgz" \
    --puppet-server-foreman-url "https://satellite.example.com" \
    --certs-cname "loadbalancer.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-ca-server "capsule-ca.example.com" \
    --foreman-proxy-puppetca "true" \
    --puppet-server-ca "true" \
    --enable-foreman-proxy-plugin-remote-execution-ssh
    Copy to Clipboard Toggle word wrap
  6. 在 Capsule Server 上,为您配置用于负载平衡的所有其他胶囊生成 Puppet 证书,但这是您配置 Puppet 证书签名的第一个系统:

    # puppet cert generate capsule.example.com \
    --dns_alt_names=loadbalancer.example.com
    Copy to Clipboard Toggle word wrap

    此命令在 Puppet 证书签名请求实例上创建以下文件:

    • /etc/puppetlabs/puppet/ssl/certs/ca.pem
    • /etc/puppetlabs/puppet/ssl/certs/capsule.example.com.pem
    • /etc/puppetlabs/puppet/ssl/private_keys/capsule.example.com.pem
    • /etc/puppetlabs/puppet/ssl/public_keys/capsule.example.com.pem

为负载平衡配置重新平衡

为每个胶囊服务器完成这个步骤,包括配置胶囊服务器以为 Puppet 证书签名的系统。

  1. 将以下选项附加到您从 katello-certs-check 命令的输出中获取的 capsule-certs-generate 命令:

    --foreman-proxy-cname loadbalancer.example.com
    Copy to Clipboard Toggle word wrap
  2. 在卫星服务器上,输入 capsule-certs-generate 命令来生成胶囊证书。例如:

    # capsule-certs-generate \
    --foreman-proxy-fqdn capsule.example.com \
    --certs-tar /root/capsule_cert/capsule.tar \
    --server-cert /root/capsule_cert/capsule.pem \
    --server-key /root/capsule_cert/capsule.pem \
    --server-ca-cert /root/capsule_cert/ca_cert_bundle.pem \
    --foreman-proxy-cname loadbalancer.example.com
    Copy to Clipboard Toggle word wrap

    保留用于安装 Capsule Server 证书的输出中的 example satellite-installer 命令的副本。

  3. 将证书存档文件从卫星服务器复制到胶囊服务器。

    # scp /root/capsule.example.com-certs.tar \
    root@capsule.example.com:capsule.example.com-certs.tar
    Copy to Clipboard Toggle word wrap
  4. 在 Capsule Server 上,安装 puppetserver 软件包:

    # satellite-maintain packages install puppetserver
    Copy to Clipboard Toggle word wrap
  5. 在 Capsule Server 上,为 puppet 证书创建目录:

    # mkdir -p /etc/puppetlabs/puppet/ssl/certs/ \
    /etc/puppetlabs/puppet/ssl/private_keys/ \
    /etc/puppetlabs/puppet/ssl/public_keys/
    Copy to Clipboard Toggle word wrap
  6. 在 Capsule Server 上,从配置胶囊服务器的系统中复制此胶囊服务器的 Puppet 证书,以为 Puppet 证书签名:

    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/certs/ca.pem \
    /etc/puppetlabs/puppet/ssl/certs/ca.pem
    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/certs/capsule.example.com.pem \
    /etc/puppetlabs/puppet/ssl/certs/capsule.example.com.pem
    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/private_keys/capsule.example.com.pem \
    /etc/puppetlabs/puppet/ssl/private_keys/capsule.example.com.pem
    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/public_keys/capsule.example.com.pem \
    /etc/puppetlabs/puppet/ssl/public_keys/capsule.example.com.pem
    Copy to Clipboard Toggle word wrap
  7. 在 Capsule Server 上,将目录所有权更改为用户 puppet、组 puppet 并设置 SELinux 上下文:

    # chown -R puppet:puppet /etc/puppetlabs/puppet/ssl/
    # restorecon -Rv /etc/puppetlabs/puppet/ssl/
    Copy to Clipboard Toggle word wrap
  8. 将以下选项附加到 satellite-installer 命令中,从 capsule-certs-generate 命令的输出中获取:

    --certs-cname "loadbalancer.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-ca-server "capsule-ca.example.com" \
    --foreman-proxy-puppetca "false" \
    --puppet-server-ca "false" \
    --enable-foreman-proxy-plugin-remote-execution-ssh
    Copy to Clipboard Toggle word wrap
  9. 在 Capsule Server 上,输入 satellite-installer 命令,例如:

    # satellite-installer --scenario capsule \
    --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 "oauth key" \
    --foreman-proxy-oauth-consumer-secret "oauth secret" \
    --certs-tar-file "capsule.example.com-certs.tar" \
    --puppet-server-foreman-url "https://satellite.example.com" \
    --certs-cname "loadbalancer.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-ca-server "capsule-ca.example.com" \
    --foreman-proxy-puppetca "false" \
    --puppet-server-ca "false" \
    --enable-foreman-proxy-plugin-remote-execution-ssh
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat