## <module name="domain" layer="system">
## <summary>Core policy for domains.</summary>
########################################
#
# domain_base_domain_type(domain)
#
define(`domain_base_domain_type',`
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 r_dir_perms;
allow $1 self:{ file lnk_file } rw_file_perms;
# allow $1 to create child processes in this domain
allow $1 self:process { fork sigchld };
')
define(`domain_base_domain_type_depend',`
attribute domain;
class dir r_dir_perms;
class file rw_file_perms;
class lnk_file r_file_perms;
')
########################################
#
# domain_type(domain)
#
define(`domain_type',`
# start with basic domain
domain_base_domain_type($1)
# Use trusted objects in /dev
dev_rw_null_dev($1)
dev_rw_zero_dev($1)
term_use_controlling_term($1)
# read the root directory
files_list_root($1)
# send init a sigchld
init_sigchld($1)
# this seems highly questionable:
optional_policy(`rpm.te',`
rpm_use_fd($1)
rpm_read_pipe($1)
')
')
########################################
#
# domain_entry_file(domain,entrypointfile)
#
define(`domain_entry_file',`
requires_block_template(`$0'_depend)
files_file_type($2)
allow $1 $2:file entrypoint;
typeattribute $2 entry_type;
')
define(`domain_entry_file_depend',`
attribute entry_type;
class file entrypoint;
')
########################################
#
# domain_wide_inherit_fd(domain)
#
define(`domain_wide_inherit_fd',`
requires_block_template(`$0'_depend)
typeattribute $1 privfd;
')
define(`domain_wide_inherit_fd_depend',`
attribute privfd;
')
########################################
#
# domain_use_wide_inherit_fd(domain)
#
define(`domain_use_wide_inherit_fd',`
requires_block_template(`$0'_depend)
allow $1 privfd:fd use;
')
define(`domain_use_wide_inherit_fd_depend',`
attribute privfd;
class fd use;
')
########################################
#
# domain_dontaudit_use_wide_inherit_fd(domain)
#
define(`domain_dontaudit_use_wide_inherit_fd',`
requires_block_template(`$0'_depend)
dontaudit $1 privfd:fd use;
')
define(`domain_dontaudit_use_wide_inherit_fd_depend',`
attribute privfd;
class fd use;
')
########################################
#
# domain_setpriority_all_domains(domain)
#
define(`domain_setpriority_all_domains',`
requires_block_template(`$0'_depend)
allow $1 domain:process setsched;
')
define(`domain_setpriority_all_domains_depend',`
attribute domain;
class process setsched;
')
########################################
## <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>
#
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;
')
########################################
## <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;
')
define(`domain_signull_all_domains_depend',`
attribute domain;
class process signull;
')
########################################
## <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;
')
define(`domain_sigstop_all_domains_depend',`
attribute domain;
class process sigstop;
')
########################################
## <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>
#
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;
')
########################################
## <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>
#
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;
')
########################################
## <interface name="domain_read_all_domains_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>
#
define(`domain_read_all_domains_state',`
requires_block_template(`$0'_depend)
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;
')
define(`domain_read_all_domains_state_depend',`
attribute domain;
class dir r_dir_perms;
class lnk_file r_file_perms;
class file r_file_perms;
class process { getattr ptrace };
')
########################################
## <interface name="domain_dontaudit_list_all_domains_proc">
## <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_dontaudit_list_all_domains_proc',`
requires_block_template(`$0'_depend)
dontaudit $1 domain:dir r_dir_perms;
')
define(`domain_dontaudit_list_all_domains_proc_depend',`
attribute domain;
class dir r_dir_perms;
')
########################################
## <interface name="domain_getsession_all_domains">
## <description>
## Get the session ID of all domains.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## </interface>
#
define(`domain_getsession_all_domains',`
requires_block_template(`$0'_depend)
allow $1 domain:process getsession;
')
define(`domain_getsession_all_domains_depend',`
attribute domain;
class process getsession;
')
########################################
## <interface name="domain_dontaudit_getattr_all_udp_sockets">
## <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_dontaudit_getattr_all_udp_sockets',`
requires_block_template(`$0'_depend)
dontaudit $1 domain:udp_socket getattr;
')
define(`domain_dontaudit_getattr_all_udp_sockets_depend',`
attribute domain;
class udp_socket getattr;
')
########################################
## <interface name="domain_dontaudit_getattr_all_tcp_sockets">
## <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_dontaudit_getattr_all_tcp_sockets',`
requires_block_template(`$0'_depend)
dontaudit $1 domain:tcp_socket getattr;
')
define(`domain_dontaudit_getattr_all_tcp_sockets_depend',`
attribute domain;
class tcp_socket getattr;
')
########################################
## <interface name="domain_dontaudit_getattr_all_unix_dgram_sockets">
## <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_dontaudit_getattr_all_unix_dgram_sockets',`
requires_block_template(`$0'_depend)
dontaudit $1 domain:unix_dgram_socket getattr;
')
define(`domain_dontaudit_getattr_all_unix_dgram_sockets_depend',`
attribute domain;
class unix_dgram_socket getattr;
')
########################################
## <interface name="domain_dontaudit_getattr_all_unnamed_pipes">
## <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_dontaudit_getattr_all_unnamed_pipes',`
requires_block_template(`$0'_depend)
dontaudit $1 domain:fifo_file getattr;
')
define(`domain_dontaudit_getattr_all_unnamed_pipes_depend',`
attribute domain;
class fifo_file getattr;
')
########################################
#
# domain_exec_all_entry_files(domain)
#
define(`domain_exec_all_entry_files',`
requires_block_template(`$0'_depend)
can_exec($1,entry_type)
')
define(`domain_exec_all_entry_files_depend',`
attribute entry_type;
class file { getattr read ioctl lock execute execute_no_trans };
')
########################################
#
# domain_read_all_entry_files(domain)
#
define(`domain_read_all_entry_files',`
requires_block_template(`$0'_depend)
allow $1 entry_type:lnk_file r_file_perms;
allow $1 entry_type:file r_file_perms;
')
define(`domain_read_all_entry_files_depend',`
attribute entry_type;
class file r_file_perms;
class lnk_file r_file_perms;
')
## </module>
#
# These next macros are not interfaces, but actually are
# support macros. Due to the domain_ prefix, they
# are placed in this module.
#
########################################
#
# domain_trans(source_domain,entrypoint_file,target_domain)
#
define(`domain_trans',`
requires_block_template(`$0'_depend)
allow $1 $2:file rx_file_perms;
allow $1 $3:process transition;
dontaudit $1 $3:process { noatsecure siginh rlimitinh };
')
define(`domain_trans_depend',`
class file rx_file_perms;
process { transition noatsecure siginh rlimitinh };
')
########################################
#
# domain_auto_trans(source_domain,entrypoint_file,target_domain)
#
define(`domain_auto_trans',`
domain_trans($1,$2,$3)
type_transition $1 $2:process $3;
')