|
| 1 | +======================================= |
| 2 | +Emulated Trusted Platform Module (vTPM) |
| 3 | +======================================= |
| 4 | + |
| 5 | +.. versionadded:: 22.0.0 (Victoria) |
| 6 | + |
| 7 | +Starting in the 22.0.0 (Victoria) release, Nova supports adding an emulated |
| 8 | +virtual `Trusted Platform Module`__ (vTPM) to guests. |
| 9 | + |
| 10 | +.. __: https://en.wikipedia.org/wiki/Trusted_Platform_Module |
| 11 | + |
| 12 | + |
| 13 | +Enabling vTPM |
| 14 | +------------- |
| 15 | + |
| 16 | +The following are required on each compute host wishing to support the vTPM |
| 17 | +feature: |
| 18 | + |
| 19 | +* Currently vTPM is only supported when using the libvirt compute driver with a |
| 20 | + :oslo.config:option:`libvirt.virt_type` of ``kvm`` or ``qemu``. |
| 21 | + |
| 22 | +* A `key manager service`__, such as `barbican`__, must be configured to store |
| 23 | + secrets used to encrypt the virtual device files at rest. |
| 24 | + |
| 25 | +* QEMU version >= 2.11 (>= 2.12 is recommended) |
| 26 | + |
| 27 | +* Libvirt version >= 5.6.0 |
| 28 | + |
| 29 | +* The swtpm__ binary and associated libraries__. |
| 30 | + |
| 31 | +* Set the :oslo.config:option:`libvirt.swtpm_enabled` config option to |
| 32 | + ``True``. This will enable support for both TPM version 1.2 and 2.0. |
| 33 | + |
| 34 | +With the above requirements satisfied, verify vTPM support by inspecting the |
| 35 | +traits on the compute node's resource provider: |
| 36 | + |
| 37 | +.. code:: console |
| 38 | +
|
| 39 | + $ openstack resource provider trait list $compute_uuid | grep SECURITY_TPM |
| 40 | + | COMPUTE_SECURITY_TPM_1_2 | |
| 41 | + | COMPUTE_SECURITY_TPM_2_0 | |
| 42 | +
|
| 43 | +.. __: https://docs.openstack.org/api-guide/key-manager/ |
| 44 | +.. __: https://docs.openstack.org/barbican/latest/ |
| 45 | +.. __: https://github.com/stefanberger/swtpm/wiki |
| 46 | +.. __: https://github.com/stefanberger/libtpms/ |
| 47 | + |
| 48 | + |
| 49 | +Configuring a flavor or image |
| 50 | +----------------------------- |
| 51 | + |
| 52 | +A vTPM can be requested on a server via :ref:`flavor extra_specs <vtpm-flavor>` |
| 53 | +or image metadata properties. |
| 54 | + |
| 55 | +.. list-table:: |
| 56 | + :header-rows: 1 |
| 57 | + |
| 58 | + * - Flavor extra_specs |
| 59 | + - Image metadata |
| 60 | + - Description |
| 61 | + * - ``hw:tpm_version`` |
| 62 | + - ``hw_tpm_version`` |
| 63 | + - Specify the TPM version, ``1.2`` or ``2.0``. Required if requesting a |
| 64 | + vTPM. |
| 65 | + * - ``hw:tpm_model`` |
| 66 | + - ``hw_tpm_model`` |
| 67 | + - Specify the TPM model, ``tpm-tis`` (the default) or ``tpm-crb`` (only |
| 68 | + valid with version ``2.0``. |
| 69 | + |
| 70 | +Scheduling will fail if flavor and image supply conflicting values, or if model |
| 71 | +``tpm-crb`` is requested with version ``1.2``. |
| 72 | + |
| 73 | +Upon successful boot, the server should see a TPM device such as ``/dev/tpm0`` |
| 74 | +which can be used in the same manner as a hardware TPM. |
| 75 | + |
| 76 | + |
| 77 | +Limitations |
| 78 | +----------- |
| 79 | + |
| 80 | +* Only server operations performed by the server owner are supported, as the |
| 81 | + user's credentials are required to unlock the virtual device files on the |
| 82 | + host. Thus the admin may need to decide whether to grant the user additional |
| 83 | + policy roles; if not, those operations are effectively disabled. |
| 84 | + |
| 85 | +* Live migration, cold migration, resize, evacuation, shelving and rescuing of |
| 86 | + servers with vTPMs is not currently supported. |
| 87 | + |
| 88 | + |
| 89 | +Security |
| 90 | +-------- |
| 91 | + |
| 92 | +With a hardware TPM, the root of trust is a secret known only to the TPM user. |
| 93 | +In contrast, an emulated TPM comprises a file on disk which the libvirt daemon |
| 94 | +must be able to present to the guest. At rest, this file is encrypted using a |
| 95 | +passphrase stored in a key manager service. The passphrase in the key manager |
| 96 | +is associated with the credentials of the owner of the server (the user who |
| 97 | +initially created it). The passphrase is retrieved and used by libvirt to |
| 98 | +unlock the emulated TPM data any time the server is booted. |
| 99 | + |
| 100 | +Although the above mechanism uses a libvirt secret__ that is both ``private`` |
| 101 | +(can't be displayed via the libvirt API or ``virsh``) and ``ephemeral`` (exists |
| 102 | +only in memory, never on disk), it is theoretically possible for a sufficiently |
| 103 | +privileged user to retrieve the secret and/or vTPM data from memory. |
| 104 | + |
| 105 | +A full analysis and discussion of security issues related to emulated TPM is |
| 106 | +beyond the scope of this document. |
| 107 | + |
| 108 | +.. __: https://libvirt.org/formatsecret.html#SecretAttributes |
| 109 | + |
| 110 | + |
| 111 | +References |
| 112 | +---------- |
| 113 | + |
| 114 | +* `QEMU docs on tpm`__ |
| 115 | +* `Libvirt XML to request emulated TPM device`__ |
| 116 | +* `Libvirt secret for usage type ``vtpm```__ |
| 117 | +
|
| 118 | +.. __: https://github.com/qemu/qemu/blob/stable-2.12/docs/specs/tpm.txt |
| 119 | +.. __: https://libvirt.org/formatdomain.html#elementsTpm |
| 120 | +.. __: https://libvirt.org/formatsecret.html#vTPMUsageType |
0 commit comments