使用负载均衡器配置胶囊

Red Hat Satellite 6.12

在胶囊服务器之间分布负载

Red Hat Satellite Documentation Team

摘要

本指南介绍了如何将 Red Hat Satellite 配置为使用负载均衡器在胶囊服务器之间分发负载。

向红帽文档提供反馈

我们感谢您对文档提供反馈信息。请让我们了解如何改进文档。

您可以通过在 Bugzilla 中记录一个 ticket 来提交反馈:

  1. 导航到 Bugzilla 网站。
  2. Component 字段中,使用 Documentation
  3. Description 字段中,输入您要改进的建议。包括文档相关部分的链接。
  4. Submit Bug

第 1 章 负载均衡解决方案架构

您可以将卫星服务器配置为使用负载平衡器在多个胶囊服务器之间分发客户端请求和网络负载。这会对胶囊服务器产生整体性能提升。

本指南概述了如何准备卫星服务器和胶囊服务器以进行负载平衡,并提供了有关如何配置负载均衡器并在负载均衡的设置中注册客户端的指导。

负载均衡的设置由以下组件组成:

  • Satellite Server
  • 两个或多个胶囊服务器
  • 一个负载均衡器
  • 多个客户端

图 1.1. Satellite 负载平衡解决方案架构

负载均衡解决方案架构

在负载均衡的设置中,当一个胶囊服务器停机或计划外维护时,几乎所有胶囊功能都可以继续按预期工作。负载均衡器具有以下服务和特性:

  • 使用 subscription-manager进行注册
  • 使用 yum 软件仓库管理内容
  • 可选:Puppet
注意

在负载均衡的设置中,负载均衡器只会为上述服务和功能分发负载。如果其它服务(如 provisioning 或 virt-who)在各个胶囊上运行,则必须直接通过胶囊方式访问这些服务,而不是通过负载均衡器访问。

管理 Puppet 限制

Puppet 证书颁发机构(CA)管理不支持负载均衡的设置中的证书签名请求。Puppet CA 在文件系统中存储证书信息,如序列号计数器和 CRL。试图使用相同数据的多个写入程序可能会损坏数据。

要管理此 Puppet 限制,请完成以下步骤:

  1. 在一台胶囊服务器上配置 Puppet 证书签名请求,通常是您配置用于负载平衡的首个系统。
  2. 配置客户端,以将 CA 请求发送到负载均衡器上的端口 8141。
  3. 配置负载均衡器,以将 CA 请求从端口 8141 重定向到您要配置为签署 Puppet 证书的系统上的端口 8140。

第 2 章 负载均衡注意事项

在多个胶囊服务器之间分布负载可防止任何一个胶囊成为单一故障点。将胶囊配置为使用负载平衡器提供对计划和计划外中断的弹性。这提高了可用性和响应能力。

在配置负载均衡时请考虑以下指南:

  • 如果使用 Puppet,Puppet 证书签名请求将分配给您配置的第一个胶囊。如果第一个胶囊停机,客户端无法获取 Puppet 内容。
  • 此解决方案不使用 Pacemaker 或其他类似 HA 工具来维护所有胶囊之间的一个状态。要排除问题,请在每个胶囊上重现问题,绕过负载均衡器。

负载均衡所需的额外维护

配置胶囊以使用负载均衡器会导致更复杂的环境,需要进行额外的维护。

负载平衡需要以下额外步骤:

  • 您必须确保所有 Capsules 具有相同的 Content Views,并将所有胶囊同步到同一内容视图版本
  • 您必须按顺序升级每个胶囊
  • 您必须定期备份每个配置的胶囊

在负载均衡配置中升级胶囊服务器

要将胶囊服务器从 6.11 升级到 6.12,请在 升级和更新 Red Hat Satellite 中完成升级 胶囊服务器 的步骤。在负载平衡配置中,胶囊服务器不需要额外的步骤。

第 3 章 为负载平衡配置胶囊服务器的先决条件

要配置胶囊服务器以进行负载平衡,请完成 安装胶囊服务器 中描述的以下步骤。卫星不支持为负载平衡配置现有的胶囊服务器。

第 4 章 为负载平衡配置胶囊服务器

本章概述了如何配置用于负载平衡的胶囊服务器。根据您的 Satellite 服务器配置,继续执行以下部分之一:

为您为每个胶囊服务器创建的 Katello 证书使用不同的文件名。例如,将证书存档文件命名为 Capsule Server FQDN。

4.1. 使用默认 SSL 证书配置胶囊服务器以在没有 Puppet 的情况下进行负载平衡

下面的部分论述了如何配置不使用 Puppet 的情况下使用默认 SSL 证书进行负载平衡的胶囊服务器。在您要为负载均衡配置的每个胶囊服务器上完成这个步骤。

流程

  1. 在卫星服务器上,为 Capsule Server 生成 Katello 证书:

    # capsule-certs-generate \
    --certs-tar "/root/capsule.example.com-certs.tar" \
    --foreman-proxy-cname loadbalancer.example.com \
    --foreman-proxy-fqdn capsule.example.com

    保留 satellite-installer 命令示例 satellite-installer 命令的副本,它通过 capsule-certs-generate 命令安装 Capsule Server 证书。

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

    # scp /root/capsule.example.com-certs.tar root@capsule.example.com:/root/capsule.example.com-certs.tar
  3. 将以下选项附加到 satellite-installer 命令中,从 capsule-certs-generate 命令的输出中获取:

    --certs-cname "loadbalancer.example.com" \
    --enable-foreman-proxy-plugin-remote-execution-script
  4. 在 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"

4.2. 使用默认 SSL 证书配置胶囊服务器以使用 Puppet 负载平衡

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

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

4.2.1. 使用默认 SSL 证书配置胶囊服务器,以生成和签署 Puppet 证书

对于您要配置用于负载均衡的所有其他胶囊服务器的系统,请完成此步骤。

流程

  1. 在卫星服务器上,为您配置 Capsule Server 以生成并签名 Puppet 证书的系统生成 Katello 证书:

    # capsule-certs-generate \
    --certs-tar "/root/capsule-ca.example.com-certs.tar" \
    --foreman-proxy-cname loadbalancer.example.com \
    --foreman-proxy-fqdn capsule-ca.example.com

    保留 satellite-installer 命令示例 satellite-installer 命令的副本,它通过 capsule-certs-generate 命令安装 Capsule Server 证书。

  2. 将证书存档文件从 Satellite 服务器复制到胶囊服务器:

    # scp /root/capsule-ca.example.com-certs.tar root@capsule-ca.example.com:capsule-ca.example.com-certs.tar
  3. 将以下选项附加到 satellite-installer 命令中,从 capsule-certs-generate 命令的输出中获取:

    --certs-cname "loadbalancer.example.com" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-puppetca "true" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "true"
  4. 在 Capsule 服务器上,输入 satellite-installer 命令:

    # satellite-installer --scenario capsule \
    --certs-cname "loadbalancer.example.com" \
    --certs-tar-file "capsule-ca.example.com-certs.tar" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --enable-puppet \
    --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-puppetca "true" \
    --foreman-proxy-register-in-foreman "true" \
    --foreman-proxy-trusted-hosts "satellite.example.com" \
    --foreman-proxy-trusted-hosts "capsule-ca.example.com" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server true \
    --puppet-server-ca "true" \
    --puppet-server-foreman-url "https://satellite.example.com"
  5. 在 Capsule Server 上,停止 Puppet 服务器:

    # puppet resource service puppetserver ensure=stopped
  6. 为您为负载平衡配置的其他所有胶囊服务器生成 Puppet 证书,除了配置 Puppet 证书签名的第一个系统外:

    # puppetserver ca generate \
    --ca-client \
    --certname capsule.example.com \
    --subject-alt-names loadbalancer.example.com

    此命令会在配置胶囊服务器以为 Puppet 证书签名的系统中创建以下文件:

    • /etc/puppetlabs/puppet/ssl/certs/capsule.example.com.pem
    • /etc/puppetlabs/puppet/ssl/certs/ca.pem
    • /etc/puppetlabs/puppet/ssl/private_keys/capsule.example.com.pem
    • /etc/puppetlabs/puppet/ssl/public_keys/capsule.example.com.pem
  7. 恢复 Puppet 服务器:

    # puppet resource service puppetserver ensure=running

4.2.2. 使用默认 SSL 证书配置用于负载平衡的默认 SSL 证书

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

流程

  1. 在卫星服务器上,为 Capsule Server 生成 Katello 证书:

    # capsule-certs-generate \
    --certs-tar "/root/capsule.example.com-certs.tar" \
    --foreman-proxy-cname loadbalancer.example.com \
    --foreman-proxy-fqdn capsule.example.com

    保留 satellite-installer 命令示例 satellite-installer 命令的副本,它通过 capsule-certs-generate 命令安装 Capsule Server 证书。

  2. 将证书存档文件从 Satellite 服务器复制到胶囊服务器:

    # scp /root/capsule.example.com-certs.tar root@capsule.example.com:/root/capsule.example.com-certs.tar
  3. 在 Capsule Server 上,安装 puppetserver 软件包:

    # satellite-maintain packages install puppetserver
  4. 在 Capsule Server 上,为 puppet 证书创建目录:

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

    # 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/certs/ca.pem /etc/puppetlabs/puppet/ssl/certs/ca.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
  6. 在 Capsule 服务器上,将 /etc/puppetlabs/puppet/ssl/ 目录所有权改为用户 puppet 和组 puppet

    # chown -R puppet:puppet /etc/puppetlabs/puppet/ssl/
  7. 在 Capsule 服务器上,为 /etc/puppetlabs/puppet/ssl/ 目录设置 SELinux 上下文:

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

    --certs-cname "loadbalancer.example.com" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-puppetca "false" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "false"
  9. 在 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-puppetca "false" \
    --foreman-proxy-register-in-foreman "true" \
    --foreman-proxy-trusted-hosts "satellite.example.com" \
    --foreman-proxy-trusted-hosts "capsule.example.com" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "false" \
    --puppet-server-foreman-url "https://satellite.example.com"

4.3. 使用自定义 SSL 证书配置胶囊服务器以在没有 Puppet 的情况下进行负载平衡

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

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

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

流程

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

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

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

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

    # openssl genrsa -out /root/capsule_cert/capsule_cert_key.pem 4096
  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
    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_cert_key.pem \ 1
    -config SAN_config.cfg \ 2
    -out /root/capsule_cert/capsule_cert_csr.pem 3
    1
    胶囊服务器的私钥,用于为证书进行签名
    2
    证书请求配置文件
    3
    证书签名请求文件
  5. 将证书请求发送到证书颁发机构:

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

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

    # 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
    1
    由您的认证机构提供的胶囊服务器证书文件
    2
    用于为证书签名的胶囊服务器私钥
    3
    由认证机构提供的证书颁发机构捆绑包

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

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

4.3.2. 使用自定义 SSL 证书配置胶囊服务器以在没有 Puppet 的情况下进行负载平衡

下面的部分论述了如何配置在没有 Puppet 的情况下使用自定义 SSL 证书进行负载平衡的胶囊服务器。在您要为负载均衡配置的每个胶囊服务器上完成这个步骤。

流程

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

    --foreman-proxy-cname loadbalancer.example.com
  2. 在 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

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

  3. 将证书存档文件从 Satellite 服务器复制到胶囊服务器:

    # scp /root/capsule.example.com-certs.tar root@capsule.example.com:capsule.example.com-certs.tar
  4. 将以下选项附加到 satellite-installer 命令中,从 capsule-certs-generate 命令的输出中获取:

    --certs-cname "loadbalancer.example.com" \
    --enable-foreman-proxy-plugin-remote-execution-script
  5. 在 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"

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

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

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

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

流程

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

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

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

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

    # openssl genrsa -out /root/capsule_cert/capsule_cert_key.pem 4096
  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
    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_cert_key.pem \ 1
    -config SAN_config.cfg \ 2
    -out /root/capsule_cert/capsule_cert_csr.pem 3
    1
    胶囊服务器的私钥,用于为证书进行签名
    2
    证书请求配置文件
    3
    证书签名请求文件
  5. 将证书请求发送到证书颁发机构:

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

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

    # 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
    1
    由您的认证机构提供的胶囊服务器证书文件
    2
    用于为证书签名的胶囊服务器私钥
    3
    由认证机构提供的证书颁发机构捆绑包

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

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

4.4.2. 配置带有自定义 SSL 证书的 Capsule 服务器来生成和签署 Puppet 证书

对于您要配置用于负载平衡的所有其他胶囊服务器的系统,请完成此步骤。

流程

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

    --foreman-proxy-cname loadbalancer.example.com
  2. 在 Satellite 服务器上,输入 Capsule -certs-generate 命令来生成 Capsule 证书:

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

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

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

    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-puppetca "true" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "true"
  5. 在 Capsule 服务器上,输入 satellite-installer 命令:

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

    # puppet cert generate capsule.example.com \
    --dns_alt_names=loadbalancer.example.com

    此命令在 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

4.4.3. 使用自定义 SSL 证书为负载平衡配置剩余的 Capsule 服务器

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

流程

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

    --foreman-proxy-cname loadbalancer.example.com
  2. 在 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

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

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

    # scp /root/capsule.example.com-certs.tar root@capsule.example.com:capsule.example.com-certs.tar
  4. 在 Capsule Server 上,安装 puppetserver 软件包:

    # satellite-maintain packages install puppetserver
  5. 在 Capsule Server 上,为 puppet 证书创建目录:

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

    # 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/certs/ca.pem /etc/puppetlabs/puppet/ssl/certs/ca.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
  7. 在 Capsule 服务器上,将 /etc/puppetlabs/puppet/ssl/ 目录所有权改为用户 puppet 和组 puppet

    # chown -R puppet:puppet /etc/puppetlabs/puppet/ssl/
  8. 在 Capsule 服务器上,为 /etc/puppetlabs/puppet/ssl/ 目录设置 SELinux 上下文:

    # restorecon -Rv /etc/puppetlabs/puppet/ssl/
  9. 将以下选项附加到 satellite-installer 命令中,从 capsule-certs-generate 命令的输出中获取:

    --certs-cname "loadbalancer.example.com" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-puppetca "false" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "false"
  10. 在 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-puppetca "false" \
    --foreman-proxy-register-in-foreman "true" \
    --foreman-proxy-trusted-hosts "satellite.example.com" \
    --foreman-proxy-trusted-hosts "capsule.example.com" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "false" \
    --puppet-server-foreman-url "https://satellite.example.com"

第 5 章 安装 Load Balancer

以下示例提供有关使用 Red Hat Enterprise Linux 8 服务器配置 HAProxy 负载均衡器的通用指导。但是,您可以安装支持 TCP 转发的任何合适的负载均衡软件解决方案。

流程

  1. 安装 HAProxy:

    # dnf install haproxy
  2. 安装包含 semanage 工具的以下软件包:

    # dnf install policycoreutils-python-utils
  3. 将 SELinux 配置为允许 HAProxy 绑定任何端口:

    # semanage boolean --modify --on haproxy_connect_any
  4. 配置负载均衡器以平衡端口的网络负载,如 表 5.1 “Load Balancer 的端口配置” 所述。例如,要为 HAProxy 配置端口,请编辑 /etc/haproxy/haproxy.cfg 文件与表对应。如需更多信息,请参阅红帽知识库中的 带有 Satellite 6 的 HAProxy 负载均衡器的 haproxy.cfg 配置示例

    表 5.1. Load Balancer 的端口配置

    服务端口模式平衡模式目的地

    HTTP

    80

    TCP

    roundrobin

    所有胶囊服务器上的端口 80

    HTTPS 和 RHSM

    443

    TCP

    source

    all Capsule Servers 上的端口 443

    AMQP

    5647

    TCP

    roundrobin

    所有胶囊服务器上的端口 5647

    Puppet(可选

    8140

    TCP

    roundrobin

    所有胶囊服务器上的端口 8140

    PuppetCA (Optional)

    8141

    TCP

    roundrobin

    仅在配置 Capsule Server 以为 Puppet 证书签名的系统中的端口 8140

    Cryostat(可选,对于 OpenScap

    9090

    TCP

    roundrobin

    所有胶囊服务器上的端口 9090

  5. 配置负载均衡器以禁用 SSL 卸载并允许客户端 SSL 证书传递到后端服务器。这是必要的,因为从客户端到胶囊服务器的通信取决于客户端 SSL 证书。
  6. 启动并启用 HAProxy 服务:

    # systemctl enable --now haproxy

第 6 章 验证负载平衡配置

使用这个流程验证每个 Capsule 服务器的负载平衡配置。

流程

  1. 关闭您的胶囊服务器的基础操作系统。
  2. 验证注册到此胶囊的客户端上是否有内容或订阅管理功能。例如,在客户端上输入 subscription-manager refresh 命令。
  3. 为您的胶囊服务器重启基础操作系统。

第 7 章 将客户端注册到 Load Balancer

要平衡来自客户端的网络流量的负载,您必须将客户端注册到负载均衡器。

要注册客户端,请执行以下步骤之一:

7.1. 使用主机注册注册客户端

您可以使用主机注册功能、卫星 API 或 Hammer CLI 使用卫星注册主机。

流程

  1. 在 Satellite Web UI 中,导航到 Hosts > Register Host
  2. 点击 Generate create registration 命令。
  3. 点击 文件 图标将命令复制到您的剪贴板中。
  4. 登录您要注册的主机并运行之前生成的命令。
  5. 更新 rhsm.baseurlserver.hostname 的订阅管理器配置:

    # subscription-manager config \
    --rhsm.baseurl=https://loadbalancer.example.com/pulp/content \
    --server.hostname=loadbalancer.example.com
  6. 检查 /etc/yum.repos.d/redhat.repo 文件,并确保启用了适当的软件仓库。

CLI 过程

  1. 使用 Hammer CLI 生成主机注册命令:

    # hammer host-registration generate-command \
    --activation-keys "My_Activation_Key"

    如果您的主机不信任 Satellite 服务器的 SSL 证书,您可以通过在注册命令中添加 --insecure 标志来禁用 SSL 验证。

    # hammer host-registration generate-command \
    --activation-keys "My_Activation_Key" \
    --insecure true
  2. 登录您要注册的主机并运行之前生成的命令。
  3. 更新 rhsm.baseurlserver.hostname 的订阅管理器配置:

    # subscription-manager config \
    --rhsm.baseurl=https://loadbalancer.example.com/pulp/content \
    --server.hostname=loadbalancer.example.com
  4. 检查 /etc/yum.repos.d/redhat.repo 文件,并确保启用了适当的软件仓库。

API 流程

  1. 使用 Satellite API 生成主机注册命令:

    # curl -X POST https://satellite.example.com/api/registration_commands \
    --user "My_User_Name" \
    -H 'Content-Type: application/json' \
    -d '{ "registration_command": { "activation_keys": ["My_Activation_Key_1, My_Activation_Key_2"] }}'

    如果您的主机不信任 Satellite 服务器的 SSL 证书,您可以通过在注册命令中添加 --insecure 标志来禁用 SSL 验证。

    # curl -X POST https://satellite.example.com/api/registration_commands \
    --user "My_User_Name" \
    -H 'Content-Type: application/json' \
    -d '{ "registration_command": { "activation_keys": ["My_Activation_Key_1, My_Activation_Key_2"], "insecure": true }}'

    使用激活码来简化指定环境。如需更多信息,请参阅管理内容 中的 激活码

    要以命令行参数输入密码,请使用 username:password 语法。请记住,这可以在 shell 历史记录中保存密码。

    有关注册的更多信息,请参阅在 管理主机 中将主机注册到 Red Hat Satellite

  2. 登录您要注册的主机并运行之前生成的命令。
  3. 更新 rhsm.baseurlserver.hostname 的订阅管理器配置:

    # subscription-manager config \
    --rhsm.baseurl=https://loadbalancer.example.com/pulp/content \
    --server.hostname=loadbalancer.example.com
  4. 检查 /etc/yum.repos.d/redhat.repo 文件,并确保启用了适当的软件仓库。

7.2. (已弃用) 使用引导脚本注册客户端

要注册客户端,请在客户端上输入以下命令。您必须为每个客户端完成注册步骤。

前提条件

流程

  • 在 Red Hat Enterprise Linux 8 中输入以下命令:

    # /usr/libexec/platform-python bootstrap.py \
    --activationkey="My_Activation_Key" \
    --enablerepos=satellite-client-6-for-rhel-8-<arch>-rpms \ 1
    --force \ 2
    --hostgroup="My_Hostgroup" \
    --location="My_Location" \
    --login=admin \
    --organization="My_Organization" \
    --puppet-ca-port 8141 \ 3
    --server loadbalancer.example.com
    1
    <arch > 替换为客户端架构,如 x86
    2
    包含 --force 选项,以注册之前注册到单机胶囊的客户端。
    3
    如果使用 Puppet,请包含 --puppet-ca-port 8141 选项。
  • 在 Red Hat Enterprise Linux 7 或 6 中,输入以下命令:

    # python bootstrap.py --login=admin \
    --activationkey="My_Activation_Key" \
    --enablerepos=rhel-7-server-satellite-client-6-rpms \
    --force \ 1
    --hostgroup="My_Hostgroup" \
    --location="My_Location" \
    --organization="My_Organization" \
    --puppet-ca-port 8141 \ 2
    --server loadbalancer.example.com
    1
    包含 --force 选项,以注册之前注册到单机胶囊的客户端。
    2
    如果使用 Puppet,请包含 --puppet-ca-port 8141 选项。

该脚本提示与您使用 --login 选项输入的 Satellite 用户名对应的密码。

7.3. (已弃用) 使用 katello-ca-consumer RPM 手动注册客户端

要手动注册客户端,请在您要注册的每个客户端上完成以下步骤。

流程

  1. 如果已安装,请删除 katello-ca-consumer 软件包:

    # dnf remove 'katello-ca-consumer*'
  2. 从负载均衡器安装 katello-ca-consumer 软件包:

    # dnf install http://loadbalancer.example.com/pub/katello-ca-consumer-latest.noarch.rpm
  3. 注册客户端并包含 --serverurl--baseurl 选项:

    # subscription-manager register \
    --activationkey="My_Activation_Key" \
    --baseurl=https://loadbalancer.example.com/pulp/content/ \
    --org="My_Organization" \
    --serverurl=https://loadbalancer.example.com/rhsm

第 8 章 通过 Load Balancer 传播 SCAP 内容

如果使用 OpenSCAP 来管理客户端的安全合规性,您必须将 SCAP 客户端配置为将 ARF 报告发送到负载均衡器而不是 Capsule。配置过程取决于您选择部署合规策略的方法。

8.1. 使用 Ansible 部署传播 SCAP 内容

使用这个流程,您可以通过 Ansible 部署方法范围内的负载均衡器提升安全内容自动化协议(SCAP)内容。

前提条件

  • 确保您已为 Ansible 部署策略配置了 Satellite。如需更多信息,请参阅管理 Red Hat Satellite 中的配置合规策略部署方法

流程

  1. 在 Satellite Web UI 中,进入到 Configure > Variables
  2. 搜索 foreman_scap_client_port 变量,再单击其名称。
  3. Default Behavior 区域中,确保选择了 Override 复选框。
  4. Parameter Type 列表中,确保选择了 整数
  5. Default Value 字段中,输入 9090
  6. Specify Matchers 区域中,删除所有覆盖默认值的 matchers。
  7. Submit
  8. 搜索 foreman_scap_client_server 变量,再单击其名称。
  9. Default Behavior 区域中,确保选择了 Override 复选框。
  10. Parameter Type 列表中,确保选择了 字符串
  11. Default Value 字段中,输入负载均衡器的 FQDN,如 loadbalancer.example.com
  12. Specify Matchers 区域中,删除所有覆盖默认值的 matchers。
  13. Submit
  14. 使用 Ansible 继续部署合规策略。如需更多信息,请参阅:

验证

  • 在客户端中,验证 /etc/foreman_scap_client/config.yaml 文件是否包含以下行:

    # Foreman proxy to which reports should be uploaded
    :server: 'loadbalancer.example.com'
    :port: 9090

8.2. 使用 Puppet 部署传播 SCAP 内容

使用此流程,您可以通过 Puppet 部署方法范围内的负载均衡器提升安全内容自动化协议(SCAP)内容。

前提条件

  • 确保您为 Puppet 部署策略配置了 Satellite。如需更多信息,请参阅管理 Red Hat Satellite 中的配置合规策略部署方法

流程

  1. 在 Satellite Web UI 中,导航到 Configure > Classes,再点击 foreman_scap_client
  2. 单击 Smart Class Parameter 选项卡。
  3. 智能类参数 窗口左侧的窗格中,单击 端口
  4. Default Behavior 区域中,选择 覆盖 复选框。
  5. Key Type 列表中,选择 整数
  6. Default Value 字段中,输入 9090
  7. 智能类参数 窗口左侧的窗格中,单击 server
  8. Default Behavior 区域中,选择 覆盖 复选框。
  9. Key Type 列表中,选择 字符串
  10. Default Value 字段中,输入负载均衡器的 FQDN,如 loadbalancer.example.com
  11. Smart Class Parameter 窗口左下角,单击 Submit
  12. 使用 Puppet 继续部署合规策略。如需更多信息,请参阅:

验证

  • 在客户端中,验证 /etc/foreman_scap_client/config.yaml 文件是否包含以下行:

    # Foreman proxy to which reports should be uploaded
    :server: 'loadbalancer.example.com'
    :port: 9090

法律通告

Copyright © 2024 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.