6.11. 为测量的引导证明配置 Keylime


当您为测量的引导验证配置 Keylime 时,Keylime 会检查测量系统上的引导过程是否与您定义的状态相符。

先决条件

流程

  1. 在配置并运行 Keylime 代理的受监控系统中,安装 python3-keylime 软件包,其中包含 keylime-policy 工具:

    # dnf -y install python3-keylime
    Copy to Clipboard Toggle word wrap
  2. 在被监控的系统中,使用 keylime-policy 工具从测量的系统当前状态的引导日志生成策略:

    # keylime-policy create measured-boot --eventlog-file /sys/kernel/security/tpm0/binary_bios_measurements --output <./measured_boot_reference_state.json>
    Copy to Clipboard Toggle word wrap
    • <./measured_boot_reference_state.json > 替换为 keylime-policy 保存生成的策略的路径。
    • 如果您的 UEFI 系统没有启用安全引导,请传递 --without-secureboot 参数。

      重要

      使用 keylime-policy 生成的策略基于系统的当前状态,非常严格。任何系统修改,包括内核更新和系统更新都会更改引导过程,系统就会失败。

  3. 将生成的策略复制到配置了 keylime_tenant 工具的系统上,例如:

    # scp root@<agent_ip>:<./measured_boot_reference_state.json> <./measured_boot_reference_state.json>
    Copy to Clipboard Toggle word wrap
  4. 在配置了 Keylime 租户的系统上,使用 keylime_tenant 工具置备代理:

    # keylime_tenant --command add --targethost <agent_ip> --uuid <agent_uuid> --mb_refstate <./measured_boot_reference_state.json> --cert default
    Copy to Clipboard Toggle word wrap
    • <agent_ip> 替换为代理的 IP 地址。
    • <agent_uuid> 替换为代理的 UUID。
    • <./measured_boot_reference_state.json> 替换为计算引导策略的路径。

    如果您将测量的引导与运行时监控相结合,请在输入 keylime_tenant --command add 命令时提供这两个用例中的所有选项。

    注意

    您可以使用 # keylime_tenant --command delete --targethost <agent_ ip>--uuid <agent_ uuid&gt ; 命令停止对节点 监控进行 Keylime。

    您可以使用 keylime_tenant --command update 命令修改已注册代理的配置。

验证

  1. 重启被监控的系统,并验证代理是否成功:

    # keylime_tenant --command cvstatus --uuid <agent_uuid>
    ...
    {"<agent_uuid>": {"operational_state": "Get Quote"..."attestation_count": 5
    ...
    Copy to Clipboard Toggle word wrap

    <agent_uuid> 替换为代理的 UUID。

    如果 operational_state 的值为 Get Quote,并且 attestation_count 为非零,则此代理的证明成功。

    如果 operational_state 的值为 Invalid QuoteFailed,则验证失败,命令会显示类似如下的输出:

    {"<agent_uuid>": {"operational_state": "Invalid Quote", ... "ima.validation.ima-ng.not_in_allowlist", "attestation_count": 5, "last_received_quote": 1684150329, "last_successful_attestation": 1684150327}}
    Copy to Clipboard Toggle word wrap
  2. 如果验证失败,请在验证器日志中显示更多详细信息:

    # journalctl -u keylime_verifier
    {"d432fbb3-d2f1-4a97-9ef7-75bd81c00000": {"operational_state": "Tenant Quote Failed", ... "last_event_id": "measured_boot.invalid_pcr_0", "attestation_count": 0, "last_received_quote": 1684487093, "last_successful_attestation": 0}}
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat