1swtpm(8)                                                              swtpm(8)
2
3
4

NAME

6       swtpm - TPM Emulator for TPM 1.2 and 2.0
7

SYNOPSIS

9       swtpm socket [OPTIONS]
10
11       swtpm chardev [OPTIONS]
12
13       swtpm cuse [OPTIONS]
14

DESCRIPTION

16       swtpm implements a TPM software emulator built on libtpms.  It provides
17       access to TPM functionality over a TCP/IP socket interface or it can
18       listend for commands on a character device, or create a CUSE (character
19       device in userspace) interface for receiving of TPM commands.
20
21       Unless corresponding command line parameters are used, the swtpm socket
22       version requires that the environment variable TPM_PORT be set to the
23       TCP/IP port the process is supposed to listen on for TPM request
24       messages.
25
26       Similarly, the environment variable TPM_PATH can be set and contain the
27       name of a directory where the TPM can store its persistent state into.
28
29       The swtpm process can be gracefully terminated by sending a SIGTERM
30       signal to it.
31
32       The swtpm cuse version requires root rights to start the TPM.
33

Options for socket interface

35       The following options are supported if the socket interface is chosen:
36
37       -p|--port <port>
38           Use the given port rather than using the environment variable
39           TPM_PORT.
40
41       -t|--terminate
42           Terminate the TPM after the client has closed the connection.
43
44       --server [type=tcp][,port=<port>[,bindaddr=<address>
45       [,ifname=<ifname>]]][,fd=<fd>][,disconnect]
46           Expect TCP connections on the given port; if a port is not provided
47           a file descriptor must be passed with the fd parameter and the
48           commands are read from this file descriptor then.  If a port is
49           provided the bind address on which to listen for TCP connections
50           can be provided as well; the default bind address is 127.0.0.1. If
51           a link local IPv6 address is provided, the name of the interface to
52           bind to must be provided with ifname.
53
54           This parameter enables a persistent connection by default unless
55           the disconnect option is given. This parameter should be used
56           rather than the -p and --fd options.
57
58       --server type=unixio[,path=<path>][,fd=<fd>]
59       [,mode=<0...>][,uid=<uid>][,gid=<gid>]
60           Expect UnixIO connections on the given path. If no path is
61           provided, a file descriptor must be passed instead. The mode
62           parameter allows a user to set the file mode bits of the UnixIO
63           path. The mode bits value must be given as an octal number starting
64           with a '0'.  The default value is 0770. uid and gid set the
65           ownership of the UnixIO socket's path.  This operation requires
66           root privileges.
67

Options for character device interface

69       The following options are supported if the chardev interface is chosen:
70
71       -c|--chardev <device path>
72           Use the given device to listen for TPM commands and send response
73           on.
74
75       --vtpm-proxy
76           Create a Linux vTPM proxy device instance and read TPM commands
77           from its backend device.
78

Options for the CUSE interface

80       The following options are supported if the cuse interface is chosen:
81
82       -n|--name <NAME>
83           The TPM will use a device with the given name. A device with the
84           given name will be created in /dev. This is a mandatory option.
85
86       -M|--maj <MAJOR>
87           Create the device with the given major number.
88
89       -m|--min <MINOR>
90           Create the device with the given minor number.
91

Options for socket and character device interfaces:

93       The following options are supported by the socket and character device
94       interfaces:
95
96       -f|--fd <fd>
97           Use the given socket file descriptor or character device file
98           descriptor for receiving TPM commands and sending responses.  For
99           the socket interface, this option automatically assumes -t.
100
101       -d|--daemon
102           Daemonize the process.
103
104       --ctrl type=[unixio|tcp][,path=<path>]
105       [,port=<port>[,bindaddr=<address>[,ifname=<ifname>]]]
106       [,fd=<filedescriptor>|clientfd=<filedescriptor>]
107       [,mode=<0...>][,uid=<uid>][,gid=<gid>]
108           This option adds a control channel to the TPM. The control channel
109           can either use a UnixIO socket with a given path or filedescriptor
110           or it can use a TCP socket on the given port or filedescriptor.  If
111           a port is provided the bind address on which to listen for TCP
112           connections can be provided as well; the default bind address is
113           127.0.0.1. If a link local IPv6 address is provided, the name of
114           the interface to bind to must be provided with ifname.
115
116           The mode parameter allows a user to set the file mode bits of the
117           UnixIO path.  The mode bits value must be given as an octal number
118           starting with a '0'.  The default value is 0770. uid and gid set
119           the ownership of the UnixIO socket's path.  This operation requires
120           root privileges.
121
122           The control channel enables out-of-band control of the TPM, such as
123           resetting the TPM.
124
125       --flags [not-need-init]
126       [,startup-clear|startup-state|startup-deactivated|startup-none]
127           The not-need-init flag enables the TPM to accept TPM commands right
128           after start without requiring a INIT to be sent to it through the
129           command channel (see the '-i' option of swtpm_ioctl).
130
131           The startup options cause a TPM_Startup or TPM2_Startup command to
132           automatically be sent. The startup-deactivated option is only valid
133           for a TPM 2.0. These options imply not-need-init, except for the
134           startup-none option, which results in no command being sent.
135
136           If --vtpm-proxy is used, startup-clear is automatically chosen but
137           this can be changed with this option.
138

Options for all interfaces

140       The following options are support by all interfaces:
141
142       --tpmstate dir=<dir>[,mode=<0...>]
143           Use the given path rather than using the environment variable
144           TPM_PATH.
145
146           The TPM state files will be written with the given file mode bits.
147           This value must be given as an octal number starting with a '0'.
148           The default value is 0640.
149
150       --tpm2
151           Choose TPM 2 functionality; by default a TPM 1.2 is chosen.
152
153       --log [fd=<fd>|file=<path>][,level=<n>] [,prefix=<prefix>][,truncate]
154           Enable logging to a file given its file descriptor or its path. Use
155           '-' for path to suppress the logging.
156
157           The level parameter allows a user to choose the level of logging.
158           Starting at log level 5, libtpms debug logging is activated.
159
160           All logged lines will be prefixed with prefix. By default no prefix
161           is prepended.
162
163           If truncate is passed, the log file will be truncated.
164
165       --locality reject-locality-4[,allow-set-locality]
166           The reject-locality-4 parameter will cause TPM error messages to be
167           returned for requests to set the TPM into locality 4.
168
169           The allow-set-locality parameter allows the swtpm to receive
170           TPM/TPM2_SetLocality commands. This is parameter is useful if the
171           Linux VTPM proxy driver access is enabled by file descriptor
172           passing.  This option is implied by the --vtpm-proxy option and
173           therefore need not be explicitly set if this option is passed. In
174           all other cases care should be taken as to who can send the
175           TPM/TPM2_SetLocality command.
176
177       --key file=<keyfile>|fd=<fd>
178       [,format=<hex|binary>][,mode=aes-cbc|aes-256-cbc],
179       [remove[=true|false]]
180           Enable encryption of the state files of the TPM. The keyfile must
181           contain an AES key of supported size; 128 bit (16 bytes) and 256
182           bit (32 bytes) keys are supported.
183
184           The key may be in binary format, in which case the file size must
185           be 16 or 32 bytes. If the key is in hex format (default), the key
186           may consist of 32 or 64 hex digits starting with an optional '0x'.
187
188           The mode parameter indicates which block chaining mode is to be
189           used.  Currently aes-cbc (aes-128-cbc) and aes-256-cbc are
190           supported.  The encrypted data is integrity protected using
191           encrypt-then-mac.
192
193           The remove parameter will attempt to remove the given keyfile once
194           the key has been read.
195
196       --key pwdfile=<passphrase file>|pwdfd=<fd>
197       [,mode=aes-cbc|aes-256-cbc][remove[=true|false]][,kdf=sha512|pbkdf2]
198           This variant of the key parameter allows a user to provide a
199           passphrase in a file.  The file is read and a key is derived from
200           it using either a SHA512 hash or PBKDF2. By default PBKDF2 is used.
201
202       --migration-key file=<keyfile>|fd=<fd>
203       [,format=<hex|binary>][,mode=aes-cbc|aes-256-cbc]
204       [,remove[=true|false]]
205           The availability of a migration key ensures that the state of the
206           TPM will not be revealed in unencrypted form when the TPM state
207           blobs are retrieved through the ioctl interface.  The migration key
208           is not used for encrypting TPM state written to files, this is what
209           the --key parameter is used for.
210
211           The migration key and the key used for encrypting the TPM state
212           files may be the same.
213
214           While the key for the TPM state files needs to stay with those
215           files it encrypts, the migration key needs to stay with the TPM
216           state blobs. If for example the state of the TPM is migrated
217           between hosts in a data center, then the TPM migration key must be
218           available at all the destinations, so in effect it may have to be a
219           key shared across all machines in the datacenter. In contrast to
220           that, the key used for encrypting the TPM state files can be
221           different for each TPM and need only be available on the host where
222           the TPM state resides.
223
224           The migration key enables the encryption of the TPM state blobs.
225           The keyfile must contain an AES key of supported size; 128 bit (16
226           bytes) and 256 bit (32 bytes) keys are supported.
227
228           The key may be in binary format, in which case the file size must
229           be 16 or 32 bytes. If the key is in hex format (default), the key
230           may consist of 32 or 64 hex digits starting with an optional '0x'.
231
232           The mode parameter indicates which block chaining mode is to be
233           used.  Currently aes-cbc (aes-128-cbc) and aes-256-cbc are
234           supported.  The encrypted data is integrity protected using
235           encrypt-then-mac.
236
237           The remove parameter will attempt to remove the given keyfile once
238           the key has been read.
239
240       --migration-key pwdfile=<passphrase file>|pwdfd=<fd>
241       [,mode=aes-cbc|aes-256-cbc][,remove[=true|false]][,pdf=sha512|pbkdf2]
242           This variant of the key parameter allows a user to provide a
243           passphrase in a file.  The file is read and a key is derived from
244           it using either a SHA512 hash or PBKDF2. By default PBKDF2 is used.
245
246       --pid file=<pidfile>|fd=<filedescriptor>
247           This options allows a user to set the name of file where the
248           process ID (pid) of the TPM will be written into. It is also
249           possible to pass a file descriptor to a file that has been opened
250           for writing.
251
252       -r|--runas <owner>
253           Switch to the given user. This option can only be used when swtpm
254           is started as root.
255
256       --seccomp action=none|log|kill (since v0.2)
257           This option allows a user to select the action to take by the
258           seccomp profile when a syscall is executed that is not allowed. The
259           default is kill. To disable the seccomp profile, choose none. The
260           log action logs offending syscalls.  The log action is only
261           available if libseccomp supports logging.
262
263           This option is only available on Linux and only if swtpm was
264           compiled with libseccomp support.
265
266       --print-capabilities (since v0.2)
267           Print capabilities that were added to swtpm after version 0.1. The
268           output may contain the following:
269
270               {
271                 "type": "swtpm",
272                 "features": [
273                   "cmdarg-seccomp",
274                   "cmdarg-key-fd",
275                   "cmdarg-pwd-fd",
276                   "tpm-send-command-header",
277                   "flags-opt-startup",
278                   "rsa-keysize-1024",
279                   "rsa-keysize-2048",
280                   "rsa-keysize-3072"
281                 ]
282               }
283
284           The meaning of the feature verbs is as follows:
285
286           cmdarg-seccomp
287               The --seccomp option is supported.
288
289           cmdarg-key-fd
290               The --key option supports the fd= parameter.
291
292           cmdarg-pwd-fd
293               The --key option supports the pwdfd= parameter.
294
295           tpm-send-command-header
296               The TPM 2 commands may be prefixed by a header that carries a
297               4-byte command, 1 byte for locality, and 4-byte TPM 2 command
298               length indicator.  The TPM 2 will respond by preprending a
299               4-byte response indicator and a 4-byte trailer. All data is
300               sent in big endian format.
301
302           flags-opt-startup
303               The --flags option supports the startup-... options.
304
305           rsa-keysize-2048
306               The TPM 2 supports the shown RSA key sizes. If none of the rsa-
307               keysize verbs is shown then only RSA 2048 bit keys are
308               supported.
309
310       -h|--help
311           Display usage info.
312

SEE ALSO

314       swtpm_bios, swtpm_cuse
315
316
317
318swtpm                             2021-01-27                          swtpm(8)
Impressum