[PATCH 72/84] policycoreutils: gui: system-config-selinux: do not use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


   This patch looks good to me. acked.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlD+qNgACgkQrlYvE4MpobNRfwCguHHBz8z24pNSrwFKBnUBPkAz
YQYAoJCt4I6lOMCoT2LI+7o9RsoBxO47
=6TrC
-----END PGP SIGNATURE-----
>From a07a919e017256939d759895a45e9e5b23548b8d Mon Sep 17 00:00:00 2001
From: Dan Walsh <dwalsh@xxxxxxxxxx>
Date: Thu, 6 Dec 2012 14:40:23 -0500
Subject: [PATCH 72/84] 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 <eparis@xxxxxxxxxx>
---
 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 e561de1..2069635 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]
-- 
1.8.1


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux