Chris PeBenito e32d52
## <summary>System initialization programs (init and init scripts).</summary>
Chris PeBenito e181fe
Chris PeBenito b4cd15
########################################
Chris PeBenito e5f806
## <summary>
Chris PeBenito e5f806
##	Create a domain which can be started by init.
Chris PeBenito e5f806
## </summary>
Chris PeBenito e5f806
## <param name="domain">
Chris PeBenito e5f806
##	Type to be used as a domain.
Chris PeBenito e5f806
## </param>
Chris PeBenito e5f806
## <param name="entry_point">
Chris PeBenito e5f806
##	Type of the program to be used as an entry point to this domain.
Chris PeBenito e5f806
## </param>
Chris PeBenito ff3138
#
Chris PeBenito 199895
interface(`init_domain',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type init_t;
Chris PeBenito 139520
		role system_r;
Chris PeBenito 139520
	')
Chris PeBenito 3b857e
Chris PeBenito c9428d
	domain_type($1)
Chris PeBenito c9428d
	domain_entry_file($1,$2)
Chris PeBenito 3b857e
Chris PeBenito 3b857e
	role system_r types $1;
Chris PeBenito 3b857e
Chris PeBenito 139520
	domain_auto_trans(init_t,$2,$1)
Chris PeBenito 3b857e
Chris PeBenito 3b857e
	allow $1 init_t:fd use;
Chris PeBenito 3b857e
	allow init_t $1:fd use;
Chris PeBenito 3b857e
	allow $1 init_t:fifo_file rw_file_perms;
Chris PeBenito 3b857e
	allow $1 init_t:process sigchld;
Chris PeBenito ff3138
')
Chris PeBenito ff3138
Chris PeBenito ff3138
########################################
Chris PeBenito e5f806
## <summary>
Chris PeBenito e5f806
##	Create a domain for long running processes
Chris PeBenito e5f806
##	(daemons) which can be started by init scripts.
Chris PeBenito e5f806
## </summary>
Chris PeBenito e5f806
## <param name="domain">
Chris PeBenito e5f806
##	Type to be used as a domain.
Chris PeBenito e5f806
## </param>
Chris PeBenito e5f806
## <param name="entry_point">
Chris PeBenito e5f806
##	Type of the program to be used as an entry point to this domain.
Chris PeBenito e5f806
## </param>
Chris PeBenito ff3138
#
Chris PeBenito 199895
interface(`init_daemon_domain',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito e5f806
		attribute direct_run_init, direct_init, direct_init_entry;
Chris PeBenito 139520
		type initrc_t;
Chris PeBenito 139520
		role system_r;
Chris PeBenito 139520
	')
Chris PeBenito 3b857e
Chris PeBenito c9428d
	domain_type($1)
Chris PeBenito c9428d
	domain_entry_file($1,$2)
Chris PeBenito 3b857e
Chris PeBenito 3b857e
	role system_r types $1;
Chris PeBenito 3b857e
Chris PeBenito e5f806
	ifdef(`direct_sysadm_daemon',`
Chris PeBenito e5f806
		domain_auto_trans(direct_run_init,$2,$1)
Chris PeBenito e5f806
Chris PeBenito e5f806
		allow direct_run_init $1:fd use;
Chris PeBenito e5f806
		allow direct_run_init $1:process { noatsecure siginh rlimitinh };
Chris PeBenito e5f806
		allow $1 direct_run_init:fd use;
Chris PeBenito e5f806
		allow $1 direct_run_init:fifo_file rw_file_perms;
Chris PeBenito e5f806
		allow $1 direct_run_init:process sigchld;
Chris PeBenito e5f806
Chris PeBenito e5f806
		typeattribute $1 direct_init;
Chris PeBenito e5f806
		typeattribute $2 direct_init_entry;
Chris PeBenito e5f806
	')
Chris PeBenito e5f806
Chris PeBenito b03f96
	ifdef(`targeted_policy',`
Chris PeBenito b03f96
		# this regex is a hack, since it assumes there is a
Chris PeBenito b03f96
		# _t at the end of the domain type.  If there is no _t
Chris PeBenito b03f96
		# at the end of the type, it returns empty!
Chris PeBenito 0500e0
		ifdef(`__define_'regexp($1, `\(\w+\)_t', `\1_disable_trans'),`',`
Chris PeBenito 0500e0
			bool regexp($1, `\(\w+\)_t', `\1_disable_trans') false;
Chris PeBenito 0500e0
			define(`__define_'regexp($1, `\(\w+\)_t', `\1_disable_trans'))
Chris PeBenito 0500e0
		')
Chris PeBenito 2db2c7
		if(regexp($1, `\(\w+\)_t', `\1_disable_trans') ) {
Chris PeBenito 2db2c7
			can_exec(initrc_t,$2)
Chris PeBenito 2db2c7
			can_exec(direct_run_init,$2)
Chris PeBenito 2db2c7
		} else {
Chris PeBenito b03f96
			domain_auto_trans(initrc_t,$2,$1)
Chris PeBenito b03f96
			allow initrc_t $1:fd use;
Chris PeBenito b03f96
			allow $1 initrc_t:fd use;
Chris PeBenito b03f96
			allow $1 initrc_t:fifo_file rw_file_perms;
Chris PeBenito b03f96
			allow $1 initrc_t:process sigchld;
Chris PeBenito 2db2c7
			allow initrc_t $1:process { noatsecure siginh rlimitinh };
Chris PeBenito 69dcd6
Chris PeBenito 69dcd6
			# make sediff happy
Chris PeBenito 69dcd6
			allow $1 $2:file { rx_file_perms entrypoint };
Chris PeBenito b03f96
		}
Chris PeBenito b03f96
	',`
Chris PeBenito b03f96
		domain_auto_trans(initrc_t,$2,$1)
Chris PeBenito b03f96
		allow initrc_t $1:fd use;
Chris PeBenito b03f96
		allow $1 initrc_t:fd use;
Chris PeBenito b03f96
		allow $1 initrc_t:fifo_file rw_file_perms;
Chris PeBenito b03f96
		allow $1 initrc_t:process sigchld;
Chris PeBenito 1f8a8b
		dontaudit initrc_t $1:process { noatsecure siginh rlimitinh };
Chris PeBenito 69dcd6
Chris PeBenito 69dcd6
		# make sediff happy
Chris PeBenito 69dcd6
		allow $1 $2:file { rx_file_perms entrypoint };
Chris PeBenito b03f96
	')
Chris PeBenito b03f96
Chris PeBenito 132880
	optional_policy(`nscd',`
Chris PeBenito 98a8ea
		nscd_use_socket($1)
Chris PeBenito 98a8ea
	')
Chris PeBenito ff3138
')
Chris PeBenito ff3138
Chris PeBenito ff3138
########################################
Chris PeBenito e5f806
## <summary>
Chris PeBenito e5f806
##	Create a domain for short running processes
Chris PeBenito e5f806
##	which can be started by init scripts.
Chris PeBenito e5f806
## </summary>
Chris PeBenito e5f806
## <param name="domain">
Chris PeBenito e5f806
##	Type to be used as a domain.
Chris PeBenito e5f806
## </param>
Chris PeBenito e5f806
## <param name="entry_point">
Chris PeBenito e5f806
##	Type of the program to be used as an entry point to this domain.
Chris PeBenito e5f806
## </param>
Chris PeBenito ff3138
#
Chris PeBenito 199895
interface(`init_system_domain',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_t;
Chris PeBenito 139520
		role system_r;
Chris PeBenito 139520
	')
Chris PeBenito d115b2
Chris PeBenito c9428d
	domain_type($1)
Chris PeBenito c9428d
	domain_entry_file($1,$2)
Chris PeBenito d115b2
Chris PeBenito d115b2
	role system_r types $1;
Chris PeBenito d115b2
Chris PeBenito 139520
	domain_auto_trans(initrc_t,$2,$1)
Chris PeBenito d115b2
Chris PeBenito d115b2
	allow initrc_t $1:fd use;
Chris PeBenito d115b2
	allow $1 initrc_t:fd use;
Chris PeBenito d115b2
	allow $1 initrc_t:fifo_file rw_file_perms;
Chris PeBenito d115b2
	allow $1 initrc_t:process sigchld;
Chris PeBenito ff3138
')
Chris PeBenito ff3138
Chris PeBenito ff3138
########################################
Chris PeBenito ff3138
#
Chris PeBenito c9428d
# init_domtrans(domain)
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`init_domtrans',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type init_t, init_exec_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 139520
	domain_auto_trans($1,init_exec_t,init_t)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 init_t:fd use;
Chris PeBenito 0c73cd
	allow init_t $1:fd use;
Chris PeBenito 0c73cd
	allow init_t $1:fifo_file rw_file_perms;
Chris PeBenito 0c73cd
	allow init_t $1:process sigchld;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito 605ba2
## <summary>
Chris PeBenito 605ba2
##	Execute the init program in the caller domain.
Chris PeBenito 605ba2
## </summary>
Chris PeBenito 605ba2
## <param name="domain">
Chris PeBenito 605ba2
##	Domain allowed access.
Chris PeBenito 605ba2
## </param>
Chris PeBenito 605ba2
#
Chris PeBenito 605ba2
interface(`init_exec',`
Chris PeBenito 605ba2
	gen_require(`
Chris PeBenito 605ba2
		type init_exec_t;
Chris PeBenito 605ba2
	')
Chris PeBenito 605ba2
Chris PeBenito 605ba2
	corecmd_search_sbin($1)
Chris PeBenito 605ba2
	can_exec($1,init_exec_t)
Chris PeBenito 605ba2
')
Chris PeBenito 605ba2
Chris PeBenito 605ba2
########################################
Chris PeBenito b4cd15
#
Chris PeBenito 5d7e8b
# init_get_process_group(domain)
Chris PeBenito 5d7e8b
#
Chris PeBenito 199895
interface(`init_get_process_group',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type init_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 init_t:process getpgid;
Chris PeBenito 5d7e8b
')
Chris PeBenito 5d7e8b
Chris PeBenito 5d7e8b
########################################
Chris PeBenito 5d7e8b
#
Chris PeBenito c9428d
# init_getattr_initctl(domain)
Chris PeBenito a2d824
#
Chris PeBenito 199895
interface(`init_getattr_initctl',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initctl_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 initctl_t:fifo_file getattr;
Chris PeBenito a2d824
')
Chris PeBenito a2d824
Chris PeBenito a2d824
########################################
Chris PeBenito a2d824
#
Chris PeBenito c9428d
# init_dontaudit_getattr_initctl(domain)
Chris PeBenito d490eb
#
Chris PeBenito 199895
interface(`init_dontaudit_getattr_initctl',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initctl_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	dontaudit $1 initctl_t:fifo_file getattr;
Chris PeBenito d490eb
')
Chris PeBenito d490eb
Chris PeBenito d490eb
########################################
Chris PeBenito d490eb
#
Chris PeBenito 783b38
# init_write_initctl(domain)
Chris PeBenito 783b38
#
Chris PeBenito 783b38
interface(`init_write_initctl',`
Chris PeBenito 783b38
	gen_require(`
Chris PeBenito 783b38
		type initctl_t;
Chris PeBenito 783b38
	')
Chris PeBenito 783b38
Chris PeBenito 783b38
	dev_list_all_dev_nodes($1)
Chris PeBenito 783b38
	allow $1 initctl_t:fifo_file write;
Chris PeBenito 783b38
')
Chris PeBenito 783b38
Chris PeBenito 783b38
########################################
Chris PeBenito 783b38
#
Chris PeBenito c9428d
# init_use_initctl(domain)
Chris PeBenito d0b6ab
#
Chris PeBenito 199895
interface(`init_use_initctl',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initctl_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Karl MacMillan f0c985
	dev_list_all_dev_nodes($1)
Chris PeBenito dd8229
	allow $1 initctl_t:fifo_file rw_file_perms;
Chris PeBenito d0b6ab
')
Chris PeBenito d0b6ab
Chris PeBenito d0b6ab
########################################
Chris PeBenito d0b6ab
#
Chris PeBenito c9428d
# init_dontaudit_use_initctl(domain)
Chris PeBenito d0b6ab
#
Chris PeBenito 199895
interface(`init_dontaudit_use_initctl',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initctl_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	dontaudit $1 initctl_t:fifo_file { read write };
Chris PeBenito d0b6ab
')
Chris PeBenito d0b6ab
Chris PeBenito d0b6ab
########################################
Chris PeBenito 6e6156
## <summary>
Chris PeBenito 6e6156
##	Send init a null signal.
Chris PeBenito 6e6156
## </summary>
Chris PeBenito 6e6156
## <param name="domain">
Chris PeBenito 6e6156
##	Domain allowed access.
Chris PeBenito 6e6156
## </param>
Chris PeBenito d0b6ab
#
Chris PeBenito 6e6156
interface(`init_signull',`
Chris PeBenito 6e6156
	gen_require(`
Chris PeBenito 6e6156
		type init_t;
Chris PeBenito 6e6156
	')
Chris PeBenito 6e6156
Chris PeBenito 6e6156
	allow $1 init_t:process signull;
Chris PeBenito 6e6156
')
Chris PeBenito 6e6156
Chris PeBenito 6e6156
########################################
Chris PeBenito 6e6156
## <summary>
Chris PeBenito 6e6156
##	Send init a SIGCHLD signal.
Chris PeBenito 6e6156
## </summary>
Chris PeBenito 6e6156
## <param name="domain">
Chris PeBenito 6e6156
##	Domain allowed access.
Chris PeBenito 6e6156
## </param>
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`init_sigchld',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type init_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 init_t:process sigchld;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito b4cd15
#
Chris PeBenito c9428d
# init_use_fd(domain)
Chris PeBenito 889c9a
#
Chris PeBenito 199895
interface(`init_use_fd',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type init_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 init_t:fd use;
Chris PeBenito 889c9a
')
Chris PeBenito 889c9a
Chris PeBenito 889c9a
########################################
Chris PeBenito 889c9a
#
Chris PeBenito c9428d
# init_dontaudit_use_fd(domain)
Chris PeBenito 07efe9
#
Chris PeBenito 199895
interface(`init_dontaudit_use_fd',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type init_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	dontaudit $1 init_t:fd use;
Chris PeBenito 07efe9
')
Chris PeBenito 07efe9
Chris PeBenito 07efe9
########################################
Chris PeBenito eb3cb6
## <summary>
Chris PeBenito eb3cb6
##	Send UDP network traffic to init.
Chris PeBenito eb3cb6
## </summary>
Chris PeBenito eb3cb6
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito eb3cb6
## </param>
Chris PeBenito eb3cb6
#
Chris PeBenito eb3cb6
interface(`init_udp_sendto',`
Chris PeBenito eb3cb6
	gen_require(`
Chris PeBenito eb3cb6
		type init_t;
Chris PeBenito eb3cb6
	')
Chris PeBenito eb3cb6
Chris PeBenito eb3cb6
	allow $1 init_t:udp_socket sendto;
Chris PeBenito eb3cb6
	allow init_t $1:udp_socket recvfrom;
Chris PeBenito eb3cb6
')
Chris PeBenito eb3cb6
Chris PeBenito eb3cb6
########################################
Chris PeBenito 07efe9
#
Chris PeBenito c9428d
# init_domtrans_script(domain)
Chris PeBenito b4cd15
#
Chris PeBenito 199895
interface(`init_domtrans_script',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_t, initrc_exec_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 139520
	files_list_etc($1)
Chris PeBenito 139520
	domain_auto_trans($1,initrc_exec_t,initrc_t)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 initrc_t:fd use;
Chris PeBenito 0c73cd
	allow initrc_t $1:fd use;
Chris PeBenito 0c73cd
	allow initrc_t $1:fifo_file rw_file_perms;
Chris PeBenito 0c73cd
	allow initrc_t $1:process sigchld;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito f7ebea
## <summary>
Chris PeBenito e5f806
##	Start and stop daemon programs directly.
Chris PeBenito f7ebea
## </summary>
Chris PeBenito 57a96c
## <desc>
Chris PeBenito 57a96c
##	

Chris PeBenito 57a96c
##	Start and stop daemon programs directly
Chris PeBenito 57a96c
##	in the traditional "/etc/init.d/daemon start"
Chris PeBenito 57a96c
##	style, and do not require run_init.
Chris PeBenito 57a96c
##	

Chris PeBenito 57a96c
## </desc>
Chris PeBenito e5f806
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito e5f806
## </param>
Chris PeBenito e5f806
## <param name="role">
Chris PeBenito e5f806
##	The role to be performing this action.
Chris PeBenito e5f806
## </param>
Chris PeBenito e5f806
## <param name="terminal">
Chris PeBenito e5f806
##	The type of the terminal of the user.
Chris PeBenito e5f806
## </param>
Chris PeBenito e5f806
#
Chris PeBenito e5f806
interface(`init_run_daemon',`
Chris PeBenito e5f806
	gen_require(`
Chris PeBenito e5f806
		attribute direct_run_init, direct_init, direct_init_entry;
Chris PeBenito e5f806
		role system_r;
Chris PeBenito e5f806
	')
Chris PeBenito e5f806
Chris PeBenito e5f806
	typeattribute $1 direct_run_init;
Chris PeBenito e5f806
	role_transition $2 direct_init_entry system_r;
Chris PeBenito e5f806
	dontaudit direct_init $3:chr_file rw_file_perms;
Chris PeBenito e5f806
')
Chris PeBenito e5f806
Chris PeBenito e5f806
########################################
Chris PeBenito 57a96c
## <summary>
Chris PeBenito 725926
##	Write an init script unnamed pipe.
Chris PeBenito 725926
## </summary>
Chris PeBenito 725926
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito 725926
## </param>
Chris PeBenito 725926
#
Chris PeBenito 725926
interface(`init_write_script_pipe',`
Chris PeBenito 725926
	gen_require(`
Chris PeBenito 725926
		type initrc_t;
Chris PeBenito 725926
	')
Chris PeBenito 725926
Chris PeBenito 725926
	allow $1 initrc_t:fifo_file write;
Chris PeBenito 725926
')
Chris PeBenito 725926
Chris PeBenito 725926
########################################
Chris PeBenito 725926
## <summary>
Chris PeBenito 9fd4b8
##	Get the attribute of init script entrypoint files.
Chris PeBenito 9fd4b8
## </summary>
Chris PeBenito 9fd4b8
## <param name="domain">
Chris PeBenito 9fd4b8
##	Domain allowed access.
Chris PeBenito 9fd4b8
## </param>
Chris PeBenito 9fd4b8
#
Chris PeBenito 9fd4b8
interface(`init_getattr_script_entry_file',`
Chris PeBenito 9fd4b8
	gen_require(`
Chris PeBenito 9fd4b8
		type initrc_exec_t;
Chris PeBenito 9fd4b8
	')
Chris PeBenito 9fd4b8
Chris PeBenito 9fd4b8
	files_list_etc($1)
Chris PeBenito 9fd4b8
	allow $1 initrc_exec_t:file getattr;
Chris PeBenito 9fd4b8
')
Chris PeBenito 9fd4b8
Chris PeBenito 9fd4b8
########################################
Chris PeBenito 9fd4b8
## <summary>
Chris PeBenito 57a96c
##	Read init scripts.
Chris PeBenito 57a96c
## </summary>
Chris PeBenito 57a96c
## <param name="domain">
Chris PeBenito 57a96c
##	Domain allowed access.
Chris PeBenito 57a96c
## </param>
Chris PeBenito 57a96c
#
Chris PeBenito 57a96c
interface(`init_read_script',`
Chris PeBenito 57a96c
	gen_require(`
Chris PeBenito 57a96c
		type initrc_exec_t;
Chris PeBenito 57a96c
	')
Chris PeBenito 57a96c
Chris PeBenito 57a96c
	files_list_etc($1)
Chris PeBenito 57a96c
	allow $1 initrc_exec_t:file { getattr read };
Chris PeBenito 57a96c
')
Chris PeBenito 57a96c
Chris PeBenito 57a96c
########################################
Chris PeBenito b4cd15
#
Chris PeBenito c9428d
# init_exec_script(domain)
Chris PeBenito bd202f
#
Chris PeBenito 199895
interface(`init_exec_script',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_exec_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 139520
	files_list_etc($1)
Chris PeBenito dd8229
	can_exec($1,initrc_exec_t)
Chris PeBenito bd202f
')
Chris PeBenito bd202f
Chris PeBenito bd202f
########################################
Chris PeBenito e88003
## <summary>
Chris PeBenito 414e41
##	Read the process state (/proc/pid) of the init scripts.
Chris PeBenito e88003
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito 414e41
## </param>
Chris PeBenito daa0e0
#
Chris PeBenito 199895
interface(`init_read_script_process_state',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 139520
	#FIXME: search proc dir
Chris PeBenito dd8229
	allow $1 initrc_t:dir r_dir_perms;
Chris PeBenito dd8229
	allow $1 initrc_t:{ file lnk_file } r_file_perms;
Chris PeBenito 0c73cd
	allow $1 initrc_t:process getattr;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	# We need to suppress this denial because procps tries to access
Chris PeBenito 0c73cd
	# /proc/pid/environ and this now triggers a ptrace check in recent kernels
Chris PeBenito 0c73cd
	# (2.4 and 2.6).  Might want to change procps to not do this, or only if
Chris PeBenito 0c73cd
	# running in a privileged domain.
Chris PeBenito 0c73cd
	dontaudit $1 initrc_t:process ptrace;
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito daa0e0
########################################
Chris PeBenito bd202f
#
Chris PeBenito c9428d
# init_use_script_fd(domain)
Chris PeBenito ee5772
#
Chris PeBenito 199895
interface(`init_use_script_fd',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 initrc_t:fd use;
Chris PeBenito ee5772
')
Chris PeBenito ee5772
Chris PeBenito ee5772
########################################
Chris PeBenito ee5772
#
Chris PeBenito c9428d
# init_dontaudit_use_script_fd(domain)
Chris PeBenito daa0e0
#
Chris PeBenito 199895
interface(`init_dontaudit_use_script_fd',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	dontaudit $1 initrc_t:fd use;
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito daa0e0
########################################
Chris PeBenito daa0e0
#
Chris PeBenito c9428d
# init_get_script_process_group(domain)
Chris PeBenito b16c6b
#
Chris PeBenito 199895
interface(`init_get_script_process_group',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 initrc_t:process getpgid;
Chris PeBenito b16c6b
')
Chris PeBenito b16c6b
Chris PeBenito b16c6b
########################################
Chris PeBenito e88003
## <summary>
Chris PeBenito 04926d
##	Send SIGCHLD signals to init scripts.
Chris PeBenito 04926d
## </summary>
Chris PeBenito 04926d
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito 04926d
## </param>
Chris PeBenito 04926d
#
Chris PeBenito 04926d
interface(`init_sigchld_script',`
Chris PeBenito 04926d
	gen_require(`
Chris PeBenito 04926d
		type initrc_t;
Chris PeBenito 04926d
	')
Chris PeBenito 04926d
Chris PeBenito 04926d
	allow $1 initrc_t:process sigchld;
Chris PeBenito 04926d
')
Chris PeBenito 04926d
Chris PeBenito 04926d
########################################
Chris PeBenito 04926d
## <summary>
Chris PeBenito 4b9516
##	Send generic signals to init scripts.
Chris PeBenito 4b9516
## </summary>
Chris PeBenito 4b9516
## <param name="domain">
Chris PeBenito 4b9516
##	Domain allowed access.
Chris PeBenito 4b9516
## </param>
Chris PeBenito 4b9516
#
Chris PeBenito 4b9516
interface(`init_signal_script',`
Chris PeBenito 4b9516
	gen_require(`
Chris PeBenito 4b9516
		type initrc_t;
Chris PeBenito 4b9516
	')
Chris PeBenito 4b9516
Chris PeBenito 4b9516
	allow $1 initrc_t:process signal;
Chris PeBenito 4b9516
')
Chris PeBenito 4b9516
Chris PeBenito 4b9516
########################################
Chris PeBenito 4b9516
## <summary>
Chris PeBenito 4b9516
##	Send null signals to init scripts.
Chris PeBenito 4b9516
## </summary>
Chris PeBenito 4b9516
## <param name="domain">
Chris PeBenito 4b9516
##	Domain allowed access.
Chris PeBenito 4b9516
## </param>
Chris PeBenito 4b9516
#
Chris PeBenito 4b9516
interface(`init_signull_script',`
Chris PeBenito 4b9516
	gen_require(`
Chris PeBenito 4b9516
		type initrc_t;
Chris PeBenito 4b9516
	')
Chris PeBenito 4b9516
Chris PeBenito 4b9516
	allow $1 initrc_t:process signull;
Chris PeBenito 4b9516
')
Chris PeBenito 4b9516
Chris PeBenito 4b9516
########################################
Chris PeBenito 4b9516
## <summary>
Chris PeBenito 414e41
##	Read and write init script unnamed pipes.
Chris PeBenito e88003
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito 414e41
## </param>
Chris PeBenito 7a2f20
#
Chris PeBenito 199895
interface(`init_rw_script_pipe',`
Chris PeBenito 7a2f20
	gen_require(`
Chris PeBenito 7a2f20
		type initrc_t;
Chris PeBenito 7a2f20
	')
Chris PeBenito 7a2f20
Chris PeBenito 7a2f20
	allow $1 initrc_t:fifo_file { read write };
Chris PeBenito 7a2f20
')
Chris PeBenito 7a2f20
Chris PeBenito 7a2f20
########################################
Chris PeBenito e88003
## <summary>
Chris PeBenito e88003
##	Send UDP network traffic to init scripts.
Chris PeBenito e88003
## </summary>
Chris PeBenito e88003
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito e88003
## </param>
Chris PeBenito e88003
#
Chris PeBenito e88003
interface(`init_udp_sendto_script',`
Chris PeBenito e88003
	gen_require(`
Chris PeBenito e88003
		type initrc_t;
Chris PeBenito e88003
	')
Chris PeBenito e88003
Chris PeBenito e88003
	allow $1 initrc_t:udp_socket sendto;
Chris PeBenito e88003
	allow initrc_t $1:udp_socket recvfrom;
Chris PeBenito e88003
')
Chris PeBenito e88003
Chris PeBenito e88003
########################################
Chris PeBenito 57a96c
## <summary>
Chris PeBenito fc6524
##	Allow the specified domain to connect to
Chris PeBenito fc6524
##	init scripts with a unix socket.
Chris PeBenito fc6524
## </summary>
Chris PeBenito fc6524
## <param name="domain">
Chris PeBenito fc6524
##	Domain allowed access.
Chris PeBenito fc6524
## </param>
Chris PeBenito fc6524
#
Chris PeBenito fc6524
interface(`init_unix_connect_script',`
Chris PeBenito fc6524
	gen_require(`
Chris PeBenito fc6524
		type initrc_t;
Chris PeBenito fc6524
	')
Chris PeBenito fc6524
Chris PeBenito fc6524
	allow $1 initrc_t:unix_stream_socket connectto;
Chris PeBenito fc6524
')
Chris PeBenito fc6524
Chris PeBenito fc6524
########################################
Chris PeBenito fc6524
## <summary>
Chris PeBenito 1470ff
##	Dont audit the specified domain connecting to
Chris PeBenito 1470ff
##	init scripts with a unix domain stream socket.
Chris PeBenito 1470ff
## </summary>
Chris PeBenito 1470ff
## <param name="domain">
Chris PeBenito 1470ff
##      Domain allowed access.
Chris PeBenito 1470ff
## </param>
Chris PeBenito 1470ff
#
Chris PeBenito 1470ff
interface(`init_dontaudit_unix_connect_script',`
Chris PeBenito 1470ff
	gen_require(`
Chris PeBenito 1470ff
		type initrc_t;
Chris PeBenito 1470ff
	')
Chris PeBenito 1470ff
Chris PeBenito 1470ff
	dontaudit $1 initrc_t:unix_stream_socket connectto;
Chris PeBenito 1470ff
')
Chris PeBenito 1470ff
Chris PeBenito 1470ff
########################################
Chris PeBenito 1470ff
## <summary>
Chris PeBenito 6f81e1
##	Send and receive messages from
Chris PeBenito 6f81e1
##	init scripts over dbus.
Chris PeBenito 6f81e1
## </summary>
Chris PeBenito 6f81e1
## <param name="domain">
Chris PeBenito 6f81e1
##	Domain allowed access.
Chris PeBenito 6f81e1
## </param>
Chris PeBenito 6f81e1
#
Chris PeBenito 6f81e1
interface(`init_dbus_chat_script',`
Chris PeBenito 6f81e1
	gen_require(`
Chris PeBenito 6f81e1
		type initrc_t;
Chris PeBenito 6f81e1
		class dbus send_msg;
Chris PeBenito 6f81e1
	')
Chris PeBenito 6f81e1
Chris PeBenito 6f81e1
	allow $1 initrc_t:dbus send_msg;
Chris PeBenito 6f81e1
	allow initrc_t $1:dbus send_msg;
Chris PeBenito 6f81e1
')
Chris PeBenito 6f81e1
Chris PeBenito 6f81e1
########################################
Chris PeBenito 6f81e1
## <summary>
Chris PeBenito 57a96c
##	Read and write the init script pty.
Chris PeBenito 57a96c
## </summary>
Chris PeBenito 57a96c
## <desc>
Chris PeBenito 57a96c
##	

Chris PeBenito 57a96c
##	Read and write the init script pty.  This
Chris PeBenito 57a96c
##	pty is generally opened by the open_init_pty
Chris PeBenito 57a96c
##	portion of the run_init program so that the
Chris PeBenito 57a96c
##	daemon does not require direct access to
Chris PeBenito 57a96c
##	the administrator terminal.
Chris PeBenito 57a96c
##	

Chris PeBenito 57a96c
## </desc>
Chris PeBenito 57a96c
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito 57a96c
## </param>
Chris PeBenito 889c9a
#
Chris PeBenito 199895
interface(`init_use_script_pty',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_devpts_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0fd9dc
	term_list_ptys($1)
Chris PeBenito da4fc9
	allow $1 initrc_devpts_t:chr_file { rw_term_perms lock append };
Chris PeBenito 889c9a
')
Chris PeBenito 889c9a
Chris PeBenito 889c9a
########################################
Chris PeBenito 57a96c
## <summary>
Chris PeBenito e6a2ea
##	Do not audit attempts to read and
Chris PeBenito e6a2ea
##	write the init script pty.
Chris PeBenito 57a96c
## </summary>
Chris PeBenito 57a96c
## <param name="domain">
Chris PeBenito e6a2ea
##	Domain to not audit.
Chris PeBenito 57a96c
## </param>
Chris PeBenito 57a96c
#
Chris PeBenito e6a2ea
interface(`init_dontaudit_use_script_pty',`
Chris PeBenito 57a96c
	gen_require(`
Chris PeBenito e6a2ea
		type initrc_devpts_t;
Chris PeBenito 57a96c
	')
Chris PeBenito 57a96c
Chris PeBenito e6a2ea
	dontaudit $1 initrc_devpts_t:chr_file { rw_term_perms lock append };
Chris PeBenito 57a96c
')
Chris PeBenito 57a96c
Chris PeBenito 57a96c
########################################
Chris PeBenito e6a2ea
## <summary>
Chris PeBenito e6a2ea
##	Read init scripts.
Chris PeBenito e6a2ea
## </summary>
Chris PeBenito e6a2ea
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito e6a2ea
## </param>
Chris PeBenito 889c9a
#
Chris PeBenito e6a2ea
interface(`init_read_script_file',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito e6a2ea
		type initrc_exec_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito e6a2ea
	files_search_etc($1)
Chris PeBenito e6a2ea
	allow $1 initrc_exec_t:file r_file_perms;
Chris PeBenito 5d7e8b
')
Chris PeBenito 5d7e8b
Chris PeBenito 5d7e8b
########################################
Chris PeBenito e88003
## <summary>
Chris PeBenito 414e41
##	Read and write init script temporary data.
Chris PeBenito e88003
## </summary>
Chris PeBenito 414e41
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito 414e41
## </param>
Chris PeBenito daa0e0
#
Chris PeBenito 199895
interface(`init_rw_script_tmp_files',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 25c674
		type initrc_tmp_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 25c674
	files_search_tmp($1)
Chris PeBenito dd8229
	allow $1 initrc_tmp_t:file rw_file_perms;
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito daa0e0
########################################
Chris PeBenito 5f38a6
## <summary>
Chris PeBenito 3f4188
##	Create files in a init script
Chris PeBenito 3f4188
##	temporary data directory.
Chris PeBenito 3f4188
## </summary>
Chris PeBenito 3f4188
## <param name="domain">
Chris PeBenito 3f4188
##	Domain allowed access.
Chris PeBenito 3f4188
## </param>
Chris PeBenito 3f4188
## <param name="file_type">
Chris PeBenito 3f4188
##	The type of the object to be created
Chris PeBenito 3f4188
## </param>
Chris PeBenito 3f4188
## <param name="object_class" optional="true">
Chris PeBenito 3f4188
##	The object class.  If not specified, file is used.
Chris PeBenito 3f4188
## </param>
Chris PeBenito 3f4188
#
Chris PeBenito 9d5949
interface(`init_filetrans_script_tmp',`
Chris PeBenito 3f4188
	gen_require(`
Chris PeBenito 3f4188
		type initrc_tmp_t;
Chris PeBenito 3f4188
	')
Chris PeBenito 3f4188
Chris PeBenito 3f4188
	files_search_tmp($1)
Chris PeBenito 3f4188
Chris PeBenito 3f4188
	allow $1 initrc_tmp_t:dir rw_dir_perms;
Chris PeBenito 3f4188
Chris PeBenito 3f4188
	ifelse(`$3',`',`
Chris PeBenito 3f4188
		type_transition $1 initrc_tmp_t:file $2;
Chris PeBenito 3f4188
	',`
Chris PeBenito 3f4188
		type_transition $1 initrc_tmp_t:$3 $2;
Chris PeBenito 3f4188
	')
Chris PeBenito 3f4188
')
Chris PeBenito 3f4188
Chris PeBenito 3f4188
########################################
Chris PeBenito 3f4188
## <summary>
Chris PeBenito 29ce00
##	Get the attributes of init script process id files.
Chris PeBenito 29ce00
## </summary>
Chris PeBenito 29ce00
## <param name="domain">
Chris PeBenito 29ce00
##	Domain allowed access.
Chris PeBenito 29ce00
## </param>
Chris PeBenito 29ce00
#
Chris PeBenito 68228b
interface(`init_getattr_utmp',`
Chris PeBenito 29ce00
	gen_require(`
Chris PeBenito 29ce00
		type initrc_var_run_t;
Chris PeBenito 29ce00
	')
Chris PeBenito 29ce00
Chris PeBenito 29ce00
	allow $1 initrc_var_run_t:file getattr;
Chris PeBenito 29ce00
')
Chris PeBenito 29ce00
Chris PeBenito 29ce00
########################################
Chris PeBenito 5d7e8b
#
Chris PeBenito 68228b
# init_read_utmp(domain)
Chris PeBenito b4cd15
#
Chris PeBenito 68228b
interface(`init_read_utmp',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_var_run_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_list_pids($1)
Chris PeBenito dd8229
	allow $1 initrc_var_run_t:file r_file_perms;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito 3ce6cb
########################################
Chris PeBenito 3ce6cb
#
Chris PeBenito 68228b
# init_dontaudit_write_utmp(domain)
Chris PeBenito 7bba9d
#
Chris PeBenito 68228b
interface(`init_dontaudit_write_utmp',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_var_run_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	dontaudit $1 initrc_var_run_t:file { write lock };
Chris PeBenito 7bba9d
')
Chris PeBenito 7bba9d
Chris PeBenito 7bba9d
########################################
Chris PeBenito 8cffa7
## <summary>
Chris PeBenito 8cffa7
##	Do not audit attempts to lock 
Chris PeBenito 8cffa7
##	init script pid files.
Chris PeBenito 8cffa7
## </summary>
Chris PeBenito 8cffa7
## <param name="domain">
Chris PeBenito 8cffa7
##	Domain allowed access.
Chris PeBenito 8cffa7
## </param>
Chris PeBenito 8cffa7
#
Chris PeBenito 68228b
interface(`init_dontaudit_lock_utmp',`
Chris PeBenito 8cffa7
	gen_require(`
Chris PeBenito 8cffa7
		type initrc_var_run_t;
Chris PeBenito 8cffa7
	')
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	dontaudit $1 initrc_var_run_t:file lock;
Chris PeBenito 8cffa7
')
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
########################################
Chris PeBenito 7bba9d
#
Chris PeBenito 68228b
# init_rw_utmp(domain)
Chris PeBenito 3ce6cb
#
Chris PeBenito 68228b
interface(`init_rw_utmp',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_var_run_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_list_pids($1)
Chris PeBenito dd8229
	allow $1 initrc_var_run_t:file rw_file_perms;
Chris PeBenito 3ce6cb
')
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
########################################
Chris PeBenito 3ce6cb
#
Chris PeBenito 68228b
# init_dontaudit_rw_utmp(domain)
Chris PeBenito 3ce6cb
#
Chris PeBenito 68228b
interface(`init_dontaudit_rw_utmp',`
Chris PeBenito 139520
	gen_require(`
Chris PeBenito 139520
		type initrc_var_run_t;
Chris PeBenito 139520
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	dontaudit $1 initrc_var_run_t:file { getattr read write append };
Chris PeBenito 3ce6cb
')
Chris PeBenito 3ce6cb
Chris PeBenito 7c2f5a
########################################
Chris PeBenito 7c2f5a
## <summary>
Chris PeBenito 68228b
##      Create, read, write, and delete utmp.
Chris PeBenito 7c2f5a
## </summary>
Chris PeBenito 7c2f5a
## <param name="domain">
Chris PeBenito 7c2f5a
##      Domain access allowed.
Chris PeBenito 7c2f5a
## </param>
Chris PeBenito 7c2f5a
#
Chris PeBenito 7c2f5a
interface(`init_manage_utmp',`
Chris PeBenito 7c2f5a
	gen_require(`
Chris PeBenito 7c2f5a
		type initrc_var_run_t;
Chris PeBenito 7c2f5a
	')
Chris PeBenito 7c2f5a
Chris PeBenito 7c2f5a
	files_search_pids($1)
Chris PeBenito 7c2f5a
	allow $1 initrc_var_run_t:file create_file_perms;
Chris PeBenito 7c2f5a
')