GPG 密钥

安装软件包之前,客户端会使用 GPG 密钥检查这些软件包的真实性。只有可信软件才能安装在客户端上。

在大多数情况下,您无需调整 GPG 设置即可在您的客户端上安装软件。

可以直接对 RPM 软件包签名,而基于 Debian 的系统仅会对元数据签名并使用校验和链来保障软件包的安全。大多数基于 RPM 的系统除了使用已签名软件包外,还会使用已签名元数据。

操作系统要么直接信任自己的 GPG 密钥,要么至少将它们与最小系统一起安装,但通过其他 GPG 密钥签名的第三方软件包需要手动处理。客户端可以在不信任 GPG 密钥的情况下成功引导,但除非密钥受信任,否则您将无法安装新的客户端工具软件包或更新软件包。

客户端现在使用为软件通道输入的 GPG 密钥信息来管理受信任密钥。如果将具有 GPG 密钥信息的软件通道指派给客户端,当通道刷新后或从此通道安装第一个软件包后,系统就会信任该密钥。

软件通道页面中的 GPG 密钥 URL 参数可以包含以空格分隔的多个密钥 URL。如果其为文件 URL,则必须在使用软件通道之前在客户端上部署 GPG 密钥文件。

The GPG keys for the Client Tools Channels of Red Hat based clients are deployed on the client into /etc/pki/rpm-gpg/ and can be referenced with file URLs.

对于 SUSE Liberty Linux 客户端的 GPG 密钥,情况也是如此。

仅当为客户端指派了软件通道时,系统才会导入并信任这些密钥。

由于基于 Debian 的系统仅会对元数据签名,因此不需要为各个通道指定确切的密钥。如果用户按 储存库元数据 中的“使用自己的 GPG 密钥”所述配置了自己的 GPG 密钥来对元数据签名,系统会自动部署并信任该密钥。

1. 用户定义的 GPG 密钥

用户可以定义要部署到客户端的自定义 GPG 密钥。

通过提供某些 pillar 数据并在 Salt 文件系统中提供 GPG 密钥文件,系统会自动将它们部署到客户端。

These keys are deployed into /etc/pki/rpm-gpg/ on RPM based operating systems and to /usr/share/keyrings/ on Debian systems:

Define the pillar key [literal`custom_gpgkeys` for the client you want to deploy the key to and list the names of the key file.

cat /srv/pillar/mypillar.sls
custom_gpgkeys:
  - my_first_gpg.key
  - my_second_gpgkey.gpg

Additionally in the Salt filesystem create a directory named gpg and store there the GPG key files with the name specified in the custom_gpgkeys pillar data.

ls -la /srv/salt/gpg/
/srv/salt/gpg/my_first_gpg.key
/srv/salt/gpg/my_second_gpgkey.gpg

The keys are deployed to the client at /etc/pki/rpm-gpg/my_first_gpg.key and /etc/pki/rpm-gpg/my_second_gpgkey.gpg.

The last step is to add the URL to the GPG key URL field of the software channel. Navigate to Software  Manage  Channels and select the channel you want to modify. Add to GPG key URL the value file:///etc/pki/rpm-gpg/my_first_gpg.key.

2. 引导脚本中的 GPG 密钥

过程:在客户端上使用引导脚本信任 GPG 密钥
  1. On the SUSE Multi-Linux Manager Server, at the command prompt, check the contents of the /srv/www/htdocs/pub/ directory. This directory contains all available public keys. Take a note of the key that applies to the channel assigned to the client you are registering.

  2. Open the relevant bootstrap script, locate the ORG_GPG_KEY= parameter and add the required key. For example:

    uyuni-gpg-pubkey-0d20833e.key

    您无需删除任何以前存储的密钥。

信任 GPG 密钥对于客户端的安全非常重要。由管理员来决定需要哪些密钥,可以信任哪些密钥。如果不信任 GPG 密钥,便无法为客户端指派软件通道。