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
45       [type=tcp][,port=<port>[,bindaddr=<address>[,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 addresss if provided, the name of the interface
52           to 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
59       type=unixio[,path=<path>][,fd=<fd>][,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 to set the file mode bits of the UnixIO path. The
63           mode bits value must be given as an octal number starting with a
64           '0'.  The default value is 0770. uid and gid set the ownership of
65           the UnixIO socket's path.  This operation requires root privileges.
66

Options for character device interface

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

Options for the CUSE interface

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

Options for socket and character device interfaces:

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

Options for all interfaces

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

SEE ALSO

300       swtpm_bios, swtpm_cuse
301
302
303
304swtpm                             2020-02-08                          swtpm(8)
Impressum