From 017d35aad4680ccf5efd61a3fd97023578486a71 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Thu, 6 Dec 2012 14:40:23 -0500 Subject: [PATCH] policycoreutils: gui: system-config-selinux: do not use lokkit We should be able to make changed to /etc/selinux/config without using lokkit Signed-off-by: Eric Paris Acked-by: Dan Walsh --- policycoreutils/gui/statusPage.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/policycoreutils/gui/statusPage.py b/policycoreutils/gui/statusPage.py index e561de1a..20696351 100644 --- a/policycoreutils/gui/statusPage.py +++ b/policycoreutils/gui/statusPage.py @@ -158,8 +158,22 @@ class statusPage: self.enabled = enabled def write_selinux_config(self, enforcing, type): - import commands - commands.getstatusoutput("/usr/sbin/lokkit --selinuxtype=%s --selinux=%s" % (type, enforcing)) + path = selinux.selinux_path() + "config" + backup_path = path + ".bck" + fd = open(path) + lines = fd.readlines() + fd.close() + fd = open(backup_path, "w") + for l in lines: + if l.startswith("SELINUX="): + fd.write("SELINUX=%s\n" % enforcing) + continue + if l.startswith("SELINUXTYPE="): + fd.write("SELINUXTYPE=%s\n" % type) + continue + fd.write(l) + fd.close() + os.rename(backup_path, path) def read_selinux_config(self): self.initialtype = selinux.selinux_getpolicytype()[1]