容器化 SUSE Multi-Linux Manager Proxy 设置

为 SUSE Multi-Linux Manager Proxy 容器准备好容器主机后,需要额外执行几步容器设置才能完成配置。

过程
  1. 生成 SUSE Multi-Linux Manager Proxy 配置归档文件

  2. 将配置归档传输到在安装步骤中准备的容器主机并解压缩

  3. Start the proxy sevices with mgrpxy

1. 生成代理配置

SUSE Multi-Linux Manager 代理的配置归档由 SUSE Multi-Linux Manager 服务器生成。每个附加代理都需要自身的配置归档。

对于容器化 SUSE Multi-Linux Manager 代理,您必须构建新的代理配置文件,然后重新部署容器以使更改生效。此流程适用于更新设置(包括 SSL 证书)。

对于 Podman 部署,在生成此代理配置之前,必须将 SUSE Multi-Linux Manager 代理的容器主机作为客户端注册到 SUSE Multi-Linux Manager 服务器。

If a proxy FQDN is used to generate a proxy container configuration that is not a registered client (as in the Kubernetes use case), a new system entry will appear in system list. This new entry will be shown under previously entered Proxy FQDN value and will be of Foreign system type.

Peripheral servers are always using third-party SSL certificates. If the hub server has generated the certificates for the peripheral server, it needs to generate the certificate of each proxy too.

On the hub server, run the following command.

mgrctl exec -ti -- rhn-ssl-tool --gen-server --dir="/root/ssl-build" --set-country="COUNTRY" \
  --set-state="STATE" --set-city="CITY" --set-org="ORGANIZATION" \
  --set-org-unit="ORGANIZATION UNIT" --set-email="name@example.com" \
  --set-hostname=PROXY --set-cname="proxy.example.com"

需要使用的文件包括:

  1. /root/ssl-build/RHN-ORG-TRUSTED-SSL-CERT as the root CA,

  2. /root/ssl-build/<hostname>/server.crt as the proxy certificate and

  3. /root/ssl-build/<hostname>/server.key as the proxy certificate’s key.

1.1. 使用 Web UI 生成代理配置

过程:使用 Web UI 生成代理容器配置
  1. 在 Web UI 中,导航到系统  代理配置,然后填写所需数据:

  2. In the Proxy FQDN field type fully qualified domain name for the proxy.

  3. In the Parent FQDN field type fully qualified domain name for the SUSE Multi-Linux Manager Server or another SUSE Multi-Linux Manager Proxy.

  4. In the Proxy SSH port field type SSH port on which SSH service is listening on SUSE Multi-Linux Manager Proxy. Recommended is to keep default 8022.

  5. In the Max Squid cache size [MB] field type maximal allowed size for Squid cache. Recommended is to use at most 80% of available storage for the containers.

    2 GB 表示默认的代理 squid 缓存大小。需要根据您的环境调整此大小。

    In the SSL certificate selection list choose if a new server certificate should be generated for SUSE Multi-Linux Manager Proxy, an existing one should be used, or the SSL part should be skipped entirely. You can consider generated certificates as SUSE Multi-Linux Manager builtin (self signed) certificates. If SUSE Multi-Linux Manager server runs on Kubernetes, the generated certificate option is not possible and replaced with no SSL certificate as they are managed outside the containers.

    Depending on the choice then provide either path to signing CA certificate to generate a new certificate or path to an existing certificate and its key to be used as proxy certificate. If the SSL part is skipped, the resulting configuration archive does not carry server_crt, server_key or ca_crt; the deployment is then responsible for providing the proxy certificate and root CA out-of-band (for Kubernetes deployments this means creating proxy-cert and uyuni-ca manually — see the TLS setup section of the Kubernetes proxy deployment page).

    The CA certificates generated by the server are stored in the /var/lib/containers/storage/volumes/root/_data/ssl-build directory.

    有关现有或自定义证书的详细信息以及企业和中间证书的概念,请参见 导入 SSL 证书。

  6. Click Generate to register a new proxy FQDN in the SUSE Multi-Linux Manager Server and generate a configuration archive (config.tar.gz) containing details for the container host.

  7. 片刻之后,系统会显示文件可供下载。请将此文件保存在本地。

1.2. Generate Proxy Configuration With spacecmd and Self-Signed Certificate

You can generate a Proxy configuration using spacecmd. This is only possible if SUSE Multi-Linux Manager server runs on podman and has a self-signed root CA certificate.

过程:使用 spacecmd 和自我签名证书生成代理配置
  1. 通过 SSH 连接到您的容器主机。

  2. 执行以下命令(替换其中的服务器和代理 FQDN):

    mgrctl exec -ti 'spacecmd proxy_container_config_generate_cert -- dev-pxy.example.com dev-srv.example.com 2048 email@example.com -o /tmp/config.tar.gz'
  3. 从服务器容器复制生成的配置:

    mgrctl cp server:/tmp/config.tar.gz

1.3. Generate Proxy Configuration With spacecmd and Custom Certificate

You can generate a Proxy configuration using spacecmd for custom certificates rather than the default self-signed certificates.

过程:使用 spacecmd 和自定义证书生成代理配置
  1. 通过 SSH 连接到您的服务器容器主机。

  2. Execute the following commands, replacing the Server and Proxy FQDN:

    for f in ca.crt proxy.crt proxy.key; do
      mgrctl cp $f server:/tmp/$f
    done
    mgrctl exec -ti 'spacecmd proxy_container_config -- -p 8022 pxy.example.com srv.example.com 2048 email@example.com /tmp/ca.crt /tmp/proxy.crt /tmp/proxy.key -o /tmp/config.tar.gz'
  3. 如果您的设置使用中间 CA,请同时复制该证书,并在命令中通过 -i 选项(可根据需要多次提供)包含该证书:

    mgrctl cp intermediateCA.pem server:/tmp/intermediateCA.pem
    mgrctl exec -ti 'spacecmd proxy_container_config -- -p 8022 -i /tmp/intermediateCA.pem pxy.example.com srv.example.com 2048 email@example.com /tmp/ca.crt /tmp/proxy.crt /tmp/proxy.key -o /tmp/config.tar.gz'
  4. 从服务器容器复制生成的配置:

    mgrctl cp server:/tmp/config.tar.gz

1.4. Generate Proxy Configuration With spacecmd and no Certificate

You can generate a Proxy configuration using spacecmd with no TLS certificates. This is needed for SUSE Multi-Linux Manager running on Kubernetes as the certificates are handled outside of the containers.

Procedure: Generating Proxy Configuration with spacecmd and no Certificate
  1. 通过 SSH 连接到您的服务器容器主机。

  2. Execute the following commands, replacing the Server and Proxy FQDN:

    for f in ca.crt proxy.crt proxy.key; do
      mgrctl cp $f server:/tmp/$f
    done
    mgrctl exec -ti 'spacecmd proxy_container_config_nossl -- -p 8022 pxy.example.com srv.example.com 2048 email@example.com -o /tmp/config.tar.gz'
  3. 从服务器容器复制生成的配置:

    mgrctl cp server:/tmp/config.tar.gz

2. 传输 SUSE Multi-Linux Manager 代理配置

Both spacecmd command and generating via Web UI ways create a configuration archive. This archive needs to be made available on container host. Transfer this generated archive to the container host.

3. 启动 SUSE Multi-Linux Manager 代理容器

Container can be started with the mgrpxy command.

过程:启动 SUSE Multi-Linux Manager 代理容器
  1. 运行以下命令:

    mgrpxy start uyuni-proxy-pod
  2. 调用以下命令检查所有容器是否都已按预期启动:

    podman ps

Five SUSE Multi-Linux Manager Proxy containers should be present and should be part of proxy-pod container pod.

  • proxy-salt-broker

  • proxy-httpd

  • proxy-tftpd

  • proxy-squid

  • proxy-ssh