2.6. 使用 SSL 证书配置 Capsule 服务器


Red Hat Satellite 使用 SSL 证书来启用 Satellite 服务器、外部 Capsule 服务器和所有主机之间的加密通信。根据机构的要求,您必须使用默认或自定义证书配置您的 Capsule 服务器。

2.6.1. 使用默认 SSL 证书配置 Capsule 服务器

使用本节配置由 Satellite 服务器默认证书颁发机构(CA)签名的 SSL 证书的 Capsule 服务器。

先决条件

流程

  1. 在 Satellite 服务器上,要为您的胶囊服务器存储所有源证书文件,请创建一个只能被 root 用户访问的目录,如 /root/capsule_cert

    # mkdir /root/capsule_cert
    Copy to Clipboard Toggle word wrap
  2. 在 Satellite 服务器上,为您的 Capsule 服务器生成 /root/capsule_cert/prompt.example.com-certs.tar 证书存档:

    # capsule-certs-generate \
    --foreman-proxy-fqdn capsule.example.com \
    --certs-tar /root/capsule_cert/capsule.example.com-certs.tar
    Copy to Clipboard Toggle word wrap

    保留 satellite-installer 命令的副本,该命令会返回该副本,以将证书部署到您的 Capsule 服务器。

    evince -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"
    Copy to Clipboard Toggle word wrap

  3. 在 Satellite 服务器上,将证书归档文件复制到您的 Capsule 服务器中:

    # scp /root/capsule_cert/capsule.example.com-certs.tar \
    root@capsule.example.com:/root/capsule.example.com-certs.tar
    Copy to Clipboard Toggle word wrap
  4. 在 Capsule 服务器上,要部署证书,请输入其 satellite- certs-generate 命令返回的 satellite- installer 命令。

    当 Satellite 的网络连接或端口还没有打开时,您可以将 --foreman-proxy-register-in-foreman 选项设置为 false,以防止 Capsule 尝试连接到 Satellite 并报告错误。当正确配置了网络和防火墙时,将此选项设置为 true 再次运行安装程序。

    重要

    在部署证书后,请勿删除证书存档文件。例如,在升级 Capsule 服务器时需要这样做。

2.6.2. 使用自定义 SSL 证书配置 Capsule 服务器

如果您将 Satellite 服务器配置为使用自定义 SSL 证书,还必须使用不同的自定义 SSL 证书配置每个外部 Capsule 服务器。

要使用自定义证书配置您的 Capsule 服务器,请在每个 Capsule 服务器上完成以下步骤:

2.6.2.1. 为 Capsule 服务器创建自定义 SSL 证书

在受管主机上,为您的胶囊服务器创建一个自定义证书。如果您已经为 Capsule 服务器有自定义 SSL 证书,请跳过这个过程。

流程

  1. 要存储所有源证书文件,请创建一个只能被 root 用户访问的目录:

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

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

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

    # openssl genrsa -out /root/capsule_cert/capsule_cert_key.pem 4096
    Copy to Clipboard Toggle word wrap
  3. 为 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 ]
    CN = capsule.example.com
    
    [ v3_req ]
    basicConstraints = CA:FALSE
    keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
    extendedKeyUsage = serverAuth, clientAuth, codeSigning, emailProtection
    subjectAltName = @alt_names
    
    [ usr_cert ]
    basicConstraints=CA:FALSE
    nsCertType = client, server, email
    keyUsage = nonRepudiation, digitalSignature, keyEncipherment
    extendedKeyUsage = serverAuth, clientAuth, codeSigning, emailProtection
    nsComment = "OpenSSL Generated Certificate"
    subjectKeyIdentifier=hash
    authorityKeyIdentifier=keyid,issuer
    
    [ alt_names ]
    DNS.1 = capsule.example.com
    Copy to Clipboard Toggle word wrap
  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
    Copy to Clipboard Toggle word wrap
    1
    私钥的路径。
    2
    配置文件的路径。
    3
    要生成的 CSR 的路径。
  5. 将证书签名请求发送到证书颁发机构(CA)。同一 CA 必须为 Satellite 服务器和 Capsule 服务器签名证书。

    提交请求时,指定证书的寿命。发送证书请求的方法会有所不同,因此请查阅 CA 查看首选方法。为了响应请求,您可以在单独的文件中接收 CA 捆绑包和签名证书。

2.6.2.2. 将自定义 SSL 证书部署到 Capsule 服务器

使用这个流程,使用证书颁发机构签名的自定义 SSL 证书配置您的 Capsule 服务器。satellite-installer 命令,其 return-certs-generate 命令为每个 Capsule 服务器是唯一的。不要在多个胶囊服务器上使用相同的命令。

先决条件

流程

  1. 在 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.pem      
    3
    Copy to Clipboard Toggle word wrap
    1
    由证书颁发机构签名的 Capsule 服务器证书文件的路径。
    2
    用于为 Capsule 服务器证书签名的私钥的路径。
    3
    证书颁发机构捆绑包的路径。

    如果您在 /root/capsule_cert/openssl.cnf 配置文件中为证书的 Common Name CN = 设置通配符值,您必须在 katello -certs-check 命令中添加 -t \":\" 选项。

    如果命令成功,它会返回两个 evince -certs-generate 命令,则必须使用其中一个命令为您的 Capsule 服务器生成证书文件。

    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
    Copy to Clipboard Toggle word wrap

  2. 在 Satellite 服务器上,从 katello-certs-check 命令的输出中,根据您的要求,输入为新或现有 Capsule 生成证书的 evince -certs-generate 命令。

    在此命令中,将 $CAPSULE 更改为您的 Capsule 服务器的 FQDN。

  3. 保留 satellite-installer 命令的副本,该命令会返回该副本,以将证书部署到您的 Capsule 服务器。

    evince -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 "s97QxvUAgFNAQZNGg4F9zLq2biDsxM7f" \
    --foreman-proxy-oauth-consumer-secret "6bpzAdMpRAfYaVZtaepYetomgBVQ6ehY"
    Copy to Clipboard Toggle word wrap

  4. 在 Satellite 服务器上,将证书归档文件复制到您的 Capsule 服务器中:

    # scp /root/capsule_cert/capsule.example.com-certs.tar \
    root@capsule.example.com:/root/capsule.example.com-certs.tar
    Copy to Clipboard Toggle word wrap
  5. 在 Capsule 服务器上,要部署证书,请输入其 satellite- certs-generate 命令返回的 satellite- installer 命令。

    当 Satellite 的网络连接或端口还没有打开时,您可以将 --foreman-proxy-register-in-foreman 选项设置为 false,以防止 Capsule 尝试连接到 Satellite 并报告错误。当正确配置了网络和防火墙时,将此选项设置为 true 再次运行安装程序。

    重要

    在部署证书后,请勿删除证书存档文件。例如,在升级 Capsule 服务器时需要这样做。

2.6.2.3. 将自定义 SSL 证书部署到主机

将 Capsule 服务器配置为使用自定义 SSL 证书后,还必须在注册到此 Capsule 服务器的每个主机上安装 katello-ca-consumer 软件包。

流程

  • 在每个主机上安装 katello-ca-consumer 软件包:

    # yum localinstall \
    http://capsule.example.com/pub/katello-ca-consumer-latest.noarch.rpm
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat