Commit Graph

157 Commits

Author SHA1 Message Date
Stefan Berger
0dda8245d2 swtpm_ioctl: implement --info option to get implementation info
Implement the --info option that takes a flag as an argument
and returns information about the TPM implementation. Only the
value '1' has been defined for now, which returns a line as
the following:

{"TPMSpecification":{"family":"1.2","level":2,"revision":116}}

Extend the man page.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-23 10:01:07 -04:00
Stefan Berger
ab37e6f383 samples: implement options for pass TPM spec parameters
Implement options --tpm-spec-family, --tpm-spec-revision, and
tpm-spec-level to pass to swtpm_cert for EK creation.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-23 10:00:47 -04:00
Stefan Berger
026a2efe66 man: add an example to swtpm_setup man page
Add an example for how to run swtpm_setup to simulate TPM 1.2
manufacturing.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-18 14:53:55 -04:00
Stefan Berger
373a90840c samples: Create a root CA that signs the cert used for creating TPM certs
We are currently missing the Authority Key Id in the certificate used for
creating the EK cert. To get this, we create a root CA for our local CA
and use that root CA to sign the local CA's certificate. Our local
CA is now an intermediate CA and the Authority Key Id can now be copied
into the EK cert.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-17 10:52:35 -04:00
Stefan Berger
640f1fab05 swtpm: Implement mode parameter for --tpmstate option
Implement a mode parameter for the tpmstate option so that the user
can choose what the file mode bits of the TPM's state files will be.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-10 14:30:14 -04:00
Stefan Berger
db60877590 swtpm: Allow file desciptor passing for pid file
Allow the passing of a file descriptor where the PID file will
be written into.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-05 10:43:25 -04:00
Stefan Berger
f34e01a5a9 swtpm: Add 'uid' and 'gid' parameter to set UnxiIO file ownership
Implement support for uid and gid parameters that allows us to set the file
ownership of a UnixIO socket.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-03 07:48:25 -04:00
Stefan Berger
682fe58172 swtpm: Add 'mode' parameter to allow setting UnixIO path file mode bits
Implement support for a mode parameter that allows us to set the file
mode bits on a UnixIO socket.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-03 07:30:56 -04:00
Stefan Berger
a8bc74fd01 swtpm_setup: Only pass through vmid parameter if it was set
Only pass through the vmid parameter to the tool creating the cert
if this parameter was set. The tool creating the cert may require
it or ignore it and is supposed to be able to track certificates
for which it minted certs using this parameter.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-12-20 20:18:54 -05:00
Stefan Berger
3760c34251 swtpm: Add truncate parameter for --log option
Enable the resetting of the log using a truncate parameter for the
--log option.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-11-11 14:47:27 -05:00
Stefan Berger
eff9cc1672 swtpm_setup: Add options to overwrite or not overwrite TPM state
Add options --overwrite and --not-overwrite to allow or prevent
overwriting of existing TPM state. If neiter of the options is
given and existing state is found, an error is returned.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-11-09 10:54:07 -05:00
Stefan Berger
688c8e2400 swtpm: Implemented support for PTM_SET_BUFFERSIZE command
Implement a command for setting and querying the buffer size the
TPM implementation (libtpms) is using. The setting of the
buffersize allows to reduce the size of the buffer to a size
that the interface can support so that these two sizes match
and the TPM will not produce larger responses than what the
interface can support.

Extend swtpm_ioctl with an option to set the buffersize.

Adapt the existing tests to reflect the newly supported command.
Implement a new test for getting/setting of the buffer size.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-11-05 14:53:00 -05:00
Stefan Berger
66250d635a man: Update description in man page to reflect ctrl channel commands
Update the description in the man page to reflect ioctl's and
control channel commands.

Update to the latest supported commands.

Fix a few text locations on the way.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-10-05 09:47:15 -04:00
Stefan Berger
63ab6c3c21 Introduce '--flag not-need-init' for socket and chardev
Change the startup behavior with respect to requiring an INIT command
via control channel. We change this for the socket and chardev
interfaces so that the behavior now is the same as that of the CUSE
interface.

Introduce the --flag not-need-init command line option for the socket
and chardev interfaces to allow the old behavior using this option.

Adapt some of the test cases and swtpm_setup.sh.in that now need this
command line flag.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-07-11 14:04:40 -04:00
Stefan Berger
cf618c3d10 swtpm_setup: Allow running swtpm_setup as tss directly
Allow running swtpm_setup directly as tss user using the following
command lines as an example for how to do it:

mkdir /tmp/test-tss
chown tss:tss /tmp/test-tss
chmod 770 /tmp/test-tss
su -c "swtpm_setup --tpm-state /tmp/test-tss" -s /bin/sh tss

This change prevents us from requiring invocation under the root
user.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-07-11 14:04:19 -04:00
Stefan Berger
84259c17df swtpm: Enable --migration-key for socket and chardev interfaces
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-06-15 19:11:33 -04:00
Stefan Berger
a2f81ea2c6 Implement support for --locality allow-set-locality option
Implement support for --locality allow-set-locality option that
is primarily useful in cases when the VTPM proxy access is enabled
by file descriptor passing.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-06-06 14:10:01 -04:00
Stefan Berger
4a56541491 Add options for locality handling and SetLocality command
Add options for locality handling so that commands in locality
4 for example are rejected per command line parameter. This is
useful when the vTPM is used with containers.

Also implement the custom TPM/TPM2_SetLocality command to allow
the Linux vTPM proxy driver to set the locality in which subsequent
TPM commands will be executed.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-06-01 16:59:20 -04:00
Stefan Berger
93f4a38940 swtpm: add logging option prefix=<prefix>
Add support for logging each line of output with a prefix.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-03-31 08:55:08 -04:00
Amarnath Valluri
93edca48a2 swtpm: Added support for passing control channel client fd.
New option '--ctrl clientfd=<fd>' is added to the control socket parameters.
The passed 'fd' is used as control channel client-fd and treated as single
client mode.

Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
2017-03-31 08:15:51 -04:00
Stefan Berger
65d8e4d834 man pages: make log level bold
Fix the log level parameter to appear in bold.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-02-02 17:53:17 -05:00
Stefan Berger
c7c657ec3d swtpm_cuse: Add log level parameter to help screen and man page
Add the log level parameter to the CUSE TPM's help screen and man
page.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-02-02 17:52:30 -05:00
Stefan Berger
e8b5115f1a swtpm: Expose logging level to command line
Expose the logging level to the command line by extending the
log option with a level parameter.
Extend the man swtpm man page with the level parameter.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-23 19:09:50 -05:00
Stefan Berger
ee8b6c2d65 Implement option --vtpm-proxy to create Linux vtpm proxy device
Implement the option --vtpm-proxy that create a Linux vtpm proxy device
and makes the chardev TPM listen on the anaonymous file descriptor that
is returned from the ioctl creating the device.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2017-01-13 21:45:04 -05:00
Stefan Berger
3aa53709a1 swtpm_setup: support --tpmstate as alias for --tpm-state
Support --tpm-state option as an alias for the --tpmstate option.
--tpm-state is a parameter that is also supported by the swtpm
program, so for consistency reasons we should have the same name
for the option here.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-06-26 20:26:53 -04:00
Stefan Berger
01eb4d3a3b swtpm_ioctl: Add support for UnixIO and TCP control channel
Add support for UnixIO and TCP control channels. Both types of
transport require that packets are sent in big endian format
and therefore some code needs to be adjusted for that. The
ioctl interface is local and in that case no endianess conversion
is done.

Add a new test case that uses the extended swtpm_ioctl tool to
test the control channel.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-20 16:58:48 -04:00
Stefan Berger
37dcf15b86 swtpm_ioctl: add --tpm-device command line option
Add support for providing the TPM device via command line option
--tpm-device <device>.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-20 10:46:10 -04:00
Stefan Berger
fc4e289617 swtpm_bios: Add support for UnixIO socket
Add support for UnixIO socker using --unixio command line
option.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-18 17:21:20 -04:00
Stefan Berger
7382352955 swtpm: Add support for commands over UnixIO socket
Add support for receiving TPM commands over UnixIO socket.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-18 17:15:08 -04:00
Stefan Berger
04b607b346 swtpm_bios: add --tpm-device command line option
Add support for providing the TPM device via command line option
--tpm-device <device>.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-04-15 21:51:18 -04:00
Stefan Berger
4716d35a69 swtpm: Rename --connect to --server
Rename the --connect option to --server.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-20 14:50:40 -04:00
Stefan Berger
16eb0ff25a swtpm: Extend TCP server parameters with bind address
Extend TCP server parameters with an IPv4/IPv6 bind address
parameter.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-20 14:49:36 -04:00
Stefan Berger
9ddc699812 swtpm: Add the control channel to the socket interface TPM
Add the control channel to the socket interface TPM as well.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-18 16:51:19 -04:00
Stefan Berger
7c0a033f96 swtpm: add --connect option support
Add support for --connect option for the socket version of the TPM.
This parameter takes the type, port, file descriptor and disconnect
options. Only TCP connections are currently supported.

See updated man pages.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-03-18 13:36:40 -04:00
Stefan Berger
81c55814dd swtpm_bios: Exit with error if TPM needs to be reset for activation
Exit with error code 129 if the TPM needs to be reset to become activated.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-02-18 09:55:23 -05:00
Stefan Berger
bb420d7481 swtpm: move process owership to common file and enable in all implementations
Move the code to change process ownership into its own function and enable
--runas|-r <owner> in all implementations.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-27 18:17:49 -05:00
Stefan Berger
78c5f924bf swtpm: add cuse TPM interface option to swtpm
Now that the CUSE TPM part is BSD licensed, extend the swtpm
program with the cuse option.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-20 20:06:57 -05:00
Stefan Berger
ffcb6535d3 swtpm_bios: Add option to give up physical presence
Extend the swtpm_bios tool with an option to give up physical presence.

Have the TPM error codes reflected in the exit error of 128.

Add a test case for the tool.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-04 18:23:13 -05:00
Stefan Berger
6852f6c89b swtpm: introduce control channel for chardev TPM
Implement a control channel for the 'chardev' swtpm that implements
a minimal set of control messages for now.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-27 22:13:37 -05:00
Stefan Berger
29cfd0a4fd swtpm: add support for listening on chardev
Add support for 'swtpm chardev' that listens for TPM commands on a given
character device and sends responses through it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-08 14:13:23 -05:00
Stefan Berger
bc525ccdab swtpm: Add support for --tpmstate dir=<dir> command line parameter
Add support for the --tpmstate dir=<dir> command line parameter.
It will be used instead of the TPM_PATH, unless it is not set.

Adapt two test cases for the new parameter.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-10-27 21:58:10 -04:00
Stefan Berger
b215173767 swtpm: Add command line parameter for pidfile
Add support for --pid file=<pidfile> command line parameter support.
The swtpm_cuse and swtpm now write their process IDs (pids) into
a file.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-10-26 06:34:14 -04:00
Stefan Berger
39d0c3ded0 man pages: Add man page describing the ioctl's
This patch adds a man page that describes the supported ioctl's.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-10-03 18:42:31 -04:00
Stefan Berger
cf476b14d2 man pages: update on swtpm_ioctl.8
Update swtpm_ioctl.8 to latest content.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-07-02 10:59:01 -04:00
Stefan Berger
5007f2d06f man pages: clarification for swtpm_setup
swtpm_setup uses swtpm executable it finds in the path.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-07-02 10:55:27 -04:00
Stefan Berger
6c2ef667c7 man pages: check in generated man pages
Check in generated man pages that had been missing.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-06-05 16:30:12 -04:00
Stefan Berger
05cd79b843 Support read()/write() for TPM state blob transfer
Support the read/write interface and POSIX API calls for transfer of
TPM state blobs.

Extend the swtpm_ioctl program to support this as well. Use the
environment variable SWTPM_IOCTL_BUFFERSIZE to set the size of the
buffer to use and enable the read/write interface in this (test)
program.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-06-04 18:49:25 -04:00
Stefan Berger
bd98690a4a Add ioctl to get configuration flags about keys in use
Add an ioctl that lets an application retrieve which keys are in use by the
TPM, i.e., file encryption or migration key

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-26 07:30:38 -04:00
Stefan Berger
1680c41d9e swtpm: Add a command line option for a migration key
The migration key ensures that TPM state blobs, when retrieved using the
ioctl for getting state blobs, are always encrypted with this key.
When the state is later on loaded back into the TPM using the ioctl
to set the state blobs, the migration key is used to decrypt them.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-25 11:18:44 -04:00
root
070d313cb3 samples: rename swtpm-localca.sh to swtpm-localca
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-04 00:26:14 -04:00
Stefan Berger
950040f03c swtpm_cuse: implement STOP ioctl
Implement a STOP ioctl in the swtpm and swtpm_ioctl client.
Modify test cases to used swtpm_ioctl --stop.
2015-03-16 11:50:03 -04:00
Stefan Berger
0c0e5b20c6 Update man page with description for new commands
Update the man page of swtpm_ioctl with the new commands for
getting stateblobs from the CUSE TPM and setting stateblobs in
the CUSE TPM.
2015-03-12 09:49:40 -04:00
Stefan Berger
3f7933fc3a fix typo in man page 2014-12-08 12:53:13 -05:00
Stefan Berger
0321a3808d Add ioctl to reset the establishment bit
Add an ioctl to reset the establishment bit. It takes as an
argument the locality to use.
2014-12-08 11:35:16 -05:00
Stefan Berger
05503a8ea0 fixing typo in man page 2014-12-05 15:14:09 -05:00
Stefan Berger
e46a2b6686 merging swtpm-tools into this project 2014-12-05 13:43:21 -05:00
Stefan Berger
f163b20210 initial check-in 2014-12-05 11:16:03 -05:00