Skip to contentSkip to conversation

policycoreutils patch

PATCH Daniel J Walsh 2 participants 2 messages Jun 1, 2007 – Jun 5, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

policycoreutils should be checking if the user is the default_type not hard coded to user_u.

Also if selinux is not enabled, the verification step should not happen. This is causing problems in chroot environments for the install.

Both these fixes should go into the new genhomedircon that is being added to semanage.

scripts/genhomedircon +2 -2
diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-2.0.19/scripts/genhomedircon
@@ -193,7 +193,7 @@
 		return prefix
 		
 	def adduser(self, udict, user, seuser, prefix):
-		if seuser == "user_u" or user == "__default__" or user == "system_u":
+		if seuser == self.default_user or user == "__default__" or user == "system_u":
 			return
 		# !!! chooses first prefix in the list to use in the file context !!!
 		try:
@@ -263,7 +263,7 @@
 				i = i.replace("system_u", seuser)
 				# Validate if the generated context exists.  Some user types may not exist
 				scon = i.split()[-1]
-				if selinux.security_check_context(scon) == 0:
+				if selinux.is_selinux_enabled() < 1 or selinux.security_check_context(scon) == 0:
 					ret = ret+i
 		fd.close()
 		return ret
#1 lore raw
Quoted 8 lines · Daniel J Walsh

policycoreutils should be checking if the user is the default_type not hard coded to user_u.

Also if selinux is not enabled, the verification step should not happen. This is causing problems in chroot environments for the install.

Both these fixes should go into the new genhomedircon that is being added to semanage.

Thanks, merged into the current genhomedircon script on trunk.

Quoted 22 lines

plain text document attachment (diff)
diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-2.0.19/scripts/genhomedircon

scripts/genhomedircon +2 -2
@@ -193,7 +193,7 @@
 		return prefix
 
 	def adduser(self, udict, user, seuser, prefix):
-		if seuser == "user_u" or user == "__default__" or user == "system_u":
+		if seuser == self.default_user or user == "__default__" or user == "system_u":
 			return
 		# !!! chooses first prefix in the list to use in the file context !!!
 		try:
@@ -263,7 +263,7 @@
 				i = i.replace("system_u", seuser)
 				# Validate if the generated context exists.  Some user types may not exist
 				scon = i.split()[-1]
-				if selinux.security_check_context(scon) == 0:
+				if selinux.is_selinux_enabled() < 1 or selinux.security_check_context(scon) == 0:
 					ret = ret+i
 		fd.close()
 		return ret
Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.