Skip to contentSkip to conversation

policy: check for module_request support for key_socket

PATCH Superseded Ondrej Mosnacek 2 participants 3 messages Nov 25, 2019 SELinux security module

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 policy: check for module_request support for key_socket

E.g. RHEL-5 has key_socket class in the policy, but not the system::module_request permission.

---
 policy/Makefile | 2 ++
 1 file changed, 2 insertions(+)
policy/Makefile +2 -0
index 57cc172..7c2d21e 100644
@@ -94,8 +94,10 @@ TARGETS+=test_notify.te
 endif
 
 ifeq ($(shell grep -q key_socket $(POLDEV)/include/support/all_perms.spt && echo true),true)
+ifeq ($(shell grep -q module_request $(POLDEV)/include/support/all_perms.spt && echo true),true)
 TARGETS += test_key_socket.te
 endif
+endif
 
 ifeq (x$(DISTRO),$(filter x$(DISTRO),xRHEL4 xRHEL5 xRHEL6))
 TARGETS:=$(filter-out test_overlayfs.te test_mqueue.te test_ibpkey.te, $(TARGETS))
Signature · 1 line
2.23.0
#1 lore raw
Quoted 14 lines · Ondrej Mosnacek

E.g. RHEL-5 has key_socket class in the policy, but not the system::module_request permission.

---
  policy/Makefile | 2 ++
  1 file changed, 2 insertions(+)
policy/Makefile +0 -0
index 57cc172..7c2d21e 100644

policy/Makefile TARGETS+=test_notify.te · line 103

Quoted 10 lines
policy/Makefile +2 -0
@@ -94,8 +94,10 @@ TARGETS+=test_notify.te
  endif
 
  ifeq ($(shell grep -q key_socket $(POLDEV)/include/support/all_perms.spt && echo true),true)
+ifeq ($(shell grep -q module_request $(POLDEV)/include/support/all_perms.spt && echo true),true)
  TARGETS += test_key_socket.te
  endif
+endif
 
  ifeq (x$(DISTRO),$(filter x$(DISTRO),xRHEL4 xRHEL5 xRHEL6))
  TARGETS:=$(filter-out test_overlayfs.te test_mqueue.te test_ibpkey.te, $(TARGETS))

Alternatively, consider wrapping use of module_request in test_key_socket.te with a suitable ifdef. Probably ought to be using the policy interface, kernel_request_load_module(), and then we can just wrap it with ifdef(`kernel_request_load_module', ...). Rationale: The purpose of this test and its policy is to test the key_socket checks, not module_request; allowing module_request is just incidental.

#2 lore raw
Quoted 22 lines · Stephen Smalley
Quoted 21 lines · Ondrej Mosnacek

E.g. RHEL-5 has key_socket class in the policy, but not the system::module_request permission.

---
  policy/Makefile | 2 ++
  1 file changed, 2 insertions(+)
policy/Makefile +2 -0
index 57cc172..7c2d21e 100644
@@ -94,8 +94,10 @@ TARGETS+=test_notify.te
  endif
 
  ifeq ($(shell grep -q key_socket $(POLDEV)/include/support/all_perms.spt && echo true),true)
+ifeq ($(shell grep -q module_request $(POLDEV)/include/support/all_perms.spt && echo true),true)
  TARGETS += test_key_socket.te
  endif
+endif
 
Quoted 10 lines

policy/Makefile TARGETS+=test_notify.te · line 103

Quoted 3 lines
policy/Makefile +0 -0
  ifeq (x$(DISTRO),$(filter x$(DISTRO),xRHEL4 xRHEL5 xRHEL6))
  TARGETS:=$(filter-out test_overlayfs.te test_mqueue.te test_ibpkey.te, $(TARGETS))

Alternatively, consider wrapping use of module_request in test_key_socket.te with a suitable ifdef. Probably ought to be using the policy interface, kernel_request_load_module(), and then we can just wrap it with ifdef(`kernel_request_load_module', ...). Rationale: The purpose of this test and its policy is to test the key_socket checks, not module_request; allowing module_request is just incidental.

Good point, I'll look into doing it that way in v3. (I posted v2 before spotting your reply.)

Signature · 3 lines
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.