20.4. 在 Windows 虚拟机上启用增强的硬件安全

为进一步保护 Windows 虚拟机(VM),您可以启用基于虚拟化的代码完整性保护,也称为 hypervisor 保护的代码完整性(HVCI)。

先决条件

流程

  1. 打开 Windows 虚拟机的 XML 配置。以下示例打开 Example-L1 虚拟机的配置:

    # virsh edit Example-L1
  2. <cpu> 部分下,指定 CPU 模式并添加策略标记。

    重要
    • 对于 Intel CPU,启用 vmx 策略标记。
    • 对于 AMD CPU,启用 svm 策略标记。
    • 如果您不想指定一个自定义 CPU,您可以将 <cpu mode> 设置为 host-passthrough
    <cpu mode='custom' match='exact' check='partial'>
        <model fallback='allow'>Skylake-Client-IBRS</model>
        <topology sockets='1' dies='1' cores='4' threads='1'/>
        <feature policy='require' name='vmx'/>
    </cpu>
  3. 保存 XML 配置并重启虚拟机。
  4. 在虚拟机操作系统中,进入到 Core 隔离详情页 :

    settings > Update & Security > Windows Security > Device Security > Core isolated details

  5. 切换开关以启用 内存完整性
  6. 重启虚拟机。
注意

有关启用 HVCI 的其他方法,请查看相关的 Microsoft 文档。

验证

  • 确保 Windows 虚拟机上的 Device Security 页面显示以下信息:

    settings > Update & Security > Windows Security > device Security

    Your device meets the requirements for enhanced hardware security.
  • 或者,检查有关 Windows 虚拟机的系统信息:

    1. 在命令提示符下运行 msinfo32.exe
    2. 检查是否在 基于虚拟化的安全服务运行 下列出了 凭据保护,Hypervisor 强制的代码完整性