搜索

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

download PDF

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

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

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

先决条件

流程

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

    # mkdir /root/capsule_cert
  2. 在 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- installer 命令的副本,以将证书部署到您的胶囊服务器。

    Capsule -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"

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

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

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

    重要

    部署证书后不要删除证书存档文件。例如,在升级胶囊服务器时是必需的。

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

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

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

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

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

流程

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

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

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

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

    # openssl genrsa -out /root/capsule_cert/capsule_cert_key.pem 4096
  3. 为 CSR 创建 /root/capsule_cert/openssl.cnf 配置文件并包含以下内容:

    [ req ]
    req_extensions = v3_req
    distinguished_name = req_distinguished_name
    prompt = no
    
    [ req_distinguished_name ]
    commonName = capsule.example.com
    
    [ v3_req ]
    basicConstraints = CA:FALSE
    keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
    extendedKeyUsage = serverAuth, clientAuth, codeSigning, emailProtection
    subjectAltName = @alt_names
    
    [ alt_names ]
    DNS.1 = capsule.example.com
  4. 可选: 如果要向 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
    1
    两个字母代码
    2
    全名
    3
    全名(例如:New York)
    4
    负责证书的部门(示例:IT 部门)
  5. 生成 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
    1
    私钥的路径
    2
    配置文件的路径
    3
    要生成的 CSR 的路径
  6. 将证书签名请求发送到证书颁发机构(CA)。同一 CA 必须为 Satellite 服务器和 Capsule 服务器签名证书。

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

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

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

先决条件

流程

  1. 在 Satellite 服务器上生成证书捆绑包:

    # capsule-certs-generate \
    --foreman-proxy-fqdn capsule.example.com \
    --certs-tar ~/capsule.example.com-certs.tar \
    --server-cert /root/capsule_cert/capsule_cert.pem \ 1
    --server-key /root/capsule_cert/capsule_cert_key.pem \ 2
    --server-ca-cert "/root/capsule_cert/ca_cert_bundle.pem \ 3
    --certs-update-server
    1
    由证书颁发机构签名的 Capsule 服务器证书文件的路径。
    2
    用于为胶囊服务器证书签名的私钥的路径。
    3
    证书颁发机构捆绑包的路径。
  2. 保留 Capsule- certs-generate 命令返回的 satellite- installer 命令的副本,以将证书部署到您的胶囊服务器。

    Capsule -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"

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

    # scp ~/capsule.example.com-certs.tar \
    root@capsule.example.com:/root/capsule.example.com-certs.tar
  4. 在 Capsule 服务器上,若要部署证书,请输入 Capsule- certs-generate 命令返回的 satellite- installer 命令。

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

    重要

    部署证书后不要删除证书存档文件。例如,在升级胶囊服务器时是必需的。

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

将 Satellite 配置为使用自定义 SSL 证书后,您必须将证书部署到注册到 Satellite 的主机。

流程

  • 更新每个主机上的 SSL 证书:

    # dnf install http://capsule.example.com/pub/katello-ca-consumer-latest.noarch.rpm
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.