2019-12-13 18:12:18 +01:00
|
|
|
#
|
|
|
|
# spec file for package swtpm
|
|
|
|
#
|
2021-05-20 11:56:17 +02:00
|
|
|
# Copyright (c) 2021 SUSE LLC
|
2019-12-13 18:12:18 +01:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
2020-11-23 04:28:09 +01:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2019-12-13 18:12:18 +01:00
|
|
|
#
|
|
|
|
|
2020-11-23 04:28:09 +01:00
|
|
|
|
|
|
|
# Scripts in this package are python3
|
|
|
|
%define skip_python2 1
|
2021-08-09 10:47:13 +02:00
|
|
|
# SELinux
|
|
|
|
%define selinuxtype targeted
|
|
|
|
%define modulename1 swtpm
|
|
|
|
%define modulename2 swtpm_svirt
|
|
|
|
%define modulename3 swtpmcuse
|
2019-12-13 18:12:18 +01:00
|
|
|
Name: swtpm
|
2021-08-09 10:47:13 +02:00
|
|
|
Version: 0.6.0
|
2019-12-13 18:12:18 +01:00
|
|
|
Release: 0
|
|
|
|
Summary: Software TPM emulator
|
|
|
|
License: BSD-3-Clause
|
|
|
|
Group: System/Base
|
2020-11-23 04:28:09 +01:00
|
|
|
URL: https://github.com/stefanberger/swtpm
|
2021-08-09 10:47:13 +02:00
|
|
|
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
|
2021-08-16 15:22:06 +02:00
|
|
|
Source100: swtpm-rpmlintrc
|
2019-12-13 18:12:18 +01:00
|
|
|
BuildRequires: autoconf
|
|
|
|
BuildRequires: automake
|
|
|
|
BuildRequires: expect
|
|
|
|
BuildRequires: fuse-devel
|
|
|
|
BuildRequires: glib2-devel
|
|
|
|
BuildRequires: gnutls
|
2020-12-22 07:30:57 +01:00
|
|
|
BuildRequires: iproute2
|
2019-12-13 18:12:18 +01:00
|
|
|
BuildRequires: libgnutls-devel
|
|
|
|
BuildRequires: libopenssl-devel
|
|
|
|
BuildRequires: libseccomp-devel
|
|
|
|
BuildRequires: libtasn1-devel
|
2020-11-23 04:28:09 +01:00
|
|
|
BuildRequires: libtool
|
2019-12-13 18:12:18 +01:00
|
|
|
BuildRequires: libtpms-devel
|
2021-08-09 10:47:13 +02:00
|
|
|
BuildRequires: pkgconfig
|
2020-10-14 05:33:47 +02:00
|
|
|
BuildRequires: python3-cryptography
|
2021-08-09 10:47:13 +02:00
|
|
|
BuildRequires: selinux-policy-devel
|
|
|
|
BuildRequires: selinux-policy-targeted
|
2019-12-13 18:12:18 +01:00
|
|
|
BuildRequires: socat
|
2021-08-09 10:47:13 +02:00
|
|
|
BuildRequires: pkgconfig(json-glib-1.0)
|
|
|
|
BuildRequires: pkgconfig(systemd)
|
2020-12-22 07:30:57 +01:00
|
|
|
Requires: iproute2
|
2020-10-14 05:33:47 +02:00
|
|
|
Requires: python3-cryptography
|
2020-12-22 07:30:57 +01:00
|
|
|
Requires: trousers
|
2021-08-09 10:47:13 +02:00
|
|
|
Requires: (%{name}-selinux if selinux-policy-base)
|
|
|
|
Requires(pre): user(tss)
|
2019-12-13 18:12:18 +01:00
|
|
|
|
|
|
|
%description
|
|
|
|
The SWTPM package provides TPM emulators with different front-end interfaces
|
|
|
|
to libtpms. TPM emulators provide socket interfaces (TCP/IP) and the Linux
|
|
|
|
CUSE interface for the creation of multiple native /dev/vtpm* devices.
|
|
|
|
Those can be the targets of multiple QEMU cuse-tpm instances.
|
|
|
|
|
|
|
|
%package devel
|
|
|
|
Summary: Development files for swtpm
|
|
|
|
Group: Development/Libraries/C and C++
|
|
|
|
Requires: %{name} = %{version}
|
|
|
|
Requires: glib2-devel
|
|
|
|
Requires: libopenssl-devel
|
2020-07-13 03:21:22 +02:00
|
|
|
Requires: libseccomp-devel
|
2020-11-23 04:28:09 +01:00
|
|
|
Requires: libtpms-devel
|
2019-12-13 18:12:18 +01:00
|
|
|
|
|
|
|
%description devel
|
|
|
|
The development files for SWTPM
|
|
|
|
|
2021-08-09 10:47:13 +02:00
|
|
|
%package selinux
|
|
|
|
Summary: SELinux module for the Software TPM emulator
|
|
|
|
Group: System/Management
|
|
|
|
Requires: %{name} = %{version}
|
|
|
|
BuildArch: noarch
|
|
|
|
%{selinux_requires}
|
2019-12-13 18:12:18 +01:00
|
|
|
|
2021-08-09 10:47:13 +02:00
|
|
|
%description selinux
|
|
|
|
This package provides the SELinux module for the Software TPM emulator.
|
2020-11-23 04:28:09 +01:00
|
|
|
|
2021-08-09 10:47:13 +02:00
|
|
|
%prep
|
|
|
|
%autosetup
|
2020-11-23 04:28:09 +01:00
|
|
|
|
2021-08-09 10:47:13 +02:00
|
|
|
%build
|
|
|
|
mkdir m4
|
|
|
|
autoreconf -fiv
|
|
|
|
# configure looks for semodule on PATH
|
|
|
|
export PATH="$PATH:%{_sbindir}"
|
2020-08-05 04:32:01 +02:00
|
|
|
%configure --with-openssl --disable-static \
|
2021-08-09 10:47:13 +02:00
|
|
|
--with-tss-user=root --with-tss-group=tss \
|
|
|
|
--with-selinux
|
|
|
|
%make_build
|
2019-12-13 18:12:18 +01:00
|
|
|
|
|
|
|
%install
|
|
|
|
%make_install
|
2021-08-09 10:47:13 +02:00
|
|
|
find %{buildroot} -type f -name "*.la" -delete -print
|
|
|
|
mkdir %{buildroot}%{_datadir}/selinux/packages/targeted
|
|
|
|
mv %{buildroot}%{_datadir}/selinux/packages/*.pp %{buildroot}%{_datadir}/selinux/packages/targeted
|
2020-12-22 07:30:57 +01:00
|
|
|
mkdir -p %{buildroot}%{_localstatedir}/lib/swtpm-localca
|
2021-08-16 15:22:06 +02:00
|
|
|
sed -e 's|#!/usr/bin/env |#!/usr/bin/|g' -i %{buildroot}%{_datadir}/swtpm/swtpm-create-tpmca
|
|
|
|
sed -e 's|#!/usr/bin/env |#!/usr/bin/|g' -i %{buildroot}%{_datadir}/swtpm/swtpm-create-user-config-files
|
2020-12-22 07:30:57 +01:00
|
|
|
|
2020-12-22 09:05:26 +01:00
|
|
|
%post -p /sbin/ldconfig
|
2019-12-13 18:12:18 +01:00
|
|
|
%postun -p /sbin/ldconfig
|
|
|
|
|
2021-08-09 10:47:13 +02:00
|
|
|
%pre selinux
|
|
|
|
%selinux_relabel_pre -s %{selinuxtype}
|
|
|
|
|
|
|
|
%post selinux
|
|
|
|
%selinux_modules_install -s %{selinuxtype} -p 200 %{_datadir}/selinux/packages/targeted/%{modulename1}.pp
|
|
|
|
%selinux_modules_install -s %{selinuxtype} -p 200 %{_datadir}/selinux/packages/targeted/%{modulename2}.pp
|
|
|
|
%selinux_modules_install -s %{selinuxtype} -p 200 %{_datadir}/selinux/packages/targeted/%{modulename3}.pp
|
|
|
|
|
|
|
|
%postun selinux
|
|
|
|
if [ $1 -eq 0 ]; then
|
|
|
|
%selinux_modules_uninstall -s %{selinuxtype} -p 200 %{modulename1}
|
|
|
|
%selinux_modules_uninstall -s %{selinuxtype} -p 200 %{modulename2}
|
|
|
|
%selinux_modules_uninstall -s %{selinuxtype} -p 200 %{modulename3}
|
|
|
|
fi
|
|
|
|
|
|
|
|
%posttrans selinux
|
|
|
|
%selinux_relabel_post -s %{selinuxtype}
|
|
|
|
|
2019-12-13 18:12:18 +01:00
|
|
|
%files
|
2020-11-23 04:28:09 +01:00
|
|
|
%doc CHANGES README TODO
|
|
|
|
%license LICENSE
|
2019-12-13 18:12:18 +01:00
|
|
|
%{_bindir}/swtpm*
|
|
|
|
%config %{_sysconfdir}/swtpm*
|
2021-08-09 10:47:13 +02:00
|
|
|
%{_datadir}/swtpm
|
2019-12-13 18:12:18 +01:00
|
|
|
%dir %{_libdir}/swtpm
|
|
|
|
%{_libdir}/swtpm/*.so.*
|
2021-08-09 10:47:13 +02:00
|
|
|
%{_mandir}/man8/swtpm*%{?ext_man}
|
2020-12-22 07:30:57 +01:00
|
|
|
%dir %attr(0750,tss,root) %{_localstatedir}/lib/swtpm-localca
|
2019-12-13 18:12:18 +01:00
|
|
|
|
|
|
|
%files devel
|
|
|
|
%{_libdir}/swtpm/*.so
|
2021-08-09 10:47:13 +02:00
|
|
|
%{_includedir}/swtpm
|
|
|
|
%{_mandir}/man3/swtpm*%{?ext_man}
|
|
|
|
|
|
|
|
%files selinux
|
|
|
|
%{_datadir}/selinux/packages/targeted/*.pp
|
|
|
|
%ghost %verify(not md5 size mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename1}
|
|
|
|
%ghost %verify(not md5 size mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename2}
|
|
|
|
%ghost %verify(not md5 size mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename3}
|
2019-12-13 18:12:18 +01:00
|
|
|
|
|
|
|
%changelog
|