Chris PeBenito e181fe
# Copyright (C) 2005 Tresys Technology, LLC
Chris PeBenito 1c9f9a
## <module name="domain" layer="system">
Chris PeBenito 1c9f9a
## <summary>Core policy for domains.</summary>
Chris PeBenito e181fe
Chris PeBenito b4cd15
########################################
Chris PeBenito b4cd15
#
Chris PeBenito bd202f
# domain_make_base_domain(domain)
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
define(`domain_make_base_domain',`
Chris PeBenito bd202f
requires_block_template(`$0'_depend)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
# mark as a domain
Chris PeBenito b4cd15
typeattribute $1 domain;
Chris PeBenito b4cd15
Chris PeBenito b4cd15
# allow the domain to read its /proc/pid entries
Chris PeBenito b4cd15
allow $1 self:dir { getattr search read };
Chris PeBenito d490eb
allow $1 self:{ file lnk_file } { getattr read write };
Chris PeBenito b4cd15
Chris PeBenito b4cd15
# allow $1 to create child processes in this domain
Chris PeBenito b4cd15
allow $1 self:process { fork sigchld };
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
define(`domain_make_base_domain_depend',`
Chris PeBenito b4cd15
attribute domain;
Chris PeBenito b4cd15
class dir { getattr search read };
Chris PeBenito d490eb
class file { getattr read write };
Chris PeBenito b4cd15
class lnk_file { getattr read };
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito b4cd15
#
Chris PeBenito bd202f
# domain_make_domain(domain)
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
define(`domain_make_domain',`
Chris PeBenito a9a20d
Chris PeBenito a9a20d
# start with basic domain
Chris PeBenito f1470e
domain_make_base_domain($1)
Chris PeBenito a9a20d
Chris PeBenito a9a20d
# Use trusted objects in /dev
Chris PeBenito a9a20d
devices_use_dev_null($1)
Chris PeBenito a9a20d
devices_use_dev_zero($1)
Chris PeBenito a9a20d
terminal_use_controlling_terminal($1)
Chris PeBenito a9a20d
Chris PeBenito a9a20d
# read the root directory
Chris PeBenito f1470e
files_read_root_dir($1)
Chris PeBenito a9a20d
Chris PeBenito a9a20d
# send init a sigchld
Chris PeBenito f1470e
init_sigchld($1)
Chris PeBenito 6b48fd
Chris PeBenito 6b48fd
# this seems highly questionable:
Chris PeBenito 6b48fd
optional_policy(`rpm.te',`
Chris PeBenito 6b48fd
rpm_use_file_descriptors($1)
Chris PeBenito 6b48fd
rpm_read_pipe($1)
Chris PeBenito 6b48fd
')
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito b4cd15
#
Chris PeBenito bd202f
# domain_make_entrypoint_file(domain,entrypointfile)
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
define(`domain_make_entrypoint_file',`
Chris PeBenito bd202f
requires_block_template(`$0'_depend)
Chris PeBenito b4cd15
allow $1 $2:file entrypoint;
Chris PeBenito f1470e
files_make_file($2)
Chris PeBenito efd8ed
typeattribute $2 entry_type;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
define(`domain_make_entrypoint_file_depend',`
Chris PeBenito 960373
attribute entry_type;
Chris PeBenito b4cd15
class file entrypoint;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito b4cd15
#
Chris PeBenito bd202f
# domain_make_file_descriptors_widely_inheritable(domain)
Chris PeBenito 8a0da1
#
Chris PeBenito 8a0da1
define(`domain_make_file_descriptors_widely_inheritable',`
Chris PeBenito bd202f
requires_block_template(`$0'_depend)
Chris PeBenito 8a0da1
typeattribute $1 privfd;
Chris PeBenito 8a0da1
')
Chris PeBenito 8a0da1
Chris PeBenito 8a0da1
define(`domain_make_file_descriptors_widely_inheritable_depend',`
Chris PeBenito 8a0da1
attribute privfd;
Chris PeBenito 8a0da1
')
Chris PeBenito 8a0da1
Chris PeBenito 8a0da1
########################################
Chris PeBenito 8a0da1
#
Chris PeBenito bd202f
# domain_use_widely_inheritable_file_descriptors(domain)
Chris PeBenito a2d824
#
Chris PeBenito a2d824
define(`domain_use_widely_inheritable_file_descriptors',`
Chris PeBenito bd202f
requires_block_template(`$0'_depend)
Chris PeBenito a2d824
allow $1 privfd:fd use;
Chris PeBenito a2d824
')
Chris PeBenito a2d824
Chris PeBenito a2d824
define(`domain_use_widely_inheritable_file_descriptors_depend',`
Chris PeBenito a2d824
attribute privfd;
Chris PeBenito a2d824
class fd use;
Chris PeBenito a2d824
')
Chris PeBenito a2d824
Chris PeBenito a2d824
########################################
Chris PeBenito a2d824
#
Chris PeBenito bd202f
# domain_ignore_use_widely_inheritable_file_descriptors(domain)
Chris PeBenito 3ce6cb
#
Chris PeBenito 3ce6cb
define(`domain_ignore_use_widely_inheritable_file_descriptors',`
Chris PeBenito bd202f
requires_block_template(`$0'_depend)
Chris PeBenito 3ce6cb
dontaudit $1 privfd:fd use;
Chris PeBenito 3ce6cb
')
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
define(`domain_ignore_use_widely_inheritable_file_descriptors_depend',`
Chris PeBenito 3ce6cb
attribute privfd;
Chris PeBenito 3ce6cb
class fd use;
Chris PeBenito 3ce6cb
')
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
########################################
Chris PeBenito 3ce6cb
#
Chris PeBenito 5817e3
# domain_set_all_domains_priorities(domain)
Chris PeBenito 5817e3
#
Chris PeBenito 5817e3
define(`domain_set_all_domains_priorities',`
Chris PeBenito 5817e3
requires_block_template(`$0'_depend)
Chris PeBenito 5817e3
allow $1 domain:process setsched;
Chris PeBenito 5817e3
')
Chris PeBenito 5817e3
Chris PeBenito 5817e3
define(`domain_set_all_domains_priorities_depend',`
Chris PeBenito 5817e3
attribute domain;
Chris PeBenito 5817e3
class process setsched;
Chris PeBenito 5817e3
')
Chris PeBenito 5817e3
Chris PeBenito 5817e3
########################################
Chris PeBenito c6fd1f
## <interface name="domain_signal_all_domains">
Chris PeBenito c6fd1f
##	<description>
Chris PeBenito c6fd1f
##		Send general signals to all domains.
Chris PeBenito c6fd1f
##	</description>
Chris PeBenito c6fd1f
##	<parameter name="domain">
Chris PeBenito c6fd1f
##		The type of the process performing this action.
Chris PeBenito c6fd1f
##	</parameter>
Chris PeBenito c6fd1f
##	<infoflow type="write" weight="1"/>
Chris PeBenito c6fd1f
## </interface>
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
define(`domain_signal_all_domains',`
Chris PeBenito bd202f
requires_block_template(`$0'_depend)
Chris PeBenito b4cd15
allow $1 domain:process signal;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
define(`domain_signal_all_domains_depend',`
Chris PeBenito b4cd15
attribute domain;
Chris PeBenito b4cd15
class process signal;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito 1c9f9a
## <interface name="domain_signull_all_domains">
Chris PeBenito 1c9f9a
##	<description>
Chris PeBenito 1c9f9a
##		Send a null signal to all domains.
Chris PeBenito 1c9f9a
##	</description>
Chris PeBenito 1c9f9a
##	<parameter name="domain">
Chris PeBenito 1c9f9a
##		The type of the process performing this action.
Chris PeBenito 1c9f9a
##	</parameter>
Chris PeBenito 1c9f9a
##	<infoflow type="write" weight="1"/>
Chris PeBenito 1c9f9a
## </interface>
Chris PeBenito 1c9f9a
#
Chris PeBenito 1c9f9a
define(`domain_signull_all_domains',`
Chris PeBenito 1c9f9a
requires_block_template(`$0'_depend)
Chris PeBenito 1c9f9a
allow $1 domain:process signull;
Chris PeBenito 1c9f9a
')
Chris PeBenito 1c9f9a
Chris PeBenito 1c9f9a
define(`domain_signull_all_domains_depend',`
Chris PeBenito 1c9f9a
attribute domain;
Chris PeBenito 1c9f9a
class process signull;
Chris PeBenito 1c9f9a
')
Chris PeBenito 1c9f9a
Chris PeBenito 1c9f9a
########################################
Chris PeBenito c6fd1f
## <interface name="domain_sigstop_all_domains">
Chris PeBenito c6fd1f
##	<description>
Chris PeBenito c6fd1f
##		Send a stop signal to all domains.
Chris PeBenito c6fd1f
##	</description>
Chris PeBenito c6fd1f
##	<parameter name="domain">
Chris PeBenito c6fd1f
##		The type of the process performing this action.
Chris PeBenito c6fd1f
##	</parameter>
Chris PeBenito c6fd1f
##	<infoflow type="write" weight="1"/>
Chris PeBenito c6fd1f
## </interface>
Chris PeBenito c6fd1f
#
Chris PeBenito c6fd1f
define(`domain_sigstop_all_domains',`
Chris PeBenito c6fd1f
requires_block_template(`$0'_depend)
Chris PeBenito c6fd1f
allow $1 domain:process sigstop;
Chris PeBenito c6fd1f
')
Chris PeBenito c6fd1f
Chris PeBenito c6fd1f
define(`domain_sigstop_all_domains_depend',`
Chris PeBenito c6fd1f
attribute domain;
Chris PeBenito c6fd1f
class process sigstop;
Chris PeBenito c6fd1f
')
Chris PeBenito c6fd1f
Chris PeBenito c6fd1f
########################################
Chris PeBenito c6fd1f
## <interface name="domain_sigchld_all_domains">
Chris PeBenito c6fd1f
##	<description>
Chris PeBenito c6fd1f
##		Send a child terminated signal to all domains.
Chris PeBenito c6fd1f
##	</description>
Chris PeBenito c6fd1f
##	<parameter name="domain">
Chris PeBenito c6fd1f
##		The type of the process performing this action.
Chris PeBenito c6fd1f
##	</parameter>
Chris PeBenito c6fd1f
##	<infoflow type="write" weight="1"/>
Chris PeBenito c6fd1f
## </interface>
Chris PeBenito b4cd15
#
Chris PeBenito c6fd1f
define(`domain_sigchld_all_domains',`
Chris PeBenito c6fd1f
requires_block_template(`$0'_depend)
Chris PeBenito c6fd1f
allow $1 domain:process sigchld;
Chris PeBenito c6fd1f
')
Chris PeBenito c6fd1f
Chris PeBenito c6fd1f
define(`domain_sigchld_all_domains_depend',`
Chris PeBenito c6fd1f
attribute domain;
Chris PeBenito c6fd1f
class process sigchld;
Chris PeBenito c6fd1f
')
Chris PeBenito c6fd1f
Chris PeBenito c6fd1f
########################################
Chris PeBenito c6fd1f
## <interface name="domain_kill_all_domains">
Chris PeBenito c6fd1f
##	<description>
Chris PeBenito c6fd1f
##		Send a kill signal to all domains.
Chris PeBenito c6fd1f
##	</description>
Chris PeBenito c6fd1f
##	<parameter name="domain">
Chris PeBenito c6fd1f
##		The type of the process performing this action.
Chris PeBenito c6fd1f
##	</parameter>
Chris PeBenito c6fd1f
##	<infoflow type="write" weight="1"/>
Chris PeBenito c6fd1f
## </interface>
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
define(`domain_kill_all_domains',`
Chris PeBenito bd202f
requires_block_template(`$0'_depend)
Chris PeBenito b4cd15
allow $1 domain:process sigkill;
Chris PeBenito b4cd15
allow $1 self:capability kill;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
define(`domain_kill_all_domains_depend',`
Chris PeBenito b4cd15
attribute domain;
Chris PeBenito b4cd15
class process sigkill;
Chris PeBenito b4cd15
class capability kill;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito daa0e0
## <interface name="domain_read_all_domains_process_state">
Chris PeBenito daa0e0
##	<description>
Chris PeBenito daa0e0
##		Read the process state (/proc/pid) of all domains.
Chris PeBenito daa0e0
##	</description>
Chris PeBenito daa0e0
##	<parameter name="domain">
Chris PeBenito daa0e0
##		The type of the process performing this action.
Chris PeBenito daa0e0
##	</parameter>
Chris PeBenito daa0e0
##	<infoflow type="read" weight="10"/>
Chris PeBenito daa0e0
## </interface>
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
define(`domain_read_all_domains_process_state',`
Chris PeBenito bd202f
requires_block_template(`$0'_depend)
Chris PeBenito b4cd15
allow $1 domain:dir { getattr search read };
Chris PeBenito b4cd15
allow $1 domain:lnk_file { getattr read };
Chris PeBenito b4cd15
allow $1 domain:file { getattr read };
Chris PeBenito d490eb
allow $1 domain:process getattr;
Chris PeBenito d490eb
# We need to suppress this denial because procps tries to access
Chris PeBenito d490eb
# /proc/pid/environ and this now triggers a ptrace check in recent kernels
Chris PeBenito d490eb
# (2.4 and 2.6).  Might want to change procps to not do this, or only if
Chris PeBenito d490eb
# running in a privileged domain.
Chris PeBenito d490eb
dontaudit $1 domain:process ptrace;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
define(`domain_read_all_domains_process_state_depend',`
Chris PeBenito b4cd15
attribute domain;
Chris PeBenito b4cd15
class dir { getattr search read };
Chris PeBenito b4cd15
class lnk_file { getattr read };
Chris PeBenito b4cd15
class file { getattr read };
Chris PeBenito d490eb
class process { getattr ptrace };
Chris PeBenito d490eb
')
Chris PeBenito d490eb
Chris PeBenito d490eb
########################################
Chris PeBenito d490eb
## <interface name="domain_ignore_read_all_domains_process_dirs">
Chris PeBenito d490eb
##	<description>
Chris PeBenito d490eb
##		Do not audit attempts to read the process state
Chris PeBenito d490eb
##		directories of all domains.
Chris PeBenito d490eb
##	</description>
Chris PeBenito d490eb
##	<parameter name="domain">
Chris PeBenito d490eb
##		The type of the process performing this action.
Chris PeBenito d490eb
##	</parameter>
Chris PeBenito d490eb
##	<infoflow type="none"/>
Chris PeBenito d490eb
## </interface>
Chris PeBenito d490eb
#
Chris PeBenito d490eb
define(`domain_ignore_read_all_domains_process_dirs',`
Chris PeBenito d490eb
requires_block_template(`$0'_depend)
Chris PeBenito d490eb
dontaudit $1 domain:dir { getattr search read };
Chris PeBenito d490eb
')
Chris PeBenito d490eb
Chris PeBenito d490eb
define(`domain_ignore_read_all_domains_process_dirs_depend',`
Chris PeBenito d490eb
attribute domain;
Chris PeBenito d490eb
class dir { getattr search read };
Chris PeBenito d490eb
')
Chris PeBenito d490eb
Chris PeBenito d490eb
Chris PeBenito d490eb
########################################
Chris PeBenito d490eb
## <interface name="domain_get_all_domains_session_id">
Chris PeBenito d490eb
##	<description>
Chris PeBenito d490eb
##		Get the session ID of all domains.
Chris PeBenito d490eb
##	</description>
Chris PeBenito d490eb
##	<parameter name="domain">
Chris PeBenito d490eb
##		The type of the process performing this action.
Chris PeBenito d490eb
##	</parameter>
Chris PeBenito d490eb
##	<infoflow type="read" weight="1"/>
Chris PeBenito d490eb
## </interface>
Chris PeBenito d490eb
#
Chris PeBenito d490eb
define(`domain_get_all_domains_session_id',`
Chris PeBenito d490eb
requires_block_template(`$0'_depend)
Chris PeBenito d490eb
allow $1 domain:process getsession;
Chris PeBenito d490eb
')
Chris PeBenito d490eb
Chris PeBenito d490eb
define(`domain_get_all_domains_session_id_depend',`
Chris PeBenito d490eb
attribute domain;
Chris PeBenito d490eb
class process getsession;
Chris PeBenito b4cd15
')
Chris PeBenito 960373
Chris PeBenito 960373
########################################
Chris PeBenito 960373
#
Chris PeBenito bd202f
# domain_execute_all_entrypoint_programs(domain)
Chris PeBenito 960373
#
Chris PeBenito 960373
define(`domain_execute_all_entrypoint_programs',`
Chris PeBenito bd202f
requires_block_template(`$0'_depend)
Chris PeBenito 960373
allow $1 entry_type:file { getattr read execute execute_no_trans };
Chris PeBenito 960373
')
Chris PeBenito 960373
Chris PeBenito 960373
define(`domain_execute_all_entrypoint_programs_depend',`
Chris PeBenito 960373
attribute entry_type;
Chris PeBenito 960373
class file { getattr read execute execute_no_trans };
Chris PeBenito 960373
')
Chris PeBenito f1470e
Chris PeBenito f1470e
########################################
Chris PeBenito f1470e
#
Chris PeBenito f1470e
# domain_read_all_entrypoint_programs(domain)
Chris PeBenito f1470e
#
Chris PeBenito f1470e
define(`domain_read_all_entrypoint_programs',`
Chris PeBenito f1470e
requires_block_template(`$0'_depend)
Chris PeBenito f1470e
allow $1 entry_type:{ file lnk_file } { getattr read };
Chris PeBenito f1470e
')
Chris PeBenito f1470e
Chris PeBenito f1470e
define(`domain_read_all_entrypoint_programs_depend',`
Chris PeBenito f1470e
attribute entry_type;
Chris PeBenito f1470e
class file { getattr read };
Chris PeBenito f1470e
')
Chris PeBenito 1c9f9a
Chris PeBenito 1c9f9a
## </module>