# Copyright (C) 2005 Tresys Technology, LLC ## ## Core policy for domains. ######################################## # # domain_make_base_domain(domain) # define(`domain_make_base_domain',` requires_block_template(`$0'_depend) # mark as a domain typeattribute $1 domain; # allow the domain to read its /proc/pid entries allow $1 self:dir { getattr search read }; allow $1 self:{ file lnk_file } { getattr read write ioctl }; # allow $1 to create child processes in this domain allow $1 self:process { fork sigchld }; ') define(`domain_make_base_domain_depend',` attribute domain; class dir { getattr search read }; class file { getattr read write ioctl }; class lnk_file { getattr read }; ') ######################################## # # domain_make_domain(domain) # define(`domain_make_domain',` # start with basic domain domain_make_base_domain($1) # Use trusted objects in /dev devices_use_dev_null($1) devices_use_dev_zero($1) terminal_use_controlling_terminal($1) # read the root directory files_read_root_dir($1) # send init a sigchld init_sigchld($1) # this seems highly questionable: optional_policy(`rpm.te',` rpm_use_file_descriptors($1) rpm_read_pipe($1) ') ') ######################################## # # domain_make_entrypoint_file(domain,entrypointfile) # define(`domain_make_entrypoint_file',` requires_block_template(`$0'_depend) allow $1 $2:file entrypoint; files_make_file($2) typeattribute $2 entry_type; ') define(`domain_make_entrypoint_file_depend',` attribute entry_type; class file entrypoint; ') ######################################## # # domain_make_file_descriptors_widely_inheritable(domain) # define(`domain_make_file_descriptors_widely_inheritable',` requires_block_template(`$0'_depend) typeattribute $1 privfd; ') define(`domain_make_file_descriptors_widely_inheritable_depend',` attribute privfd; ') ######################################## # # domain_use_widely_inheritable_file_descriptors(domain) # define(`domain_use_widely_inheritable_file_descriptors',` requires_block_template(`$0'_depend) allow $1 privfd:fd use; ') define(`domain_use_widely_inheritable_file_descriptors_depend',` attribute privfd; class fd use; ') ######################################## # # domain_ignore_use_widely_inheritable_file_descriptors(domain) # define(`domain_ignore_use_widely_inheritable_file_descriptors',` requires_block_template(`$0'_depend) dontaudit $1 privfd:fd use; ') define(`domain_ignore_use_widely_inheritable_file_descriptors_depend',` attribute privfd; class fd use; ') ######################################## # # domain_set_all_domains_priorities(domain) # define(`domain_set_all_domains_priorities',` requires_block_template(`$0'_depend) allow $1 domain:process setsched; ') define(`domain_set_all_domains_priorities_depend',` attribute domain; class process setsched; ') ######################################## ## ## ## Send general signals to all domains. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_signal_all_domains',` requires_block_template(`$0'_depend) allow $1 domain:process signal; ') define(`domain_signal_all_domains_depend',` attribute domain; class process signal; ') ######################################## ## ## ## Send a null signal to all domains. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_signull_all_domains',` requires_block_template(`$0'_depend) allow $1 domain:process signull; ') define(`domain_signull_all_domains_depend',` attribute domain; class process signull; ') ######################################## ## ## ## Send a stop signal to all domains. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_sigstop_all_domains',` requires_block_template(`$0'_depend) allow $1 domain:process sigstop; ') define(`domain_sigstop_all_domains_depend',` attribute domain; class process sigstop; ') ######################################## ## ## ## Send a child terminated signal to all domains. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_sigchld_all_domains',` requires_block_template(`$0'_depend) allow $1 domain:process sigchld; ') define(`domain_sigchld_all_domains_depend',` attribute domain; class process sigchld; ') ######################################## ## ## ## Send a kill signal to all domains. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_kill_all_domains',` requires_block_template(`$0'_depend) allow $1 domain:process sigkill; allow $1 self:capability kill; ') define(`domain_kill_all_domains_depend',` attribute domain; class process sigkill; class capability kill; ') ######################################## ## ## ## Read the process state (/proc/pid) of all domains. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_read_all_domains_process_state',` requires_block_template(`$0'_depend) allow $1 domain:dir { getattr search read }; allow $1 domain:lnk_file { getattr read }; allow $1 domain:file { getattr read }; allow $1 domain:process getattr; # We need to suppress this denial because procps tries to access # /proc/pid/environ and this now triggers a ptrace check in recent kernels # (2.4 and 2.6). Might want to change procps to not do this, or only if # running in a privileged domain. dontaudit $1 domain:process ptrace; ') define(`domain_read_all_domains_process_state_depend',` attribute domain; class dir { getattr search read }; class lnk_file { getattr read }; class file { getattr read }; class process { getattr ptrace }; ') ######################################## ## ## ## Do not audit attempts to read the process state ## directories of all domains. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_ignore_read_all_domains_process_dirs',` requires_block_template(`$0'_depend) dontaudit $1 domain:dir r_dir_perms; ') define(`domain_ignore_read_all_domains_process_dirs_depend',` attribute domain; class dir r_dir_perms; ') ######################################## ## ## ## Get the session ID of all domains. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_get_all_domains_session_id',` requires_block_template(`$0'_depend) allow $1 domain:process getsession; ') define(`domain_get_all_domains_session_id_depend',` attribute domain; class process getsession; ') ######################################## ## ## ## Do not audit attempts to get the attributes ## of all domains UDP sockets. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_ignore_get_all_domains_udp_socket_attributes',` requires_block_template(`$0'_depend) dontaudit $1 domain:udp_socket getattr; ') define(`domain_ignore_get_all_domains_udp_socket_attributes_depend',` attribute domain; class udp_socket getattr; ') ######################################## ## ## ## Do not audit attempts to get the attributes ## of all domains TCP sockets. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_ignore_get_all_domains_tcp_socket_attributes',` requires_block_template(`$0'_depend) dontaudit $1 domain:tcp_socket getattr; ') define(`domain_ignore_get_all_domains_tcp_socket_attributes_depend',` attribute domain; class tcp_socket getattr; ') ######################################## ## ## ## Do not audit attempts to get the attributes ## of all domains unix datagram sockets. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_ignore_get_all_domains_unix_dgram_socket_attributes',` requires_block_template(`$0'_depend) dontaudit $1 domain:unix_dgram_socket getattr; ') define(`domain_ignore_get_all_domains_unix_dgram_socket_attributes_depend',` attribute domain; class unix_dgram_socket getattr; ') ######################################## ## ## ## Do not audit attempts to get the attributes ## of all domains unnamed pipes. ## ## ## The type of the process performing this action. ## ## ## # define(`domain_ignore_get_all_domains_pipe_attributes',` requires_block_template(`$0'_depend) dontaudit $1 domain:fifo_file getattr; ') define(`domain_ignore_get_all_domains_pipe_attributes_depend',` attribute domain; class fifo_file getattr; ') ######################################## # # domain_execute_all_entrypoint_programs(domain) # define(`domain_execute_all_entrypoint_programs',` requires_block_template(`$0'_depend) allow $1 entry_type:file { getattr read ioctl lock execute execute_no_trans }; ') define(`domain_execute_all_entrypoint_programs_depend',` attribute entry_type; class file { getattr read ioctl lock execute execute_no_trans }; ') ######################################## # # domain_read_all_entrypoint_programs(domain) # define(`domain_read_all_entrypoint_programs',` requires_block_template(`$0'_depend) allow $1 entry_type:lnk_file { getattr read }; allow $1 entry_type:file r_file_perms; ') define(`domain_read_all_entrypoint_programs_depend',` attribute entry_type; class file r_file_perms; class lnk_file { getattr read }; ') ##