Skip to contentSkip to conversation

some minor fixes to udevd, initscripts, policycoreutils

PATCH Applied [email protected] 2 participants 6 messages Apr 23, 2014 – Apr 24, 2014

lore
Share & tools
lore
#0 lore raw

cover some minor fixes to udevd, initscripts, policycoreutils

From: Wenzong Fan <[email protected]>

* udevd: it creates /dev/shm, /dev/pts, restorecon for them as well;
* initscripts: always force to restore file contexts for /var/lib
* policycoreutils:
get semanage process the ValueError from sepolicy, seobject; fix TypeError from seobject.py

The following changes since commit 0362287928bc0a58b755488ebd74441c28eeeee2:
policycoreutils
audit: Fix lack of a default audit.rules (2014-04-07 09:55:49 -0400)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib wenzong/several-fixes
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/several-fixes

Wenzong Fan (4):
udev init: restorecon for /dev/shm, /dev/pts always force to restore file contexts for /var/lib
semanage: process ValueError for sepolicy, seobject
policycoreutils: fix TypeError for seobject.py

 recipes-core/initscripts/initscripts_1.0.bbappend  |    2 +-
 recipes-core/udev/udev/init                        |    2 +-
 ...cycoreutils-fix-TypeError-for-seobject.py.patch |   32 +++++++++++++
 ...-process-ValueError-for-sepolicy-seobject.patch |   48 ++++++++++++++++++++
 recipes-security/selinux/policycoreutils_2.2.5.bb  |    2 +
 5 files changed, 84 insertions(+), 2 deletions(-)
 create mode 100644 recipes-security/selinux/policycoreutils/policycoreutils-fix-TypeError-for-seobject.py.patch
 create mode 100644 recipes-security/selinux/policycoreutils/policycoreutils-process-ValueError-for-sepolicy-seobject.patch
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/4 udev init: restorecon for /dev/shm, /dev/pts

From: Wenzong Fan <[email protected]>

---
 recipes-core/udev/udev/init |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-core/udev/udev/init +1 -1
index 7194e8c..66359f2 100644
@@ -114,7 +114,7 @@ case "$1" in
             udevadm settle
     fi
 
-    test ! -x /sbin/restorecon || /sbin/restorecon -F /dev
+    test ! -x /sbin/restorecon || /sbin/restorecon -F /dev /dev/shm /dev/pts
 
     ;;
   stop)
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 always force to restore file contexts for /var/lib

In reply to [email protected]

From: Wenzong Fan <[email protected]>

---
 recipes-core/initscripts/initscripts_1.0.bbappend |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-core/initscripts/initscripts_1.0.bbappend +1 -1
index b8172c0..7ec66ea 100644
@@ -3,6 +3,6 @@ PR .= ".3"
 do_install_append () {
 	cat <<-EOF >> ${D}${sysconfdir}/init.d/populate-volatile.sh
 touch /var/log/lastlog
-test ! -x /sbin/restorecon || /sbin/restorecon -RF /var/volatile/ /run
+test ! -x /sbin/restorecon || /sbin/restorecon -RF /var/volatile/ /var/lib /run
 EOF
 }
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/4 semanage: process ValueError for sepolicy, seobject

In reply to [email protected]

From: Wenzong Fan <[email protected]>

The sepolicy, seobject modules raise many unprocessed ValueError, just process them in semanage to make the script proivdes error message but not error trace.

---
 ...-process-ValueError-for-sepolicy-seobject.patch |   48 ++++++++++++++++++++
 recipes-security/selinux/policycoreutils_2.2.5.bb  |    1 +
 2 files changed, 49 insertions(+)
 create mode 100644 recipes-security/selinux/policycoreutils/policycoreutils-process-ValueError-for-sepolicy-seobject.patch
recipes-security/selinux/policycoreutils/policycoreutils-process-ValueError-for-sepolicy-seobject.patch new file +48 -0
new file mode 100644
index 0000000..933f2b2
@@ -0,0 +1,48 @@
+From b8e07bd0643b581ac33c96a1f94ae17c8df80ffd Mon Sep 17 00:00:00 2001
+From: Wenzong Fan <[email protected]>
+Date: Sun, 30 Mar 2014 22:25:59 -0400
+Subject: [PATCH] semanage: process ValueError for sepolicy, seobject
+
+The sepolicy, seobject modules raise many unprocessed ValueError, just
+process them in semanage to make the script proivdes error message but
+not error trace.
+
+Uptream-Status: pending
+
+Signed-off-by: Wenzong Fan <[email protected]>
+---
+ semanage/semanage |    9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/semanage/semanage b/semanage/semanage
+index 36b41cd..a36a3f9 100644
+--- a/semanage/semanage
++++ b/semanage/semanage
+@@ -24,9 +24,15 @@
+ #
+ 
+ import argparse
+-import seobject
+ import sys
+ import gettext
++try:
++        import seobject
++        import sepolicy
++except ValueError, e:
++        print "Error: %s\n" % e
++        sys.exit(1)
++
+ PROGNAME="policycoreutils"
+ try:
+        gettext.install(PROGNAME,
+@@ -59,7 +65,6 @@ usage_interface_dict = {' --add':('-t TYPE','-r RANGE','interface'),' --modify':
+ usage_boolean = "semanage boolean [-h] [-n] [-N] [-s STORE] ["
+ usage_boolean_dict = {' --modify':('(','--on','|','--off',')','boolean'), ' --list':('-C',), '  --extract':('',), ' --deleteall':('',)}
+ 
+-import sepolicy
+ class CheckRole(argparse.Action):
+     def __call__(self, parser, namespace, value, option_string=None):
+         newval = getattr(namespace, self.dest)
+-- 
+1.7.9.5
+
recipes-security/selinux/policycoreutils_2.2.5.bb +1 -0
index c278aff..7c32064 100644
@@ -13,4 +13,5 @@ SRC_URI += "\
 	file://policycoreutils-make-O_CLOEXEC-optional.patch \
 	file://policycoreutils-loadpolicy-symlink.patch \
 	file://policycoreutils-semanage-edit-user.patch \
+	file://policycoreutils-process-ValueError-for-sepolicy-seobject.patch \
 	"
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/4 policycoreutils: fix TypeError for seobject.py

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Fix python error about:

File "/usr/lib64/python2.7/site-packages/seobject.py", line 109, in log
message += " sename=" + sename
TypeError: cannot concatenate 'str' and 'NoneType' objects

---
 ...cycoreutils-fix-TypeError-for-seobject.py.patch |   32 ++++++++++++++++++++
 recipes-security/selinux/policycoreutils_2.2.5.bb  |    1 +
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-security/selinux/policycoreutils/policycoreutils-fix-TypeError-for-seobject.py.patch
recipes-security/selinux/policycoreutils/policycoreutils-fix-TypeError-for-seobject.py.patch new file +32 -0
new file mode 100644
index 0000000..dd6ca6d
@@ -0,0 +1,32 @@
+From a66c50c0e8cd3799fc2819835b872ab62419f684 Mon Sep 17 00:00:00 2001
+From: Wenzong Fan <[email protected]>
+Date: Tue, 1 Apr 2014 02:53:36 -0400
+Subject: [PATCH] policycoreutils: fix TypeError for seobject.py
+
+File "/usr/lib64/python2.7/site-packages/seobject.py", line 109, in log
+  message += " sename=" + sename
+TypeError: cannot concatenate 'str' and 'NoneType' objects
+
+Uptream-Status: pending
+
+Signed-off-by: Wenzong Fan <[email protected]>
+---
+ semanage/seobject.py |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/semanage/seobject.py b/semanage/seobject.py
+index f8d2243..66653e6 100644
+--- a/semanage/seobject.py
++++ b/semanage/seobject.py
+@@ -105,7 +105,7 @@ except:
+ 
+ 		def log(self, msg, name = "", sename = "", serole = "", serange = "", oldsename = "", oldserole = "", oldserange = ""):
+ 			message = " %s name=%s" % (msg, name)
+-			if sename != "":
++			if sename != "" and sename != None:
+ 				message += " sename=" + sename
+ 			if oldsename != "":
+ 				message += " oldsename=" + oldsename
+-- 
+1.7.9.5
+
recipes-security/selinux/policycoreutils_2.2.5.bb +1 -0
index 7c32064..560cee6 100644
@@ -14,4 +14,5 @@ SRC_URI += "\
 	file://policycoreutils-loadpolicy-symlink.patch \
 	file://policycoreutils-semanage-edit-user.patch \
 	file://policycoreutils-process-ValueError-for-sepolicy-seobject.patch \
+	file://policycoreutils-fix-TypeError-for-seobject.py.patch \
 	"
Signature · 1 line
1.7.9.5
#5 lore raw
In reply to [email protected]

Merged, thanks.
-J.

Quoted 35 lines · [[yocto] [meta-selinux][PATCH 0/4] some minor fixes to udevd, initscripts…

From: Wenzong Fan <[email protected]>

* udevd: it creates /dev/shm, /dev/pts, restorecon for them as well;
* initscripts: always force to restore file contexts for /var/lib
* policycoreutils:
get semanage process the ValueError from sepolicy, seobject; fix TypeError from seobject.py

The following changes since commit 0362287928bc0a58b755488ebd74441c28eeeee2:
policycoreutils
audit: Fix lack of a default audit.rules (2014-04-07 09:55:49 -0400)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib wenzong/several-fixes
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/several-fixes

Wenzong Fan (4):
udev init: restorecon for /dev/shm, /dev/pts always force to restore file contexts for /var/lib
semanage: process ValueError for sepolicy, seobject
policycoreutils: fix TypeError for seobject.py

 recipes-core/initscripts/initscripts_1.0.bbappend  |    2 +-
 recipes-core/udev/udev/init                        |    2 +-
 ...cycoreutils-fix-TypeError-for-seobject.py.patch |   32 +++++++++++++
 ...-process-ValueError-for-sepolicy-seobject.patch |   48 ++++++++++++++++++++
 recipes-security/selinux/policycoreutils_2.2.5.bb  |    2 +
 5 files changed, 84 insertions(+), 2 deletions(-)
 create mode 100644 recipes-security/selinux/policycoreutils/policycoreutils-fix-TypeError-for-seobject.py.patch
 create mode 100644 recipes-security/selinux/policycoreutils/policycoreutils-process-ValueError-for-sepolicy-seobject.patch
Signature · 1 line
1.7.9.5
Signature · 2 lines
-Joe MacDonald.
:wq