policy: do not modify the allow_domain_fd_use boolean
Stephen Smalley
maintainerPATCH v2 1/1 policy: do not modify the allow_domain_fd_use boolean
Modifying the allow_domain_fd_use boolean value during testsuite execution is increasingly triggering breakage on Fedora since its policy defaults to 1/true, to the point that you can't ssh or even console login to a VM while the testsuite is running or even afterward if the testsuite encounters any failures. Instead of modifying this boolean, just update the relevant test domains to use the _minimal interface so they do not inherit this rule by default and add any required allowed rules to them.
---
v2 addresses a comment from Ondrej Mosnacek <[email protected]>, rewriting the sigkill rule to use testsuite_caller_domain and moving it to a more appropriate location.
policy/Makefile | 6 ------ policy/test_binder.te | 3 ++- policy/test_fdreceive.te | 4 +++- policy/test_global.te | 1 + policy/test_inherit.te | 3 ++- 5 files changed, 8 insertions(+), 9 deletions(-)
policy/Makefile +0 -6
@@ -223,16 +223,10 @@ build: $(TARGETS) load: expand_check all # General policy load - @if /usr/sbin/getsebool allow_domain_fd_use 2> /dev/null; then \ - /usr/sbin/setsebool allow_domain_fd_use=0; \ - fi $(SEMODULE) -i test_policy/test_policy.pp $(CIL_TARGETS) unload: # General policy unload - @if /usr/sbin/getsebool allow_domain_fd_use 2> /dev/null; then \ - /usr/sbin/setsebool allow_domain_fd_use=1; \ - fi $(SEMODULE) -r test_policy $(subst .cil,,$(CIL_TARGETS)) clean:
policy/test_binder.te +2 -1
@@ -42,7 +42,8 @@ allow test_binder_provider_no_fd_t test_file_t:fifo_file rw_file_perms; ################################# Client #################################### # type test_binder_client_t; -testsuite_domain_type(test_binder_client_t) +# Must use _minimal interface to avoid granting domain fd use permission +testsuite_domain_type_minimal(test_binder_client_t) typeattribute test_binder_client_t binderdomain; allow test_binder_client_t test_binder_provider_t:binder { call impersonate }; allow test_binder_client_t test_binder_mgr_t:binder { call };
policy/test_fdreceive.te +3 -1
@@ -27,7 +27,9 @@ typeattribute test_fdreceive_client2_t fdreceivedomain; # Can receive fds from client, not from client2. # Can access test file, not second test file. type test_fdreceive_server_t; -testsuite_domain_type(test_fdreceive_server_t); +# Use the _minimal interface to avoid allowing fd use by default +testsuite_domain_type_minimal(test_fdreceive_server_t) +allow test_fdreceive_server_t self:unix_stream_socket create_stream_socket_perms; typeattribute test_fdreceive_server_t fdreceivedomain; # Grant the necessary permissions for the server domain.
policy/test_global.te +1 -0
@@ -69,6 +69,7 @@ optional_policy(` # Needed for domains outside domain_type() dontaudit testsuite_caller_domain testsuite_domain:process { noatsecure rlimitinh siginh }; +allow testsuite_caller_domain testsuite_domain:process sigkill; # keys test may trigger search AVCs for root's keys dontaudit testsuite_domain testsuite_caller_domain:key { search };
policy/test_inherit.te +2 -1
@@ -22,7 +22,8 @@ typeattribute test_inherit_child_t inheritdomain; # Domain for child process that cannot inherit from parent due to lack # of fd use permission. type test_inherit_nouse_t; -testsuite_domain_type(test_inherit_nouse_t) +# Use the _minimal interface to avoid allowing fd use by default +testsuite_domain_type_minimal(test_inherit_nouse_t) typeattribute test_inherit_nouse_t inheritdomain; # Domain for child process that cannot inherit r/w fd to test file
Signature · 1 line
2.51.1
Ondrej Mosnacek
AppliedQuoted 16 lines · Stephen Smalley
Modifying the
allow_domain_fd_useboolean value during testsuite execution is increasingly triggering breakage on Fedora since its policy defaults to 1/true, to the point that you can't ssh or even console login to a VM while the testsuite is running or even afterward if the testsuite encounters any failures. Instead of modifying this boolean, just update the relevant test domains to use the_minimalinterface so they do not inherit this rule by default and add any required allowed rules to them.Signed-off-by Stephen Smalley <[email protected]>---
v2 addresses a comment from Ondrej Mosnacek <[email protected]>, rewriting the sigkill rule to usetestsuite_caller_domainand moving it to a more appropriate location.
Quoted 6 lines
policy/Makefile | 6 ------ policy/test_binder.te | 3 ++- policy/test_fdreceive.te | 4 +++- policy/test_global.te | 1 + policy/test_inherit.te | 3 ++- 5 files changed, 8 insertions(+), 9 deletions(-)
Thanks, applied:
https://github.com/SELinuxProject/selinux-testsuite/commit/f40c76cec56778fd5651ad6de715d9941dbfd4b3
Signature · 3 lines
Ondrej Mosnacek Senior Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.