Skip to contentSkip to conversation

selinux-testsuite: Add CAP_MAC_ADMIN tests

PATCH New Stephen Smalley 1 participant 1 message Apr 20, 2017 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 selinux-testsuite: Add CAP_MAC_ADMIN tests

Add a set of tests for SELinux CAP_MAC_ADMIN checking, which controls the ability to get or set a raw, uninterpreted security context unknown to the currently loaded security policy.

---
v2 fixes the last test to pass a well-formed context to mkdir --context. It technically makes no difference for the test itself, since the context is undefined regardless, but we want to ensure that userspace does not reject the context before it reaches the kernel.

 policy/Makefile          |  2 +-
 policy/test_mac_admin.te | 52 +++++++++++++++++++++++++++++++++++++++++++++
 tests/Makefile           |  2 +-
 tests/mac_admin/Makefile |  2 ++
 tests/mac_admin/test     | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 111 insertions(+), 2 deletions(-)
 create mode 100644 policy/test_mac_admin.te
 create mode 100644 tests/mac_admin/Makefile
 create mode 100755 tests/mac_admin/test
policy/Makefile +1 -1
index 6537b68..661f27a 100644
@@ -20,7 +20,7 @@ TARGETS = \
 	test_task_create.te test_task_getpgid.te test_task_getsched.te \
 	test_task_getsid.te test_task_setpgid.te test_task_setsched.te \
 	test_transition.te test_inet_socket.te test_unix_socket.te \
-	test_mmap.te test_overlayfs.te test_mqueue.te
+	test_mmap.te test_overlayfs.te test_mqueue.te test_mac_admin.te
 
 ifeq ($(shell [ $(POL_VERS) -ge 24 ] && echo true),true)
 TARGETS += test_bounds.te
policy/test_mac_admin.te new file +52 -0

52 lines not on this page · raw message

tests/Makefile +1 -1
index 4e5e7c0..fb8a0aa 100644
@@ -10,7 +10,7 @@ SUBDIRS:=domain_trans entrypoint execshare exectrace execute_no_trans \
 	task_setnice task_setscheduler task_getscheduler task_getsid \
 	task_getpgid task_setpgid file ioctl capable_file capable_net \
 	capable_sys dyntrans dyntrace bounds nnp mmap unix_socket inet_socket \
-	overlay checkreqprot mqueue
+	overlay checkreqprot mqueue mac_admin
 
 ifeq ($(shell grep -q cap_userns $(POLDEV)/include/support/all_perms.spt && echo true),true)
 ifneq ($(shell ./kvercmp $$(uname -r) 4.7),-1)
tests/mac_admin/Makefile new file +2 -0
new file mode 100644
index 0000000..e7c006f
@@ -0,0 +1,2 @@
+all:
+clean:
tests/mac_admin/test new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
2.9.3