储存库元数据

需有一个自定义 GPG 密钥才能为储存库元数据签名。

To access a shell inside the Server container run mgrctl term on the container host.

Procedure: Generating a custom GPG key
  1. As the root user, use the gpg command to generate a new key:

    mgrctl exec -it -- gpg --full-generate-key
  2. At the prompts, select RSA as the key type, with a size of 2048 bits, and select an appropriate expiry date for your key. Check the details for your new key, and type y to confirm.

  3. 根据提示输入要与该密钥关联的名称和电子邮件地址。 You can also add a comment to help you identify the key, if desired. When you are happy with the user identity, type O to confirm.

  4. 根据提示输入通行口令以保护您的密钥。

  5. 该密钥应自动添加到您的密钥环。 可以通过列出密钥环中的密钥进行检查:

    mgrctl exec -- gpg --list-keys
  6. Add the password for your keyring to the /etc/rhn/signing.conf configuration file, by opening the file in your text editor and adding this line:

    GPGPASS="password"

有关如何续订 GPG 密钥,请参见 同步查错

You can manage metadata signing on the command line using the mgr-sign-metadata-ctl command.

Procedure: Enabling metadata signing
  1. 您需要知道所要使用的密钥的短标识符。 可以简短格式列出可用的公共密钥:

    mgrctl exec -- gpg --keyid-format short --list-keys
    ...
    pub   rsa4096/3E7BFE0A 2019-04-02 [SC] [expires: 2029-04-01]
          A43F9EC645ED838ED3014B035CFA51BF3E7BFE0A
    uid         [ultimate] SUSE Manager
    sub   rsa4096/118DE7FF 2019-04-02 [E] [expires: 2029-04-01]
  2. Enable metadata signing with the mgr-sign-metadata-ctl command:

    mgrctl exec -- mgr-sign-metadata-ctl enable 3E7BFE0A
    OK. Found key 3E7BFE0A in keyring.
    DONE. Set key 3E7BFE0A in /etc/rhn/signing.conf.
    DONE. Enabled metadata signing in /etc/rhn/rhn.conf.
    DONE. Exported key 3E7BFE0A to /srv/susemanager/salt/gpg/mgr-keyring.gpg.
    DONE. Exported key 3E7BFE0A to /var/spacewalk/gpg/<KEY_NAME>.key.
    NOTE. For the changes to become effective run:
       mgr-sign-metadata-ctl regen-metadata
  3. 可以使用以下命令检查您的配置是否正确:

    mgrctl exec -- mgr-sign-metadata-ctl check-config
  4. Restart the container for the configuration changes to be detected.

    mgradm restart
  5. Schedule metadata regeneration to replace all metadata with new signed versions.

    mgrctl exec -- mgr-sign-metadata-ctl regen-metadata

You can also use the mgr-sign-metadata-ctl command to perform other tasks. Use mgr-sign-metadata-ctl --help to see the complete list.

储存库元数据签名是全局选项。启用后,将对服务器上的所有软件通道启用该选项。这意味着,连接到服务器的所有客户端需要信任新的 GPG 密钥才能安装或更新软件包。

Procedure: Importing GPG keys on clients
  1. 将 GPG 密钥部署到客户端的过程适用于 Salt 状态。

  2. 使用 SUSE Multi-Linux Manager Web UI 应用 Highstate。

有关 GPG 密钥查错的详细信息,请参见 同步查错