backport: run setfiles (selinux) after chroot

This commit is contained in:
Mikhail Novosyolov 2019-08-23 22:02:23 +03:00
parent 4169113662
commit 188d61a93d
2 changed files with 34 additions and 1 deletions

View file

@ -0,0 +1,32 @@
From 2ccd4160ebcbfa0bd8262901dfc3b90b815c8376 Mon Sep 17 00:00:00 2001
From: notok <noto.kazufumi@gmail.com>
Date: Sat, 8 Dec 2018 14:21:54 +0900
Subject: [PATCH] Run setfiles after chroot
SELinux context is not properly set because setfiles command is not run after chroot.
Fixes #106
Backport of upstream commit c6dd265af7ccb3c51c37dcd89839f178832518ea to v21.1
Fixes https://bugs.centos.org/view.php?id=15589 and https://github.com/livecd-tools/livecd-tools/issues/106
Signed-off-by: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
---
imgcreate/kickstart.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py
index 2273cd5..bf2211f 100644
--- a/imgcreate/kickstart.py
+++ b/imgcreate/kickstart.py
@@ -445,7 +445,7 @@ class SelinuxConfig(KickstartConfig):
if not os.path.exists(self.path("/sbin/setfiles")):
return
- self.call(["/sbin/setfiles", "-p", "-e", "/proc", "-e", "/sys", "-e", "/dev", selinux.selinux_file_context_path(), "/"])
+ subprocess.call(["/sbin/setfiles", "-p", "-e", "/proc", "-e", "/sys", "-e", "/dev", selinux.selinux_file_context_path(), "/"], preexec_fn=self.chroot)
def apply(self, ksselinux):
selinux_config = "/etc/selinux/config"
--
2.17.1

View file

@ -3,7 +3,7 @@
Summary: Tools for building live CDs
Name: livecd-tools
Version: 21.1
Release: 56
Release: 58
Epoch: 1
License: GPLv2+
Group: System/Base
@ -33,6 +33,7 @@ Patch19: livecd-tools-21.1.support.efi32.patch
Patch21: livecd-tools-21.1.use.add_drivers.patch
Patch22: livecd-tools-21.1.no.vga.opts.patch
Patch23: livecd-tools-21.1-genisoimage.patch
Patch24: 0001-Run-setfiles-after-chroot.patch
Requires: python-imgcreate = %{EVRD}
Requires: dosfstools