| 1 |
Author: Daniel De Graaf <[email protected]> |
| 2 |
|
| 3 |
================================================================================ |
| 4 |
Overview |
| 5 |
================================================================================ |
| 6 |
|
| 7 |
This document describes example platforms which use virtual TPMs to provide |
| 8 |
security properties for guests running on the platforms. There are several |
| 9 |
tradeoffs between flexibility and trust which must be considered when |
| 10 |
implementing a platform containing vTPMs. |
| 11 |
|
| 12 |
================================================================================ |
| 13 |
Example 1: Trusted Domain 0 |
| 14 |
================================================================================ |
| 15 |
|
| 16 |
This is the simplest example and provides maximal flexibility for testing the |
| 17 |
vTPM Manager and vTPMs. The vtpmmgr, vtpm, and guest domains are created using |
| 18 |
xl from the command line on domain 0. |
| 19 |
|
| 20 |
Provisioning on domain 0: |
| 21 |
# dd if=/dev/zero of=/images/vtpmmgr-stubdom.img bs=2M count=1 |
| 22 |
# dd if=/dev/zero of=/images/vtpm-guest1.img bs=2M count=1 |
| 23 |
# dd if=/dev/zero of=/images/vtpm-guest2.img bs=2M count=1 |
| 24 |
|
| 25 |
The vtpmmgr configuration file (vtpmmgr.cfg): |
| 26 |
|
| 27 |
name="vtpmmgr" |
| 28 |
kernel="/usr/lib/xen/boot/vtpmmgr-stubdom.gz" |
| 29 |
extra="tpmlocality=2" |
| 30 |
memory=8 |
| 31 |
disk=["file:/images/vtpmmgr-stubdom.img,hda,w"] |
| 32 |
iomem=["fed42,1"] |
| 33 |
|
| 34 |
The vtpm configuration files (vtpm-guest1.cfg, vtpm-guest2.cfg): |
| 35 |
|
| 36 |
name="vtpm-guest1" |
| 37 |
kernel="/usr/lib/xen/boot/vtpm-stubdom.gz" |
| 38 |
extra="loglevel=debug" |
| 39 |
memory=8 |
| 40 |
disk=["file:/images/vtpm-guest1.img,hda,w"] |
| 41 |
vtpm=["backend=vtpmmgr,uuid=ac0a5b9e-cbe2-4c07-b43b-1d69e46fb839"] |
| 42 |
|
| 43 |
name="vtpm-guest2" |
| 44 |
kernel="/usr/lib/xen/boot/vtpm-stubdom.gz" |
| 45 |
extra="loglevel=debug" |
| 46 |
memory=8 |
| 47 |
disk=["file:/images/vtpm-guest2.img,hda,w"] |
| 48 |
vtpm=["backend=vtpmmgr,uuid=6c3ff5f1-8d58-4fed-b00d-a5ea9a817f7f"] |
| 49 |
|
| 50 |
The guest configuration files (guest1.cfg, guest2.cfg): |
| 51 |
|
| 52 |
name="guest1" |
| 53 |
kernel="/usr/lib/xen/boot/pv-grub-x86_64.gz" |
| 54 |
memory=1024 |
| 55 |
disk=["file:/images/guest1.img,xvda,w"] |
| 56 |
vif=['mac=00:01:02:03:04:05,bridge=br0'] |
| 57 |
vtpm=["backend=vtpm-guest1"] |
| 58 |
|
| 59 |
name="guest2" |
| 60 |
kernel="/usr/lib/xen/boot/pv-grub-x86_64.gz" |
| 61 |
memory=1024 |
| 62 |
disk=["file:/images/guest2.img,xvda,w"] |
| 63 |
vif=['mac=00:01:02:03:04:06,bridge=br0'] |
| 64 |
vtpm=["backend=vtpm-guest2"] |
| 65 |
|
| 66 |
Starting domains: |
| 67 |
|
| 68 |
# xl create vtpmmgr.cfg |
| 69 |
# xl create vtpm-guest1.cfg |
| 70 |
# xl create guest1.cfg |
| 71 |
|
| 72 |
================================================================================ |
| 73 |
Example 2: Domain Builder with Static vTPMs |
| 74 |
================================================================================ |
| 75 |
|
| 76 |
This example uses the domain builder to construct a TPM Manager and vTPM which |
| 77 |
do not require trusting the hardware domain with the vTPM's secrets. However, |
| 78 |
it is not possible to construct additional vTPMs after the system is booted, and |
| 79 |
the guests with access to vTPMs may not be rebooted without rebooting the entire |
| 80 |
platform. |
| 81 |
|
| 82 |
The domain builder (dom0) constructs: |
| 83 |
dom1 - xenstore system_u:system_r:xenstore_t |
| 84 |
dom2 - hardware system_u:system_r:hwdom_t |
| 85 |
dom3 - vtpmmgr system_u:system_r:vtpmmgr_t |
| 86 |
dom4 - vtpm-hw system_u:system_r:vtpm_t |
| 87 |
dom5 - vtpm-g1 guest1_u:vm_r:vtpm_t |
| 88 |
dom6 - vtpm-g2 guest2_u:vm_r:vtpm_t |
| 89 |
dom7 - guest1 guest1_u:vm_r:guest_t |
| 90 |
dom8 - guest2 guest2_u:vm_r:guest_t |
| 91 |
|
| 92 |
It unpauses dom1 and dom2 after setting up Xenstore. The hardware domain is not |
| 93 |
permitted access to IO memory at 0xfed42; this IO memory is accessible to the |
| 94 |
vtpmmgr domain. The two guest domains may be instantiated using pv-grub or |
| 95 |
using the same kernel as the hardware domain to conserve space in the domain |
| 96 |
builder's initrd. |
| 97 |
|
| 98 |
Once the hardware domain boots, it runs: |
| 99 |
|
| 100 |
# xl block-attach vtpmmgr 'backendtype=phy,backend=hardware,vdev=hda,access=w,target=/dev/lvm/vtpmmgr' |
| 101 |
# xl block-attach vtpm-hw 'backendtype=phy,backend=hardware,vdev=hda,access=w,target=/dev/lvm/vtpm-hw' |
| 102 |
# xl block-attach vtpm-g1 'backendtype=phy,backend=hardware,vdev=hda,access=w,target=/dev/lvm/vtpm-g1' |
| 103 |
# xl block-attach vtpm-g2 'backendtype=phy,backend=hardware,vdev=hda,access=w,target=/dev/lvm/vtpm-g2' |
| 104 |
# xl block-attach guest1 'backendtype=phy,backend=hardware,vdev=xvda,access=w,target=/dev/lvm/guest1' |
| 105 |
# xl block-attach guest2 'backendtype=phy,backend=hardware,vdev=xvda,access=w,target=/dev/lvm/guest2' |
| 106 |
# xl vtpm-attach vtpm-hw uuid=062b6416-ed46-492a-9e65-a2f92dc07f7f backend=vtpmmgr |
| 107 |
# xl vtpm-attach vtpm-g1 uuid=e9aa9d0f-ece5-4b84-b129-93004ba61a5f backend=vtpmmgr |
| 108 |
# xl vtpm-attach vtpm-g2 uuid=3fb2caf0-d305-4516-96c7-420618d98efb backend=vtpmmgr |
| 109 |
# xl vtpm-attach hardware uuid=062b6416-ed46-492a-9e65-a2f92dc07f7f backend=vtpm-hw |
| 110 |
# xl vtpm-attach guest1 uuid=e9aa9d0f-ece5-4b84-b129-93004ba61a5f backend=vtpm-g1 |
| 111 |
# xl vtpm-attach guest2 uuid=3fb2caf0-d305-4516-96c7-420618d98efb backend=vtpm-g2 |
| 112 |
|
| 113 |
Once these commands are complete, the domains are unpaused and may boot. The XSM |
| 114 |
policy must be configured to not allow any of the domain types named above to be |
| 115 |
created by any domain except the domain builder; guests created by the hardware |
| 116 |
domain or one of the primary guests acting as a control domain must have a |
| 117 |
different type. The type vtpmmgr_t may only map grants from vtpm_t; vtpm_t may |
| 118 |
only map grants from a domain of type guest_t or hwdom_t with the same user |
| 119 |
field. |
| 120 |
|
| 121 |
This example may be extended to allow dynamic creation of domains by using a |
| 122 |
domain builder that accepts build requests. A single build request would create |
| 123 |
a pair of domains using an unused XSM user field: a vTPM and a pv-grub domain |
| 124 |
which requires the presence of a vTPM. To bind the configuration of the guest |
| 125 |
to the vTPM, the guest may use full-disk encryption which can be unlocked using |
| 126 |
an unseal operation; using the wrong vTPM will then yield a non-functioning |
| 127 |
guest. |
| 128 |
|
| 129 |
In order to use pv-grub to obtain measurements of the guest kernel in PCRs 4 and |
| 130 |
5, it must not be possible to attach to a guest's vTPM without booting a fresh |
| 131 |
guest image. This requires pairing every vTPM's launch with the launch of a |
| 132 |
guest, as described above, and using the --vtpm-label= argument to pv-grub so |
| 133 |
that it refuses to launch a guest if it could not write to the vTPM. To permit |
| 134 |
the hardware domain, which cannot use pv-grub, to use a vTPM in this situation, |
| 135 |
multiple vTPM groups must be used in the TPM Manager. Group 0 would be for the |
| 136 |
hardware domain only, and would only support vTPMs with label |
| 137 |
"system_u:system_r:vtpm_t". Group 1 would support vTPMs with label |
| 138 |
"*:vm_r:vtpm_t", and would be used for all guest vTPMs. The EK quote used in |
| 139 |
initial provisioning and any deep quotes produced later would include the label, |
| 140 |
which would allow a verifier to reliably determine if the value of the vTPM's |
| 141 |
PCR 4 contains the hash of the domain's kernel. |