swtpm: upgrade to 0.10.2 and backport sysusers/tmpfiles support
cover swtpm: upgrade to 0.10.2 and backport sysusers/tmpfiles support
Hi,
This series updates swtpm from 0.10.0 to 0.10.2 and backports the upstream sysusers.d and tmpfiles.d integration.
The sysusers/tmpfiles changes provide declarative provisioning of the tss user and /var/lib/swtpm-localca. The follow-up upstream change is also included to keep the tss sysusers definition consistent with tpm2-tss and avoid conflicting definitions.
Patch 1 updates the recipe to swtpm 0.10.2.
Patch 2 backports the two upstream swtpm changes and packages the generated sysusers.d and tmpfiles.d configuration.
The separate swtpm SELinux policy-build issue is not addressed by this series and is being investigated separately.
Regards,
Niranjan Reddy Mekala
Niranjan Reddy Mekala (2):
swtpm: upgrade 0.10.0 -> 0.10.2
swtpm: backport sysusers and tmpfiles support
...ll-sysusers.d-and-tmpfiles.d-configs.patch | 86 +++++++++++++++++++
...2-swtpm-sync-sysuser.d-with-tpm2-tss.patch | 29 +++++++
.../{swtpm_0.10.0.bb => swtpm_0.10.2.bb} | 11 ++-
3 files changed, 124 insertions(+), 2 deletions(-)
create mode 100644 meta-tpm/recipes-tpm/swtpm/swtpm/0001-swtpm-install-sysusers.d-and-tmpfiles.d-configs.patch
create mode 100644 meta-tpm/recipes-tpm/swtpm/swtpm/0002-swtpm-sync-sysuser.d-with-tpm2-tss.patch
rename meta-tpm/recipes-tpm/swtpm/{swtpm_0.10.0.bb => swtpm_0.10.2.bb} (84%)Signature · 1 line
2.43.0
PATCH 1/2 swtpm: upgrade 0.10.0 -> 0.10.2
Upgrade swtpm to the 0.10.2 release.
---
meta-tpm/recipes-tpm/swtpm/{swtpm_0.10.0.bb => swtpm_0.10.2.bb} | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename meta-tpm/recipes-tpm/swtpm/{swtpm_0.10.0.bb => swtpm_0.10.2.bb} (97%)meta-tpm/recipes-tpm/swtpm/swtpm_0.10.2.bb renamed from meta-tpm/recipes-tpm/swtpm/swtpm_0.10.0.bb +1 -1
@@ -7,7 +7,7 @@ SECTION = "apps" # expect-native, socat-native, coreutils-native and net-tools-native are reportedly only required for the tests DEPENDS = "libtasn1 coreutils-native expect-native socat-native glib-2.0 net-tools-native libtpms json-glib" -SRCREV = "54f4bb1e702a8b80d990ca00b6f72d5031dd131a" +SRCREV = "32b5a0575991a73398de9749d63cafd847008af2" SRC_URI = "git://github.com/stefanberger/swtpm.git;branch=stable-0.10;protocol=https" PE = "2"
Signature · 1 line
2.43.0
PATCH 2/2 swtpm: backport sysusers and tmpfiles support
In reply to Niranjan Reddy MekalaBackport the upstream sysusers.d and tmpfiles.d integration to provision the tss user and /var/lib/swtpm-localca declaratively.
Also backport the follow-up change that aligns the tss sysusers definition with tpm2-tss to avoid conflicting definitions.
Package the generated sysusers.d and tmpfiles.d configuration files.
--- ...ll-sysusers.d-and-tmpfiles.d-configs.patch | 86 +++++++++++++++++++ ...2-swtpm-sync-sysuser.d-with-tpm2-tss.patch | 29 +++++++ meta-tpm/recipes-tpm/swtpm/swtpm_0.10.2.bb | 9 +- 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 meta-tpm/recipes-tpm/swtpm/swtpm/0001-swtpm-install-sysusers.d-and-tmpfiles.d-configs.patch create mode 100644 meta-tpm/recipes-tpm/swtpm/swtpm/0002-swtpm-sync-sysuser.d-with-tpm2-tss.patch
meta-tpm/recipes-tpm/swtpm/swtpm/0001-swtpm-install-sysusers.d-and-tmpfiles.d-configs.patch new file +86 -0
@@ -0,0 +1,86 @@ +From d318d40469474eb8f3ccc4a6e9fe0ba100814e20 Mon Sep 17 00:00:00 2001 +From: Luca Boccassi <[email protected]> +Date: Mon, 22 Sep 2025 17:56:24 +0100 +Subject: [PATCH] swtpm: install sysusers.d and tmpfiles.d configs + +These configuration files will create the required user, group and +data directory on first boot/factory reset/package installation, +without requiring manual scripts or actions. This is very important +for image-based OSes, but it is useful in other cases to, to allow +using declarative configuration instead of scripts. + +RPM now has built-in support for sysusers.d too. + +https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html +https://www.freedesktop.org/software/systemd/man/latest/sysusers.d.html + +Signed-off-by: Luca Boccassi <[email protected]> +Upstream-Status: Backport [https://github.com/stefanberger/swtpm/commit/d318d40469474eb8f3ccc4a6e9fe0ba100814e20] +--- + .gitignore | 2 ++ + configure.ac | 2 ++ + src/Makefile.am | 10 ++++++++++ + src/swtpm-sysusers.conf.in | 1 + + src/swtpm-tmpfiles.conf.in | 1 + + 5 files changed, 16 insertions(+) + create mode 100644 src/swtpm-sysusers.conf.in + create mode 100644 src/swtpm-tmpfiles.conf.in + +diff --git a/.gitignore b/.gitignore +index 579d0be..012ef88 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -63,6 +63,8 @@ Makefile + /src/swtpm_ioctl/swtpm_ioctl + /src/swtpm_localca/swtpm_localca + /src/swtpm_setup/swtpm_setup ++/src/swtpm-sysusers.conf ++/src/swtpm-tmpfiles.conf + /src/utils/swtpm_conf.h + /test-driver + tests/*.log +diff --git a/configure.ac b/configure.ac +index afcd18a..4eab9f4 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -502,6 +502,8 @@ AC_CONFIG_FILES([Makefile \ + src/swtpm_ioctl/Makefile \ + src/swtpm_localca/Makefile \ + src/swtpm_setup/Makefile \ ++ src/swtpm-sysusers.conf \ ++ src/swtpm-tmpfiles.conf \ + src/utils/Makefile \ + src/utils/swtpm_conf.h \ + man/Makefile \ +diff --git a/src/Makefile.am b/src/Makefile.am +index 9e03c78..c36d5cc 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -17,3 +17,13 @@ if WITH_SELINUX + SUBDIRS += \ + selinux + endif ++ ++sysusersdir = $(prefix)/lib/sysusers.d ++sysusers_DATA = swtpm-sysusers.conf ++ ++tmpfilesdir = $(prefix)/lib/tmpfiles.d ++tmpfiles_DATA = swtpm-tmpfiles.conf ++ ++EXTRA_DIST = \ ++ swtpm-sysusers.conf \ ++ swtpm-tmpfiles.conf +diff --git a/src/swtpm-sysusers.conf.in b/src/swtpm-sysusers.conf.in +new file mode 100644 +index 0000000..0b02ca4 +--- /dev/null ++++ b/src/swtpm-sysusers.conf.in +@@ -0,0 +1 @@ ++u! @TSS_USER@ - "TPM software stack" @LOCALSTATEDIR@/lib/swtpm-localca +diff --git a/src/swtpm-tmpfiles.conf.in b/src/swtpm-tmpfiles.conf.in +new file mode 100644 +index 0000000..afe2d13 +--- /dev/null ++++ b/src/swtpm-tmpfiles.conf.in +@@ -0,0 +1 @@ ++d @LOCALSTATEDIR@/lib/swtpm-localca 0750 @TSS_USER@ root
meta-tpm/recipes-tpm/swtpm/swtpm/0002-swtpm-sync-sysuser.d-with-tpm2-tss.patch new file +29 -0
@@ -0,0 +1,29 @@ +From b64b114c9c6941d9729fcc2ad511f108a3affaef Mon Sep 17 00:00:00 2001 +From: Luca Boccassi <[email protected]> +Date: Wed, 7 Oct 2026 08:29:09 +0200 +Subject: [PATCH] swtpm: sync sysuser.d with tpm2-tss + +tpm2-tss has shipped a sysusers.d file since 2019 for the tss user: + +https://github.com/tpm2-software/tpm2-tss/commit/c43f3c2190eb06e731c5bf7c2849d07f5f8503a5 + +When two sysusers.d configs have a conflict, the tool raises a warning, +and the result depends on alphabetic sorting of the config names which +isn't great. Sync the content: drop the '!', drop the homedir (not used +anyway) and modify the GECOS string. + +Fixes: d318d4046947 ("swtpm: install sysusers.d and tmpfiles.d configs") + +Signed-off-by: Luca Boccassi <[email protected]> +Upstream-Status: Backport [https://github.com/stefanberger/swtpm/commit/b64b114c9c6941d9729fcc2ad511f108a3affaef] +--- + src/swtpm-sysusers.conf.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/swtpm-sysusers.conf.in b/src/swtpm-sysusers.conf.in +index 0b02ca4..a9a1779 100644 +--- a/src/swtpm-sysusers.conf.in ++++ b/src/swtpm-sysusers.conf.in +@@ -1 +1 @@ +-u! @TSS_USER@ - "TPM software stack" @LOCALSTATEDIR@/lib/swtpm-localca ++u @TSS_USER@ - "tss user for tpm2"
meta-tpm/recipes-tpm/swtpm/swtpm_0.10.2.bb +8 -1
@@ -8,7 +8,10 @@ SECTION = "apps" DEPENDS = "libtasn1 coreutils-native expect-native socat-native glib-2.0 net-tools-native libtpms json-glib" SRCREV = "32b5a0575991a73398de9749d63cafd847008af2" -SRC_URI = "git://github.com/stefanberger/swtpm.git;branch=stable-0.10;protocol=https" +SRC_URI = "git://github.com/stefanberger/swtpm.git;branch=stable-0.10;protocol=https \ + file://0001-swtpm-install-sysusers.d-and-tmpfiles.d-configs.patch \ + file://0002-swtpm-sync-sysuser.d-with-tpm2-tss.patch \ + " PE = "2" PARALLEL_MAKE = ""
@@ -40,6 +43,10 @@ USERADD_PARAM:${PN} = "--system -g ${TSS_GROUP} --home-dir / \ PACKAGE_BEFORE_PN = "${PN}-cuse" FILES:${PN}-cuse = "${bindir}/swtpm_cuse" +FILES:${PN} += " \ + ${libdir}/sysusers.d/swtpm-sysusers.conf \ + ${libdir}/tmpfiles.d/swtpm-tmpfiles.conf \ +" INSANE_SKIP:${PN} += "dev-so"
Signature · 1 line
2.43.0