피드 구독

The trusted platform module (TPM) is a self-contained hardware encryption technology present in recent computer systems. It provides, among other things, hardware random number generation and more secure storage for encryption keys. This enables administrators to encrypt operating system disks that will then only be decryptable on the same system. Version 2.0 of the TPM specification was published in 2015, and Microsoft’s Windows 11 requires a version 2.0 TPM to be present to install.

To support operating systems like Windows 11 that require a TPM, libvirt provides a virtual TPM (vTPM) that can be configured with a virtual machine (VM) to provide the appearance of a hardware TPM. Red Hat OpenShift Virtualization has supported vTPM as an option since Red Hat OpenShift 4.13, with the persistent storage capability added in OpenShift 4.14.

This means that a Windows 11 VM can employ BitLocker encryption to its system drives and OpenShift Virtualization will handle the encryption keys on its behalf through the vTPM interface. The virtualized TPM comes with an important caveat; it does not provide the same level of security as a physical chip. Any compliance controls that rely on that physical security should be re-evaluated when considering a move to virtual.

Preparing the cluster to support a persisted vTPM

To support the persistent storage of secrets in a VM’s vTPM, OpenShift Virtualization must create a Persistent Volume Claim (PVC) to back that secret storage. The storage class that provides vTPM state must be configured in the HyperConverged custom resource, typically “kubevirt-hyperconverged” in the “openshift-cnv” namespace. The storage class must be a “Filesystem” type (FS), and it should support the “ReadWriteMany” access mode (RWX) in order to allow VMs using a persistent vTPM to make use of live migration. An example of the parameter is below, taken from a cluster using Red Hat OpenShift Data Foundation:

spec:
   vmStateStorageClass: ocs-external-storagecluster-cephfs

Adding persistence to a VM

The change to the VM YAML to set the vTPM to persistent is likewise simple, if deeper in the hierarchy due to the spec.template.spec structure of a VM. The setting for TPM can be found under

spec.template.spec.domain.devices.tpm

To make the vTPM use persistent storage, add “persistent: true” under “tpm”:

oc patch vm win11 --type json -p '[{"op": "add", "path": "/spec/template/spec/domain/devices/tpm", "value": {"persistent": true}}]'

The change to the VM may be made while it is running, but it will not take effect until it is stopped and restarted by OpenShift Virtualization. For best results, include this parameter before running the VM for the first time.

Check that the TPM is now persisted by looking for its PVC. In this example, the VM “win11-broken-cow” has a persistent TPM:

$ oc get vm
NAME                AGE    STATUS    READY
win11-broken-cow    2d9h   Running   True
$ oc get pvc
NAME                                    STATUS     CAPACITY   ACCESS MODES
persistent-state-for-win11-broken-cow   Bound      12Mi       RWX
win11-broken-cow                        Bound      64Gi       RWX

(Some columns have been omitted from output for readability)

There are two important caveats around the vTPM feature. First, a non-persistent vTPM will store and return encryption keys during the lifetime of the virt-launcher Pod the VM runs on. This includes when the guest OS restarts. Therefore, in the case of BitLocker Drive Encryption for a Windows VM, it is not sufficient to select the option, “Run BitLocker system check” while going through the drive encryption wizard. The problem comes as soon as the virt-launcher Pod stops, which happens if you shut down or migrate the VM. Thus, it is possible to encrypt a VM’s disk then immediately lose access to that disk the next time it stops and starts. Windows does its best to force the user to save a copy of the recovery key; in this case, it would be the only way to recover the disk.

The second caveat is that the presence of a persistent vTPM disables the ability to snapshot the VM, as there is no mechanism for snapshotting the vTPM PVC as of the publication of this article. Because of this, online backups of VMs with persistent vTPMs will not be possible. The feature is being tracked in CNV-32718, currently slated for OpenShift 4.17.

Demonstrating persistence in a Windows 11 VM

Starting with a Windows 11 base image, create a new VM by cloning the Windows11 template. If there is not an existing base image, generate one by following this guide: Managing virtual machines with OpenShift Pipelines. Edit the YAML of the VM as shown above to include “persistent: true” under “tpm:”. Once the VM boots, check that a “persistent-state-for-” PVC exists for the chosen VM.

At this point, the C: drive may be encrypted with BitLocker Drive Encryption. Choose the option to print the recovery key to a PDF if using the wizard to start the encryption process as there is no currently no option with OpenShift Virtualization to attach a drive in a way Windows recognizes as removable, and the wizard will refuse to  continue if neither option is chosen. Another option for recovery is to join an Active Directory domain that has the BitLocker Key Recovery service set up, but this is beyond the scope of this article, and still insufficient to get the wizard to continue.

Once the encryption process completes, test the key persistence by shutting down the VM from OpenShift Virtualization. (Simply rebooting from within the OS will result in the OS being restarted in the same virt-launcher Pod it was previously running in, so is not a valid test of persistence.)

Conclusion

The addition of persistent vTPM to OpenShift Virtualization opens the door to compliant workloads that require encryption at rest. Work is planned to allow snapshotting of the persistent storage so encrypted VMs can be backed up, and the question of whether non-persisted vTPM should fail to save keys has been raised.


저자 소개

UI_Icon-Red_Hat-Close-A-Black-RGB

채널별 검색

automation icon

오토메이션

기술, 팀, 인프라를 위한 IT 자동화 최신 동향

AI icon

인공지능

고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

open hybrid cloud icon

오픈 하이브리드 클라우드

하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Original series icon

오리지널 쇼

엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리