platform_external_selinux/libsemanage
Jason Zaman f5c226810d libsemanage: do not copy contexts in semanage_migrate_store
The modules from the old store were previously copied to the new one
using setfscreatecon and shutil.copy2(). Now that refpolicy has rules
about the new policy location[1], copying the contexts is redundant.

More importantly, the setcreatefscon caused a constraint violation[2]
which made the migration fail. In python3, shutil.copy2() copies xattrs
as well which again causes problems. shutil.copy() is enough for our
needs here as it will copy the file and permissions in both py2 and 3.
We do not need the extra things that copy2() does (mtime, xattr, etc).

[1] http://oss.tresys.com/pipermail/refpolicy/2014-December/007511.html

[2]
type=AVC msg=audit(1429438272.872:1869): avc:  denied  { create } for  pid=28739 comm="semanage_migrat" name="strict" scontext=staff_u:sysadm_r:semanage_t tcontext=system_u:object_r:semanage_store_t tclass=dir permissive=0
	constrain dir { create relabelfrom relabelto } ((u1 == u2 -Fail-)  or (t1 == can_change_object_identity -Fail-) ); Constraint DENIED
allow semanage_t semanage_store_t:dir create;

Signed-off-by: Jason Zaman <jason@perfinion.com>
Acked-by: Steve Lawrence <slawrence@tresys.com>

Changes from v1:
 - Changed some methods to not take a src param anymore.
2015-04-23 08:35:39 -04:00
..
example Author: Daniel J Walsh 2008-09-15 09:25:33 -04:00
include libsemanage: add the ability to set an alternative root path for store 2014-08-26 08:03:31 -04:00
man libsemanage: Add option to remove HLL files after compilation 2015-02-27 08:41:59 -05:00
src libsemanage: Fix logic in bunzip for uncompressed pp files 2015-03-19 13:01:11 -04:00
tests libsemanage: fix fname[] initialization in test_utilities.c 2015-03-18 08:16:04 -04:00
utils libsemanage: do not copy contexts in semanage_migrate_store 2015-04-23 08:35:39 -04:00
.gitignore Add subdirectory .gitignore files. 2009-10-20 21:25:55 -04:00
ChangeLog Move ChangeLog entry to the correct project 2015-04-21 08:49:32 -04:00
COPYING initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
Makefile libsemanage: semanage store migration script 2014-08-26 08:03:31 -04:00
VERSION Bump to final release 2015-02-02 09:38:10 -05:00