swtpm(8) | swtpm(8) |
swtpm - TPM Emulator for TPM 1.2 and 2.0
swtpm socket [OPTIONS]
swtpm chardev [OPTIONS]
swtpm cuse [OPTIONS]
swtpm implements a TPM software emulator built on libtpms. It provides access to TPM functionality over a TCP/IP socket interface or it can listend for commands on a character device, or create a CUSE (character device in userspace) interface for receiving of TPM commands.
Unless corresponding command line parameters are used, the swtpm socket version requires that the environment variable TPM_PORT be set to the TCP/IP port the process is supposed to listen on for TPM request messages.
Similarly, the environment variable TPM_PATH can be set and contain the name of a directory where the TPM can store its persistent state into.
The swtpm process can be gracefully terminated by sending a SIGTERM signal to it.
The swtpm cuse version requires root rights to start the TPM.
The following options are supported if the socket interface is chosen:
This parameter enables a persistent connection by default unless the disconnect option is given. This parameter should be used rather than the -p and --fd options.
The following options are supported if the chardev interface is chosen:
The following options are supported if the cuse interface is chosen:
The following options are supported by the socket and character device interfaces:
The mode parameter allows a user to set the file mode bits of the UnixIO path. The mode bits value must be given as an octal number starting with a '0'. The default value is 0770. uid and gid set the ownership of the UnixIO socket's path. This operation requires root privileges.
The control channel enables out-of-band control of the TPM, such as resetting the TPM.
The following options are support by all interfaces:
If dir is specified, the TPM state files will be written to the dir with the given file mode bits. This value must be given as an octal number starting with a '0'. The default value is 0640.
If backend-uri is specified, the TPM state data will be stored to the URI. Currently backend-uri=dir://<path_to_dir> and backend-uri=file://<path_to_dir> are available. For 'dir://', the URI should specify the path to the directory where files are stored. If path_to_dir starts with a '/' then the path is interpreted as an absolute path, otherwise it is a path relative to the current directory. For 'file://', the URI should specify a single file or block device where TPM state will be stored. A blockdevice must exist already and be big enough to store all state. (since v0.7)
The level parameter allows a user to choose the level of logging. Starting at log level 5, libtpms debug logging is activated.
All logged lines will be prefixed with prefix. By default no prefix is prepended.
If truncate is passed, the log file will be truncated.
The allow-set-locality parameter allows the swtpm to receive TPM/TPM2_SetLocality commands. This is parameter is useful if the Linux VTPM proxy driver access is enabled by file descriptor passing. This option is implied by the --vtpm-proxy option and therefore need not be explicitly set if this option is passed. In all other cases care should be taken as to who can send the TPM/TPM2_SetLocality command.
The key may be in binary format, in which case the file size must be 16 or 32 bytes. If the key is in hex format (default), the key may consist of 32 or 64 hex digits starting with an optional '0x'.
The mode parameter indicates which block chaining mode is to be used. Currently aes-cbc (aes-128-cbc) and aes-256-cbc are supported. The encrypted data is integrity protected using encrypt-then-mac.
The remove parameter will attempt to remove the given keyfile once the key has been read.
The migration key and the key used for encrypting the TPM state files may be the same.
While the key for the TPM state files needs to stay with those files it encrypts, the migration key needs to stay with the TPM state blobs. If for example the state of the TPM is migrated between hosts in a data center, then the TPM migration key must be available at all the destinations, so in effect it may have to be a key shared across all machines in the datacenter. In contrast to that, the key used for encrypting the TPM state files can be different for each TPM and need only be available on the host where the TPM state resides.
The migration key enables the encryption of the TPM state blobs. The keyfile must contain an AES key of supported size; 128 bit (16 bytes) and 256 bit (32 bytes) keys are supported.
The key may be in binary format, in which case the file size must be 16 or 32 bytes. If the key is in hex format (default), the key may consist of 32 or 64 hex digits starting with an optional '0x'.
The mode parameter indicates which block chaining mode is to be used. Currently aes-cbc (aes-128-cbc) and aes-256-cbc are supported. The encrypted data is integrity protected using encrypt-then-mac.
The remove parameter will attempt to remove the given keyfile once the key has been read.
This option is only available on Linux and only if swtpm was compiled with libseccomp support.
The startup options cause a TPM_Startup or TPM2_Startup command to automatically be sent. The startup-deactivated option is only valid for a TPM 1.2. These options imply not-need-init, except for the startup-none option, which results in no command being sent.
If --vtpm-proxy is used, startup-clear is automatically chosen but this can be changed with this option.
{ "type": "swtpm", "features": [ "tpm-1.2", "tpm-2.0", "cmdarg-seccomp", "cmdarg-key-fd", "cmdarg-pwd-fd", "cmdarg-print-states", "nvram-backend-dir", "nvram-backend-file", "tpm-send-command-header", "flags-opt-startup", "rsa-keysize-1024", "rsa-keysize-2048", "rsa-keysize-3072" ], "version": "0.7.0" }
The version field is available since v0.7.
The meaning of the feature verbs is as follows:
(the --tpm2 option is supported)
The following shows the JSON output of this option. It indicates that the 'permall' and 'volatile' states are available.
{ "type": "swtpm", "states": [ { "name": "permall", "size": 6013 }, { "name": "volatile", "size": 1087 } ] }
swtpm_bios, swtpm_cuse
2024-07-30 | swtpm |