Commit Graph

34 Commits

Author SHA1 Message Date
Nick Chevsky
3d5ae5e1d6 Change swtpm-localca to swtpm_localca in manpages
- Move content of swtpm-localca(8) manual page to swtpm_localca(8)
  and make swtpm-localca(8) an alias for swtpm_localca(8), mirroring
  the fact that /usr/bin/swtpm_localca is the actual program and
  /usr/share/swtpm/swtpm-localca a wrapper for it.
- Change references to `swtpm-localca` in manual pages' content to
  `swtpm_localca`, reflecting the actual name of the program they are
  meant to document.

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
2021-07-27 20:05:41 -04:00
Nick Chevsky
ddc7521653 Move swtpm_localca sources from samples/ to src/
- Move swtpm_localca's sources out of samples/ (where they no longer
  belong now that swtpm_localca is a binary) to src/swtpm_localca/.
- Tests now call the swtpm_localca binary directly at the location
  where it was built, as they do with all other compiled programs.
- Simplify samples/swtpm-localca.in and delete swtpm-localca.2inst,
  removing the now-unnecessary logic to selectively call swtpm_localca
  from different locations (samples/ when running tests vs. /usr/bin/
  post-installation).

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
2021-07-25 08:52:13 -04:00
Nick Chevsky
edfb8d8ad9 Move swtpm_setup.conf.in from etc/ to samples/
- Makes swtpm_setup.conf.in consistent with the rest of the sample
  configuration files in swtpm, whose templates ship in samples/ and
  install the generated files to /etc.
- Works around dh_missing(1) erroneously reporting swtpm_setup.conf as
  non-installed due to its having two copies in the build tree (one in
  etc/ and another in debian/tmp/etc/).

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
2021-07-21 20:30:44 -04:00
Nick Chevsky
bc898369ee Remove swtpm.spec from .gitignore
Even though swtpm.spec is an auto-generated file, the author would
like to keep it in the repository for ease of installing dependencies
during development. As long as the file is meant to be versioned, it
should not be in .gitignore. Discussion for context:
https://github.com/stefanberger/swtpm/pull/496#issuecomment-884432135

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
2021-07-21 18:05:26 -04:00
Nick Chevsky
d08db4b4c9 Improvements to .gitignore
- Add auto-generated files debian/autoreconf.*
- Remove *.patch (Quilt requires these under debian/patches/)

Signed-off-by: Nick Chevsky <nchevsky@users.noreply.github.com>
2021-07-20 20:57:30 -04:00
Stefan Berger
50f7d49ad3 samples: Use different script for local testing than install
Use a different script for local testing that what is installed into
/usr/share/swtpm/swtpm-localca.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-07-17 09:28:54 -04:00
Stefan Berger
fd00c5ff87 samples: Replace swtpm_localca with script calling swtpm-localca (issue #482)
Replace the binary swtpm_localca with a script that now calls the binary
swtpm-localca, which is to be installed in $bindir.

So that we can use this for script for calling swtpm-localca during testing
(when it is not installed), write the script in such a way that it de-
termines whether there's swtpm-localca in the same directory and if not call
it from ${bindir}/swtpm-localca.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-07-16 16:03:14 -04:00
Andrea Bolognani
4608cc333a rpm: Move spec file and include it in dist archives
Having the spec file in the top-level directory of the dist
archive makes it possible to build rpms with a single,
convenient command.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2021-06-03 16:09:00 -04:00
Andrea Bolognani
a6db0e2696 gitignore: Ignore .gch files
Configure generates include/swtpm/tpm_ioctl.h.gch when trying
to figure out which hardening options can be enabled.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2021-06-03 16:09:00 -04:00
Stefan Berger
e689684c57 samples: Rewrite of swtpm_localca in 'C' (addresses issue #437)
This is a 1:1 rewrite of swtpm_localca in 'C' as a final step to get
rid of the python dependency. It addresses issue #437.

Tested on: Cygwin, Fedora 33, Ubuntu Xenial & Bionic, FreeBSD,
           DragonFlyBSD, OpenBSD (i386), Mac, Debian (recent), Centos-8,
           CentOS (recent), Alpine (recent), OpenSUSE (recent),
           Fedora 28 PPC Big Endian

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-01 09:31:43 -04:00
Stefan Berger
c125e34bf2 swtpm_setup: Rewrite in 'C' (addresses issue #437)
This is a 1:1 rewrite of swtpm_setup in 'C' as a first step to get
rid of the python dependency. It addresses issue #437.

Tested on: Cygwin, Fedora 33, Ubuntu Xenial & Bionic, FreeBSD,
           DragonFlyBSD, OpenBSD (i386), Mac, Debian (recent), Centos-8,
           CentOS (recent), Alpine (recent), OpenSUSE (recent)

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-05-28 13:08:16 -04:00
Stefan Berger
b71da43026 samples: Rewrite swtpm-localca in python
Rewrite swtpm-localca in python and get rid of the bash file and the flock
dependency.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-18 12:09:11 -04:00
Stefan Berger
3064a72ff0 swtpm_setup: Get rid of 'c' code and support changing user in python
Get rid of the 'c' code that only changed the user and add for support of
the --runas option to change to a different user in the python part.

To get 'make distcheck' to work I needed to name the swtpm_setup python
script with the suffix .in so that it gets copied to the build directory
as swtpm_setup. We need to change execute permissions on this file after
copying.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-09-09 09:53:05 -04:00
Stefan Berger
cc410ca91b swtpm_setup: Switch over to new python tool and get rid of the bash script
Switch over to the new python implementation of swtpm_setup. We need to
also adjust test cases that involved the tcsd that otherwise fail for
various reasons. For in-place testing we need to adjust the PYTHONPATH
and PATH so that swtpm_setup.py can be found and so that swtpm_setup.py
then finds swtpm if it is not explicitly passed as parameter.

Adjust the man page for swtpm_setup to reflect the changes.

We now can run swtpm_setup as any user. However, libvirt still runs it
as tss:tss (for example), which is then creating the signing key as tss:tss
as well. Ideally libvirt would run it as tss:root or any other combination
since the tss group may be used for user wanting to access /dev/tpmrm0 for
example. We at least change the directory ownership of /var/lib/swtpm-localca
to tss:root and keep the world out of this directory.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-28 16:27:15 -04:00
Stefan Berger
eee8cb5dfb swtpm_setup: Rewrite swtpm_setup.sh in python
Rewrite swtpm_setup.sh in python. Use a permanent connection from the
tool to swtpm via passing file descriptors of a unix socketpair. Implement
all functionality in python so that we don't rely on trousers and tpm-tools
for swtpm_setup. This now allows any user to setup a TPM 1.2 whereas before
it had to be root or the tss user.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-28 16:27:15 -04:00
Stefan Berger
68a1d5943b man: Remove generated man pages from repo and ignore created ones
Remove the generated man pages from the repo and add the file patterns
to .gitignore.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-20 09:49:33 -04:00
Stefan Berger
a12b09b1ea samples: Implement script to create user config files and extend man page
Implement a script that creates the user config files in the
${XDG_CONFIG_HOME} directory and sub-directories.

Extend swtpm_setup.pod showing swtpm-create-user-config-files usage.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-20 09:49:33 -04:00
Stefan Berger
217c29cb07 Revert "samples: Implement script to create user config files"
This reverts commit d09484c02d.
2020-08-20 09:49:33 -04:00
Stefan Berger
d09484c02d samples: Implement script to create user config files
Implement a script that creates the user config files in the
${XDG_CONFIG_HOME} directory and sub-directories.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-08-19 14:39:31 -04:00
Stefan Berger
e617652a57 gitignore: Ignore files related to gcov
Ignore files related to gcov.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-04-02 18:08:06 -04:00
Stefan Berger
44b92d43cd debian: Add post install script for swtpm-tools
Add a post install script for swtpm-tools that creates
the /var/lib/swtpm-localca directory and changes ownersip
on it.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-01-28 17:03:26 -05:00
Stefan Berger
0432b6535c build-sys: Fix hard coded /etc path and replace with @SYSCONFDIR@
When the project is configured with --prefix=/usr/local several configuration
files are installed to /usr/local/etc but not read by the programs that
need them. This patch fixes this issue by replacing @SYSCONFDIR@ in the source
code of those files with the actual used path.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-01-17 11:28:40 -05:00
Stefan Berger
0f05604869 build-sys: Create compressed policy package files
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-24 17:48:41 -04:00
Stefan Berger
f98592c590 git: Ignore install-sh
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 12:52:05 -04:00
Marc-André Lureau
f52f56a5b9 git: remove install-sh from repository
It is installed and updated by autofoo.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-08-07 12:19:47 -04:00
Stefan Berger
6fcd12236a selinux: replace swtpmcuse_svirt with swtpm_svirt
Replace the previously used swtpmcuse_svirt type of policy with
swtpm_svirt. This policy contains the minimum set of rules necessary
to start swtpm from within libvirt.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2018-04-09 12:08:46 -04:00
Stefan Berger
0d00e18f87 selinux: update policy for swtpm to support libvirt integration
Update the SELinux for swtpm so that swtpm can be launched from
libvirtd and QEMU can access swtpm's UnixIO socket and talk to it.

Use this as follows:

> cd src/selinux
> make clean all
> semodule -i *.pp
> restorecon /usr/bin/swtpm*

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-04 12:37:18 -04:00
Stefan Berger
dcbb1181fb build: Enable building of Debian package
Add debian build files to enable building of Debian package using for exampl

debuild -b   or   dpkg-buildpackage -us -uc

Extend the .gitignore.

The debhelper checks show warnings and errors that will need to be addressed
some other time. For some I don't know how to solve them at the moment.

Signed-off-by: Stefan Berger <stefanb@linux.watson.ibm.com>
2016-01-12 19:56:00 -05:00
Stefan Berger
a1fa5d77e2 swtpm: add version info to all programs
Move src/swtpm/swtpm.h.in to include/swtpm.h.in to make it commonly
available. Adapt all other programs to use it and display version information
in the help screen.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-12-03 19:31:10 -05:00
Stefan Berger
6e7df39f22 build: remove hardcoded tss user and group
Adding forgotten file.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-03 10:13:46 -05:00
Stefan Berger
c4ac0a11e9 build: remove hardcoded tss user and group
Remove the hardcodes tss user and group and to configure with
--with-tss-user=tss --with-tss-group=tss to set the tss user
and group to be used.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-02 20:47:37 -05:00
Stefan Berger
1201a5e0d7 Ignore directories related to quilt. 2014-12-08 12:53:47 -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