selinux-policy/refpolicy/policy/modules/system/domain.if

488 lines
11 KiB
Plaintext
Raw Normal View History

2005-05-23 15:49:03 +00:00
## <module name="domain" layer="system">
## <summary>Core policy for domains.</summary>
2005-04-20 19:07:16 +00:00
2005-04-14 20:18:17 +00:00
########################################
#
# domain_make_base_domain(domain)
2005-04-14 20:18:17 +00:00
#
define(`domain_make_base_domain',`
requires_block_template(`$0'_depend)
2005-04-14 20:18:17 +00:00
# mark as a domain
typeattribute $1 domain;
2005-04-14 20:18:17 +00:00
# allow the domain to read its /proc/pid entries
2005-06-09 14:50:48 +00:00
allow $1 self:dir r_dir_perms;
allow $1 self:{ file lnk_file } rw_file_perms;
2005-04-14 20:18:17 +00:00
# allow $1 to create child processes in this domain
allow $1 self:process { fork sigchld };
2005-04-14 20:18:17 +00:00
')
define(`domain_make_base_domain_depend',`
attribute domain;
2005-06-09 14:50:48 +00:00
class dir r_dir_perms;
class file rw_file_perms;
class lnk_file r_file_perms;
2005-04-14 20:18:17 +00:00
')
########################################
#
# domain_make_domain(domain)
2005-04-14 20:18:17 +00:00
#
define(`domain_make_domain',`
# start with basic domain
domain_make_base_domain($1)
# Use trusted objects in /dev
2005-06-13 16:22:32 +00:00
dev_rw_null_dev($1)
dev_rw_zero_dev($1)
2005-06-10 01:01:13 +00:00
term_use_controlling_term($1)
# read the root directory
files_read_root_dir($1)
# send init a sigchld
init_sigchld($1)
2005-05-23 17:56:35 +00:00
# this seems highly questionable:
optional_policy(`rpm.te',`
rpm_use_file_descriptors($1)
rpm_read_pipe($1)
')
2005-04-14 20:18:17 +00:00
')
########################################
#
# domain_make_entrypoint_file(domain,entrypointfile)
2005-04-14 20:18:17 +00:00
#
define(`domain_make_entrypoint_file',`
requires_block_template(`$0'_depend)
files_make_file($2)
allow $1 $2:file entrypoint;
typeattribute $2 entry_type;
2005-04-14 20:18:17 +00:00
')
define(`domain_make_entrypoint_file_depend',`
attribute entry_type;
class file entrypoint;
2005-04-14 20:18:17 +00:00
')
########################################
#
# 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;
')
2005-04-28 21:41:09 +00:00
########################################
#
# domain_use_widely_inheritable_file_descriptors(domain)
2005-04-28 21:41:09 +00:00
#
define(`domain_use_widely_inheritable_file_descriptors',`
requires_block_template(`$0'_depend)
allow $1 privfd:fd use;
2005-04-28 21:41:09 +00:00
')
define(`domain_use_widely_inheritable_file_descriptors_depend',`
attribute privfd;
class fd use;
2005-04-28 21:41:09 +00:00
')
########################################
#
# 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;
')
2005-05-18 13:21:00 +00:00
########################################
#
# domain_set_all_domains_priorities(domain)
#
define(`domain_set_all_domains_priorities',`
requires_block_template(`$0'_depend)
allow $1 domain:process setsched;
2005-05-18 13:21:00 +00:00
')
define(`domain_set_all_domains_priorities_depend',`
attribute domain;
class process setsched;
2005-05-18 13:21:00 +00:00
')
2005-04-14 20:18:17 +00:00
########################################
2005-05-27 20:44:05 +00:00
## <interface name="domain_signal_all_domains">
## <description>
## Send general signals to all domains.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
2005-04-14 20:18:17 +00:00
#
define(`domain_signal_all_domains',`
requires_block_template(`$0'_depend)
allow $1 domain:process signal;
2005-04-14 20:18:17 +00:00
')
define(`domain_signal_all_domains_depend',`
attribute domain;
class process signal;
2005-04-14 20:18:17 +00:00
')
2005-05-23 15:49:03 +00:00
########################################
## <interface name="domain_signull_all_domains">
## <description>
## Send a null signal to all domains.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
#
define(`domain_signull_all_domains',`
requires_block_template(`$0'_depend)
allow $1 domain:process signull;
2005-05-23 15:49:03 +00:00
')
define(`domain_signull_all_domains_depend',`
attribute domain;
class process signull;
2005-05-23 15:49:03 +00:00
')
2005-04-14 20:18:17 +00:00
########################################
2005-05-27 20:44:05 +00:00
## <interface name="domain_sigstop_all_domains">
## <description>
## Send a stop signal to all domains.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
#
define(`domain_sigstop_all_domains',`
requires_block_template(`$0'_depend)
allow $1 domain:process sigstop;
2005-05-27 20:44:05 +00:00
')
define(`domain_sigstop_all_domains_depend',`
attribute domain;
class process sigstop;
2005-05-27 20:44:05 +00:00
')
########################################
## <interface name="domain_sigchld_all_domains">
## <description>
## Send a child terminated signal to all domains.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
2005-04-14 20:18:17 +00:00
#
2005-05-27 20:44:05 +00:00
define(`domain_sigchld_all_domains',`
requires_block_template(`$0'_depend)
allow $1 domain:process sigchld;
2005-05-27 20:44:05 +00:00
')
define(`domain_sigchld_all_domains_depend',`
attribute domain;
class process sigchld;
2005-05-27 20:44:05 +00:00
')
########################################
## <interface name="domain_kill_all_domains">
## <description>
## Send a kill signal to all domains.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
2005-04-14 20:18:17 +00:00
#
define(`domain_kill_all_domains',`
requires_block_template(`$0'_depend)
allow $1 domain:process sigkill;
allow $1 self:capability kill;
2005-04-14 20:18:17 +00:00
')
define(`domain_kill_all_domains_depend',`
attribute domain;
class process sigkill;
class capability kill;
2005-04-14 20:18:17 +00:00
')
########################################
## <interface name="domain_read_all_domains_process_state">
## <description>
## Read the process state (/proc/pid) of all domains.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
2005-04-14 20:18:17 +00:00
#
define(`domain_read_all_domains_process_state',`
requires_block_template(`$0'_depend)
2005-06-09 14:50:48 +00:00
allow $1 domain:dir r_dir_perms;
allow $1 domain:lnk_file r_file_perms;
allow $1 domain:file r_file_perms;
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;
2005-04-14 20:18:17 +00:00
')
define(`domain_read_all_domains_process_state_depend',`
attribute domain;
2005-06-09 14:50:48 +00:00
class dir r_dir_perms;
class lnk_file r_file_perms;
class file r_file_perms;
class process { getattr ptrace };
2005-05-26 20:38:45 +00:00
')
########################################
## <interface name="domain_ignore_read_all_domains_process_dirs">
## <description>
## Do not audit attempts to read the process state
## directories of all domains.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
#
define(`domain_ignore_read_all_domains_process_dirs',`
requires_block_template(`$0'_depend)
dontaudit $1 domain:dir r_dir_perms;
2005-05-26 20:38:45 +00:00
')
define(`domain_ignore_read_all_domains_process_dirs_depend',`
attribute domain;
class dir r_dir_perms;
2005-05-26 20:38:45 +00:00
')
########################################
## <interface name="domain_get_all_domains_session_id">
## <description>
## Get the session ID of all domains.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
#
define(`domain_get_all_domains_session_id',`
requires_block_template(`$0'_depend)
allow $1 domain:process getsession;
2005-05-26 20:38:45 +00:00
')
define(`domain_get_all_domains_session_id_depend',`
attribute domain;
class process getsession;
2005-04-14 20:18:17 +00:00
')
2005-05-30 21:17:20 +00:00
########################################
## <interface name="domain_ignore_get_all_domains_udp_socket_attributes">
## <description>
## Do not audit attempts to get the attributes
## of all domains UDP sockets.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
#
define(`domain_ignore_get_all_domains_udp_socket_attributes',`
requires_block_template(`$0'_depend)
dontaudit $1 domain:udp_socket getattr;
2005-05-30 21:17:20 +00:00
')
define(`domain_ignore_get_all_domains_udp_socket_attributes_depend',`
attribute domain;
class udp_socket getattr;
2005-05-30 21:17:20 +00:00
')
########################################
## <interface name="domain_ignore_get_all_domains_tcp_socket_attributes">
## <description>
## Do not audit attempts to get the attributes
## of all domains TCP sockets.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
#
define(`domain_ignore_get_all_domains_tcp_socket_attributes',`
requires_block_template(`$0'_depend)
dontaudit $1 domain:tcp_socket getattr;
2005-05-30 21:17:20 +00:00
')
define(`domain_ignore_get_all_domains_tcp_socket_attributes_depend',`
attribute domain;
class tcp_socket getattr;
2005-05-30 21:17:20 +00:00
')
########################################
## <interface name="domain_ignore_get_all_domains_unix_dgram_socket_attributes">
## <description>
## Do not audit attempts to get the attributes
## of all domains unix datagram sockets.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
#
define(`domain_ignore_get_all_domains_unix_dgram_socket_attributes',`
requires_block_template(`$0'_depend)
dontaudit $1 domain:unix_dgram_socket getattr;
2005-05-30 21:17:20 +00:00
')
define(`domain_ignore_get_all_domains_unix_dgram_socket_attributes_depend',`
attribute domain;
class unix_dgram_socket getattr;
2005-05-30 21:17:20 +00:00
')
########################################
## <interface name="domain_ignore_get_all_domains_pipe_attributes">
## <description>
## Do not audit attempts to get the attributes
## of all domains unnamed pipes.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
#
define(`domain_ignore_get_all_domains_pipe_attributes',`
requires_block_template(`$0'_depend)
dontaudit $1 domain:fifo_file getattr;
2005-05-30 21:17:20 +00:00
')
define(`domain_ignore_get_all_domains_pipe_attributes_depend',`
attribute domain;
class fifo_file getattr;
2005-05-30 21:17:20 +00:00
')
########################################
#
# domain_execute_all_entrypoint_programs(domain)
#
define(`domain_execute_all_entrypoint_programs',`
requires_block_template(`$0'_depend)
2005-06-09 14:50:48 +00:00
can_exec($1,entry_type)
')
define(`domain_execute_all_entrypoint_programs_depend',`
attribute entry_type;
class file { getattr read ioctl lock execute execute_no_trans };
')
2005-05-04 21:44:51 +00:00
########################################
#
# domain_read_all_entrypoint_programs(domain)
#
define(`domain_read_all_entrypoint_programs',`
requires_block_template(`$0'_depend)
2005-06-09 14:50:48 +00:00
allow $1 entry_type:lnk_file r_file_perms;
allow $1 entry_type:file r_file_perms;
2005-05-04 21:44:51 +00:00
')
define(`domain_read_all_entrypoint_programs_depend',`
attribute entry_type;
class file r_file_perms;
2005-06-09 14:50:48 +00:00
class lnk_file r_file_perms;
2005-05-04 21:44:51 +00:00
')
2005-05-23 15:49:03 +00:00
## </module>
2005-06-07 14:43:14 +00:00
#
# These next macros are not interfaces, but actually are
2005-06-08 16:16:41 +00:00
# support macros. Due to the domain_ prefix, they
2005-06-07 14:43:14 +00:00
# are placed in this module.
#
########################################
#
# domain_trans(source_domain,entrypoint_file,target_domain)
#
2005-06-08 13:12:00 +00:00
define(`domain_trans',`
2005-06-07 14:43:14 +00:00
requires_block_template(`$0'_depend)
2005-06-09 14:50:48 +00:00
allow $1 $2:file rx_file_perms;
2005-06-07 14:43:14 +00:00
allow $1 $3:process transition;
dontaudit $1 $3:process { noatsecure siginh rlimitinh };
')
define(`domain_trans_depend',`
2005-06-09 14:50:48 +00:00
class file rx_file_perms;
2005-06-07 14:46:20 +00:00
process { transition noatsecure siginh rlimitinh };
')
2005-06-07 14:43:14 +00:00
########################################
#
# domain_auto_trans(source_domain,entrypoint_file,target_domain)
#
define(`domain_auto_trans',`
domain_trans($1,$2,$3)
type_transition $1 $2:process $3;
')