aboutgitcodebugslistschat
path: root/contrib/fedora
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/fedora')
-rw-r--r--contrib/fedora/passt.spec42
1 files changed, 27 insertions, 15 deletions
diff --git a/contrib/fedora/passt.spec b/contrib/fedora/passt.spec
index 745cf01..663289f 100644
--- a/contrib/fedora/passt.spec
+++ b/contrib/fedora/passt.spec
@@ -9,6 +9,7 @@
%global git_hash {{{ git_head }}}
%global selinuxtype targeted
+%global selinux_policy_version 41.41
Name: passt
Version: {{{ git_version }}}
@@ -33,15 +34,19 @@ for network namespaces: traffic is forwarded using a tap interface inside the
namespace, without the need to create further interfaces on the host, hence not
requiring any capabilities or privileges.
-%package selinux
-BuildArch: noarch
-Summary: SELinux support for passt and pasta
-Requires: %{name} = %{version}-%{release}
-Requires: selinux-policy
-Requires(post): %{name}
-Requires(post): policycoreutils
-Requires(preun): %{name}
-Requires(preun): policycoreutils
+%package selinux
+BuildArch: noarch
+Summary: SELinux support for passt and pasta
+Requires: selinux-policy-%{selinuxtype}
+Requires: container-selinux
+Requires(post): selinux-policy-%{selinuxtype}
+Requires(post): container-selinux
+Requires(post): policycoreutils
+Requires(post): libselinux-utils
+Requires(preun): policycoreutils
+BuildRequires: selinux-policy-devel
+BuildRequires: pkgconfig(systemd)
+Recommends: selinux-policy-%{selinuxtype} >= %{selinux_policy_version}
%description selinux
This package adds SELinux enforcement to passt(1), pasta(1), passt-repair(1).
@@ -89,19 +94,26 @@ popd
%selinux_relabel_pre -s %{selinuxtype}
%post selinux
-%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/passt.pp
-%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/pasta.pp
-%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/passt-repair.pp
+%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/passt.pp %{_datadir}/selinux/packages/%{selinuxtype}/pasta.pp %{_datadir}/selinux/packages/%{selinuxtype}/passt-repair.pp
%postun selinux
if [ $1 -eq 0 ]; then
- %selinux_modules_uninstall -s %{selinuxtype} passt
- %selinux_modules_uninstall -s %{selinuxtype} pasta
- %selinux_modules_uninstall -s %{selinuxtype} passt-repair
+ %selinux_modules_uninstall -s %{selinuxtype} passt pasta passt-repair
fi
%posttrans selinux
%selinux_relabel_post -s %{selinuxtype}
+# %selinux_relabel_post calls fixfiles(8) with the previous file_contexts file
+# (see selabel_file(5)) in order to restore only the file contexts which
+# actually changed. However, as file_contexts doesn't support %{USERID}
+# substitutions, this will not work for specific file contexts that pasta needs
+# to have under /run/user.
+#
+# Restore those explicitly, hiding errors from restorecon(8): we can't pass a
+# path that's more specific than this, but at the same time /run/user often
+# contains FUSE mountpoints that can't be accessed as root, leading to
+# "Permission denied" messages, but not failures.
+restorecon -R /run/user 2>/dev/null
%files
%license LICENSES/{GPL-2.0-or-later.txt,BSD-3-Clause.txt}