设置镜像信任要求¶
语法¶
imgtrust [--allow] [--permanent]
示例¶
要求使用受信任的镜像¶
imgtrust
允许不受信任的镜像¶
imgtrust --allow
永久要求使用受信任的镜像¶
imgtrust --permanent
描述¶
要求使用受信任的镜像。当要求使用受信任的镜像时,任何执行不受信任镜像的尝试都会失败。所有镜像默认都是不受信任的。要成为受信任的镜像,必须使用 imgverify 命令进行验证。
如果指定了 --allow 选项,则不再要求使用受信任的镜像,可以执行不受信任的镜像。
如果指定了 --permanent 选项,镜像信任要求会被永久锁定。此后任何修改镜像信任要求的尝试都会失败。例如:
iPXE> imgtrust # Require trusted images
iPXE> imgtrust --allow # Allow untrusted images
iPXE> imgtrust --permanent # Permanently require trusted images
iPXE> imgtrust --allow # Try to allow untrusted images
Could not set image trust requirement: Permission denied (http://ipxe.org/0200823c)
命令状态¶
| 成功 | 镜像信任要求设置成功 |
|---|---|
| 失败 | 镜像信任要求未能成功设置 |
另请参阅¶
imgverify- iPXE 密码学指南
- 全部 iPXE 命令列表
构建选项¶
此命令仅在启用构建选项 IMAGE_TRUST_CMD 时可用。
备注¶
默认配置始终允许不受信任的镜像。要要求使用受信任的镜像,必须使用包含 imgtrust 命令的嵌入式脚本。例如:
#!ipxe
imgtrust --permanent
dhcp
imgfetch --name vmlinuz ${filename}
imgverify vmlinuz ${filename}.sig
imgexec vmlinuz
不使用嵌入式脚本就没有办法使用受信任的镜像。[^1]
imgtrust 命令只能阻止 iPXE 直接执行不受信任的镜像。例如:执行 Linux 内核镜像时,imgtrust 会阻止执行不受信任的内核镜像,但不会阻止使用不受信任的 initrd。如果你想确保任何额外的镜像(例如 initrd)也是受信任的,必须使用 imgverify 命令显式验证它们。
[^1]: 之所以需要嵌入式脚本,是因为没有标准的方法来获取与 DHCP filename 对应的镜像签名。