본문 바로가기

Security

vTPM 구성 테스트

 

물리 서버에 TPM이 구성된 환경을 가지기 어려운 상황에서는 vTPM을 이용하여, TPM 관련 테스트를 진행해볼 수 있습니다.

(사실 vTPM을 이용하려면, 하단의 Hypervisor에는 이미 TPM 설정이 되어 있어야 하긴 합니다.)

 

아래 예제는 Nested ESXi VM에 vTPM Device를 추가하고 Motherboard 교체 시 어떤 현상이 발생하는지까지 테스트 해 본 내용입니다.

 

Nested ESXi의 경우, Powershell로만 vTPM 추가가 가능한 것으로 보임

https://williamlam.com/2022/05/quick-tip-adding-a-vtpm-virtual-trusted-platform-module-to-a-nested-esxi-vm.html

 

참고로 ESXi 설치하기 위해 생성한 VM의 경우에는 Device 추가 메뉴에서 TPM이 확인되지 않지만,

 

Windows 설치하기 위해 생성한 VM의 경우에는 UI에서 TPM(Trusted Platform Module) 확인 가능

 

1. vCenter에 연결

PS C:\> Connect-VIServer -Server 192.168.1.3 -User administrator@vsphere.local -Password P@ssw0rd
 
Name                           Port  User
----                           ----  ----
192.168.1.3                    443   VSPHERE.LOCAL\Administrator

 

2. VM 확인

PS C:\> Get-VM "vTPM-ESXi"
 
Name                 PowerState Num CPUs MemoryGB
----                 ---------- -------- --------
vTPM-ESXi            PoweredOff 8        16.000

 

3. vTPM Device 추가

PS C:\> Get-VM "vTPM-ESXi" | New-VTpm
 
Name                 Key        Description
----                 ---        -----------
Virtual TPM          11000      Virtual Trusted Platform Module

 

4. VM에 ESXi 설치

 

5. Nested ESXi VM에 SSH로 접근하여 TPM 상태 확인

[root@vTPM-ESXi:~] esxcli hardware trustedboot get
   Drtm Enabled: false
   Tpm Present: true
 
[root@vTPM-ESXi:~] esxcli system settings encryption get
   Mode: TPM
   Require Executables Only From Installed VIBs: false
   Require Secure Boot: true

 

추가 테스트

Motherboard 변경 재현을 위해서 다른 VM을 만들고, vmdk만 기존 VM의 vmdk 경로로 지정

우선, 고객사 환경과 동일하게 TPM은 활성화 되어 있으나, Secure Boot는 비활성화된 상태에서 ESXi 설치

VM Name : vTPM-ESXi

[root@vTPM-ESXi:~] esxcli hardware trustedboot get
   Drtm Enabled: false
   Tpm Present: true
 
[root@vTPM-ESXi:~] esxcli system settings encryption get
   Mode: TPM
   Require Executables Only From Installed VIBs: false
   Require Secure Boot: false
 
[root@vTPM-ESXi:~] vsish -e get /hardware/firmwareType
 1 -> UEFI
 
[root@vTPM-ESXi:~] vsish -e get /secureBoot/status
Secure boot status {
   Secure Boot attempted:0
   Secure Boot successfully completed:0
   Secure Boot status set:1
   Lowest Acceptance Level:certified
}

 

ESXi가 설치되지 않은 VM 생성(TPM은 활성화, Secure Boot는 비활성화)
VM Name : vTPM-ESXi2

 

 

vTPM-ESXi VM을 Power Off 하고, vTPM-ESXi2의 Edit Settings에서 Harddisk를 vTPM-ESXi의 vmdk 파일로 지정
변경 전

 

변경 후

 

 

변경 후 vTPM-ESXi2 VM 부팅 시도

예상대로 부팅 실패

 

이를 복구하기 위해서 아래 KB 참고
Boot time failures due to ESXi configuration encryption (81446)
https://kb.vmware.com/s/article/81446

기존 VM인 vTPM-ESXi에서 Recovery Key 확인

[root@vTPM-ESXi:~] esxcli system settings encryption recovery list
Recovery ID                             Key
--------------------------------------  ---
{F58A9042-D2D4-48FC-BC76-FB4A8EB825D1}  520432-658142-287410-318409-442204-496578-260871-197490-257089-419967-315127-708312-676094-568768-115074-643559

 

다시 신규 VM인 vTPM-ESXi2를 부팅할 때, Shift+O로 진입한 후 KB81446에 기술된 것처럼 Recovery Key 입력

 

정상 부팅