Chris PeBenito a996bdf
## <summary>Apache web server</summary>
Chris PeBenito a996bdf
Chris PeBenito b1421d8
########################################
Chris PeBenito b1421d8
## <summary>
Chris PeBenito b1421d8
##	Create a set of derived types for apache
Chris PeBenito b1421d8
##	web content.
Chris PeBenito b1421d8
## </summary>
Chris PeBenito b1421d8
## <param name="prefix">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito b1421d8
##	The prefix to be used for deriving type names.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito b1421d8
## </param>
Chris PeBenito b1421d8
#
Chris PeBenito a996bdf
template(`apache_content_template',`
Chris PeBenito a3cf80d
	gen_require(`
Chris PeBenito a3cf80d
		attribute httpdcontent;
Chris PeBenito a3cf80d
		attribute httpd_exec_scripts;
Chris PeBenito 123a990
		attribute httpd_script_exec_type;
Chris PeBenito a3cf80d
		type httpd_t, httpd_suexec_t, httpd_log_t;
Chris PeBenito a3cf80d
	')
Chris PeBenito b1421d8
	# allow write access to public file transfer
Chris PeBenito b1421d8
	# services files.
Chris PeBenito 0bfccda
	gen_tunable(allow_httpd_$1_script_anon_write, false)
Chris PeBenito b1421d8
Chris PeBenito a996bdf
	#This type is for webpages
Chris PeBenito a996bdf
	type httpd_$1_content_t, httpdcontent; # customizable
Chris PeBenito a996bdf
	files_type(httpd_$1_content_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	# This type is used for .htaccess files
Chris PeBenito a996bdf
	type httpd_$1_htaccess_t; # customizable;
Chris PeBenito a996bdf
	files_type(httpd_$1_htaccess_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	# Type that CGI scripts run as
Chris PeBenito a996bdf
	type httpd_$1_script_t;
Chris PeBenito a996bdf
	domain_type(httpd_$1_script_t)
Chris PeBenito a996bdf
	role system_r types httpd_$1_script_t;
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	# This type is used for executable scripts files
Chris PeBenito 123a990
	type httpd_$1_script_exec_t, httpd_script_exec_type; # customizable;
Chris PeBenito 0f27d98
	corecmd_shell_entry_type(httpd_$1_script_t)
Chris PeBenito 0bfccda
	domain_entry_file(httpd_$1_script_t, httpd_$1_script_exec_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	# The following three are the only areas that 
Chris PeBenito a996bdf
	# scripts can read, read/write, or append to
Chris PeBenito a996bdf
	type httpd_$1_script_ro_t, httpdcontent; # customizable
Chris PeBenito a996bdf
	files_type(httpd_$1_script_ro_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	type httpd_$1_script_rw_t, httpdcontent; # customizable
Chris PeBenito a996bdf
	files_type(httpd_$1_script_rw_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	type httpd_$1_script_ra_t, httpdcontent; # customizable
Chris PeBenito a996bdf
	files_type(httpd_$1_script_ra_t)
Chris PeBenito a996bdf
Chris PeBenito c0868a7
	allow httpd_t httpd_$1_htaccess_t:file read_file_perms;
Chris PeBenito a996bdf
Chris PeBenito c0868a7
	domtrans_pattern(httpd_suexec_t, httpd_$1_script_exec_t, httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito c0868a7
	allow httpd_suexec_t { httpd_$1_content_t httpd_$1_script_ro_t httpd_$1_script_rw_t httpd_$1_script_exec_t }:dir search_dir_perms;
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	allow httpd_$1_script_t self:fifo_file rw_file_perms;
Chris PeBenito 2e0a880
	allow httpd_$1_script_t self:unix_stream_socket connectto;
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	allow httpd_$1_script_t httpd_t:fifo_file write;
Chris PeBenito a996bdf
	# apache should set close-on-exec
Chris PeBenito a996bdf
	dontaudit httpd_$1_script_t httpd_t:unix_stream_socket { read write };
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	# Allow the script process to search the cgi directory, and users directory
Chris PeBenito c0868a7
	allow httpd_$1_script_t httpd_$1_content_t:dir search_dir_perms;
Chris PeBenito a996bdf
Chris PeBenito 0bfccda
	append_files_pattern(httpd_$1_script_t, httpd_log_t, httpd_log_t)
Chris PeBenito a996bdf
	logging_search_logs(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	can_exec(httpd_$1_script_t, httpd_$1_script_exec_t)
Chris PeBenito c0868a7
	allow httpd_$1_script_t httpd_$1_script_exec_t:dir search_dir_perms;
Chris PeBenito c0868a7
Chris PeBenito c0868a7
	allow httpd_$1_script_t httpd_$1_script_ra_t:dir { list_dir_perms add_entry_dir_perms };
Chris PeBenito 0bfccda
	read_files_pattern(httpd_$1_script_t, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito 0bfccda
	append_files_pattern(httpd_$1_script_t, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito 0bfccda
	read_lnk_files_pattern(httpd_$1_script_t, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito c0868a7
Chris PeBenito c0868a7
	allow httpd_$1_script_t httpd_$1_script_ro_t:dir list_dir_perms;
Chris PeBenito c0868a7
	read_files_pattern(httpd_$1_script_t,httpd_$1_script_ro_t,httpd_$1_script_ro_t)
Chris PeBenito c0868a7
	read_lnk_files_pattern(httpd_$1_script_t,httpd_$1_script_ro_t,httpd_$1_script_ro_t)
Chris PeBenito c0868a7
Chris PeBenito 0bfccda
	manage_dirs_pattern(httpd_$1_script_t, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
	manage_files_pattern(httpd_$1_script_t, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern(httpd_$1_script_t, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
	manage_fifo_files_pattern(httpd_$1_script_t, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
	manage_sock_files_pattern(httpd_$1_script_t, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
	files_tmp_filetrans(httpd_$1_script_t, httpd_$1_script_rw_t, { dir file lnk_file sock_file fifo_file })
Chris PeBenito a996bdf
Chris PeBenito e749cd1
	kernel_dontaudit_search_sysctl(httpd_$1_script_t)
Chris PeBenito e749cd1
	kernel_dontaudit_search_kernel_sysctl(httpd_$1_script_t)
Chris PeBenito e749cd1
Chris PeBenito a996bdf
	dev_read_rand(httpd_$1_script_t)
Chris PeBenito a996bdf
	dev_read_urand(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito fb63d0b
	corecmd_exec_all_executables(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	files_exec_etc_files(httpd_$1_script_t)
Chris PeBenito a996bdf
	files_read_etc_files(httpd_$1_script_t)
Chris PeBenito a996bdf
	files_search_home(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	libs_use_ld_so(httpd_$1_script_t)
Chris PeBenito a996bdf
	libs_use_shared_libs(httpd_$1_script_t)
Chris PeBenito a996bdf
	libs_exec_ld_so(httpd_$1_script_t)
Chris PeBenito a996bdf
	libs_exec_lib_files(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	miscfiles_read_fonts(httpd_$1_script_t)
Chris PeBenito b1421d8
	miscfiles_read_public_files(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	seutil_dontaudit_search_config(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito e749cd1
	tunable_policy(`httpd_enable_cgi && httpd_unified',`
Chris PeBenito 522b59b
		allow httpd_$1_script_t httpdcontent:file entrypoint;
Chris PeBenito c0868a7
Chris PeBenito 0bfccda
		manage_dirs_pattern(httpd_$1_script_t, httpdcontent, httpdcontent)
Chris PeBenito 0bfccda
		manage_files_pattern(httpd_$1_script_t, httpdcontent, httpdcontent)
Chris PeBenito 0bfccda
		manage_lnk_files_pattern(httpd_$1_script_t, httpdcontent, httpdcontent)
Chris PeBenito e749cd1
		can_exec(httpd_$1_script_t, httpdcontent)
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
Chris PeBenito b1421d8
	tunable_policy(`allow_httpd_$1_script_anon_write',`
Chris PeBenito b1421d8
		miscfiles_manage_public_files(httpd_$1_script_t)
Chris PeBenito b1421d8
	') 
Chris PeBenito b1421d8
Chris PeBenito a996bdf
	# Allow the web server to run scripts and serve pages
Chris PeBenito a996bdf
	tunable_policy(`httpd_builtin_scripting',`
Chris PeBenito 0bfccda
		manage_dirs_pattern(httpd_t, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
		manage_files_pattern(httpd_t, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
		manage_lnk_files_pattern(httpd_t, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
		rw_sock_files_pattern(httpd_t, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito c0868a7
Chris PeBenito c0868a7
		allow httpd_t httpd_$1_script_ra_t:dir { list_dir_perms add_entry_dir_perms };
Chris PeBenito 0bfccda
		read_files_pattern(httpd_t, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito 0bfccda
		append_files_pattern(httpd_t, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito 0bfccda
		read_lnk_files_pattern(httpd_t, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito c0868a7
Chris PeBenito c0868a7
		allow httpd_t httpd_$1_script_ro_t:dir list_dir_perms;
Chris PeBenito 0bfccda
		read_files_pattern(httpd_t, httpd_$1_script_ro_t, httpd_$1_script_ro_t)
Chris PeBenito 0bfccda
		read_lnk_files_pattern(httpd_t, httpd_$1_script_ro_t, httpd_$1_script_ro_t)
Chris PeBenito c0868a7
Chris PeBenito c0868a7
		allow httpd_t httpd_$1_content_t:dir list_dir_perms;
Chris PeBenito 0bfccda
		read_files_pattern(httpd_t, httpd_$1_content_t, httpd_$1_content_t)
Chris PeBenito 0bfccda
		read_lnk_files_pattern(httpd_t, httpd_$1_content_t, httpd_$1_content_t)
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	tunable_policy(`httpd_enable_cgi',`
Chris PeBenito e749cd1
		allow httpd_$1_script_t httpd_$1_script_exec_t:file entrypoint;
Chris PeBenito e749cd1
Chris PeBenito e749cd1
		# privileged users run the script:
Chris PeBenito c0868a7
		domtrans_pattern(httpd_exec_scripts, httpd_$1_script_exec_t, httpd_$1_script_t)
Chris PeBenito e749cd1
Chris PeBenito e749cd1
		# apache runs the script:
Chris PeBenito c0868a7
		domtrans_pattern(httpd_t, httpd_$1_script_exec_t, httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
		allow httpd_t httpd_$1_script_t:process { signal sigkill sigstop };
Chris PeBenito c0868a7
		allow httpd_t httpd_$1_script_exec_t:dir list_dir_perms;
Chris PeBenito a996bdf
Chris PeBenito d9845ae
		allow httpd_$1_script_t self:process { setsched signal_perms };
Chris PeBenito a996bdf
		allow httpd_$1_script_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito a996bdf
Chris PeBenito a996bdf
		allow httpd_$1_script_t httpd_t:fd use;
Chris PeBenito a996bdf
		allow httpd_$1_script_t httpd_t:process sigchld;
Chris PeBenito a996bdf
Chris PeBenito a996bdf
		kernel_read_system_state(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
		dev_read_urand(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
		fs_getattr_xattr_fs(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
		files_read_etc_runtime_files(httpd_$1_script_t)
Chris PeBenito a996bdf
		files_read_usr_files(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito 1815bad
		libs_read_lib_files(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
		miscfiles_read_localization(httpd_$1_script_t)
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
Chris PeBenito 8cfa5a0
	tunable_policy(`httpd_enable_cgi && httpd_can_network_connect_db',`
Chris PeBenito 8cfa5a0
		allow httpd_$1_script_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 8cfa5a0
		allow httpd_$1_script_t self:udp_socket create_socket_perms;
Chris PeBenito 8cfa5a0
Chris PeBenito 1900668
		corenet_all_recvfrom_unlabeled(httpd_$1_script_t)
Chris PeBenito 1900668
		corenet_all_recvfrom_netlabel(httpd_$1_script_t)
Chris PeBenito 8cfa5a0
		corenet_tcp_sendrecv_all_if(httpd_$1_script_t)
Chris PeBenito 8cfa5a0
		corenet_udp_sendrecv_all_if(httpd_$1_script_t)
Chris PeBenito 8cfa5a0
		corenet_tcp_sendrecv_all_nodes(httpd_$1_script_t)
Chris PeBenito 8cfa5a0
		corenet_udp_sendrecv_all_nodes(httpd_$1_script_t)
Chris PeBenito 8cfa5a0
		corenet_tcp_sendrecv_all_ports(httpd_$1_script_t)
Chris PeBenito 8cfa5a0
		corenet_udp_sendrecv_all_ports(httpd_$1_script_t)
Chris PeBenito 8cfa5a0
Chris PeBenito 8cfa5a0
		sysnet_read_config(httpd_$1_script_t)
Chris PeBenito 8cfa5a0
	')
Chris PeBenito 8cfa5a0
Chris PeBenito a996bdf
	tunable_policy(`httpd_enable_cgi && httpd_can_network_connect',`
Chris PeBenito a996bdf
		allow httpd_$1_script_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito a996bdf
		allow httpd_$1_script_t self:udp_socket create_socket_perms;
Chris PeBenito bd70373
Chris PeBenito 1900668
		corenet_all_recvfrom_unlabeled(httpd_$1_script_t)
Chris PeBenito 1900668
		corenet_all_recvfrom_netlabel(httpd_$1_script_t)
Chris PeBenito a996bdf
		corenet_tcp_sendrecv_all_if(httpd_$1_script_t)
Chris PeBenito a996bdf
		corenet_udp_sendrecv_all_if(httpd_$1_script_t)
Chris PeBenito a996bdf
		corenet_tcp_sendrecv_all_nodes(httpd_$1_script_t)
Chris PeBenito a996bdf
		corenet_udp_sendrecv_all_nodes(httpd_$1_script_t)
Chris PeBenito a996bdf
		corenet_tcp_sendrecv_all_ports(httpd_$1_script_t)
Chris PeBenito a996bdf
		corenet_udp_sendrecv_all_ports(httpd_$1_script_t)
Chris PeBenito a996bdf
		corenet_tcp_connect_all_ports(httpd_$1_script_t)
Chris PeBenito 141cffd
		corenet_sendrecv_all_client_packets(httpd_$1_script_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
		sysnet_read_config(httpd_$1_script_t)
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
Chris PeBenito bb7170f
	optional_policy(`
Chris PeBenito a996bdf
		mta_send_mail(httpd_$1_script_t)
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
Chris PeBenito bb7170f
	optional_policy(`
Chris PeBenito dc1920b
		tunable_policy(`httpd_enable_cgi && httpd_can_network_connect_db',`
Chris PeBenito dc1920b
			mysql_tcp_connect(httpd_$1_script_t)
Chris PeBenito dc1920b
		')
Chris PeBenito dc1920b
	')
Chris PeBenito dc1920b
Chris PeBenito dc1920b
	optional_policy(`
Chris PeBenito a996bdf
		tunable_policy(`httpd_enable_cgi && allow_ypbind',`
Chris PeBenito a996bdf
			nis_use_ypbind_uncond(httpd_$1_script_t)
Chris PeBenito a996bdf
		')
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
Chris PeBenito bb7170f
	optional_policy(`
Chris PeBenito e8cb08a
		postgresql_unpriv_client(httpd_$1_script_t)
Chris PeBenito dc1920b
Chris PeBenito dc1920b
		tunable_policy(`httpd_enable_cgi && httpd_can_network_connect_db',`
Chris PeBenito dc1920b
			postgresql_tcp_connect(httpd_$1_script_t)
Chris PeBenito dc1920b
		')
Chris PeBenito e8cb08a
	')
Chris PeBenito e8cb08a
Chris PeBenito e8cb08a
	optional_policy(`
Chris PeBenito 1815bad
		nscd_socket_use(httpd_$1_script_t)
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
')
Chris PeBenito a996bdf
Chris PeBenito b1421d8
#######################################
Chris PeBenito b1421d8
## <summary>
Chris PeBenito bbcd3c9
##	The per role template for the apache module.
Chris PeBenito b1421d8
## </summary>
Chris PeBenito b1421d8
## <desc>
Chris PeBenito b1421d8
##	

Chris PeBenito b1421d8
##	This template creates types used for web pages
Chris PeBenito b1421d8
##	and web cgi to be used from the user home directory.
Chris PeBenito b1421d8
##	

Chris PeBenito b1421d8
##	

Chris PeBenito b1421d8
##	This template is invoked automatically for each user, and
Chris PeBenito b1421d8
##	generally does not need to be invoked directly
Chris PeBenito b1421d8
##	by policy writers.
Chris PeBenito b1421d8
##	

Chris PeBenito b1421d8
## </desc>
Chris PeBenito b1421d8
## <param name="userdomain_prefix">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito b1421d8
##	The prefix of the user domain (e.g., user
Chris PeBenito b1421d8
##	is the prefix for user_t).
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito b1421d8
## </param>
Chris PeBenito b1421d8
## <param name="user_domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito b1421d8
##	The type of the user domain.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito b1421d8
## </param>
Chris PeBenito b1421d8
## <param name="user_role">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito b1421d8
##	The role associated with the user domain.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito b1421d8
## </param>
Chris PeBenito b1421d8
#
Chris PeBenito bbcd3c9
template(`apache_per_role_template', `
Chris PeBenito 0efe52a
	gen_require(`
Chris PeBenito 0efe52a
		attribute httpdcontent, httpd_script_domains;
Chris PeBenito a334d29
		attribute httpd_exec_scripts, httpd_user_content_type;
Chris PeBenito a334d29
		attribute httpd_user_script_exec_type;
Chris PeBenito 0efe52a
		type httpd_t, httpd_suexec_t, httpd_log_t;
Chris PeBenito 0efe52a
	')
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	apache_content_template($1)
Chris PeBenito a996bdf
Chris PeBenito a334d29
	typeattribute httpd_$1_content_t httpd_user_content_type;
Chris PeBenito a334d29
	typeattribute httpd_$1_script_ra_t httpd_user_content_type;
Chris PeBenito a334d29
	typeattribute httpd_$1_script_rw_t httpd_user_content_type;
Chris PeBenito a334d29
	typeattribute httpd_$1_script_ro_t httpd_user_content_type;
Chris PeBenito a334d29
	typeattribute httpd_$1_script_exec_t httpd_user_script_exec_type;
Chris PeBenito a334d29
Chris PeBenito 39d8dcd
	typeattribute httpd_$1_script_t httpd_script_domains;
Chris PeBenito 103fe28
	userdom_user_home_content($1,httpd_$1_content_t)
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	role $3 types httpd_$1_script_t;
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	allow $2 httpd_$1_content_t:{ dir file lnk_file } { relabelto relabelfrom };
Chris PeBenito a996bdf
Chris PeBenito c0868a7
	allow $2 httpd_$1_htaccess_t:file { manage_file_perms relabelto relabelfrom };
Chris PeBenito c0868a7
Chris PeBenito 0bfccda
	manage_dirs_pattern($2, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito 0bfccda
	manage_files_pattern($2, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($2, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito 0bfccda
	relabel_dirs_pattern($2, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito 0bfccda
	relabel_files_pattern($2, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito 0bfccda
	relabel_lnk_files_pattern($2, httpd_$1_script_ra_t, httpd_$1_script_ra_t)
Chris PeBenito 0bfccda
Chris PeBenito 0bfccda
	manage_dirs_pattern($2, httpd_$1_script_ro_t, httpd_$1_script_ro_t)
Chris PeBenito 0bfccda
	manage_files_pattern($2, httpd_$1_script_ro_t, httpd_$1_script_ro_t)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($2, httpd_$1_script_ro_t, httpd_$1_script_ro_t)
Chris PeBenito 0bfccda
	relabel_dirs_pattern($2, httpd_$1_script_ro_t, httpd_$1_script_ro_t)
Chris PeBenito 0bfccda
	relabel_files_pattern($2, httpd_$1_script_ro_t, httpd_$1_script_ro_t)
Chris PeBenito 0bfccda
	relabel_lnk_files_pattern($2, httpd_$1_script_ro_t, httpd_$1_script_ro_t)
Chris PeBenito 0bfccda
Chris PeBenito 0bfccda
	manage_dirs_pattern($2, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
	manage_files_pattern($2, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($2, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
	relabel_dirs_pattern($2, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
	relabel_files_pattern($2, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
	relabel_lnk_files_pattern($2, httpd_$1_script_rw_t, httpd_$1_script_rw_t)
Chris PeBenito 0bfccda
Chris PeBenito 0bfccda
	manage_dirs_pattern($2, httpd_$1_script_exec_t, httpd_$1_script_exec_t)
Chris PeBenito 0bfccda
	manage_files_pattern($2, httpd_$1_script_exec_t, httpd_$1_script_exec_t)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($2, httpd_$1_script_exec_t, httpd_$1_script_exec_t)
Chris PeBenito 0bfccda
	relabel_dirs_pattern($2, httpd_$1_script_exec_t, httpd_$1_script_exec_t)
Chris PeBenito 0bfccda
	relabel_files_pattern($2, httpd_$1_script_exec_t, httpd_$1_script_exec_t)
Chris PeBenito 0bfccda
	relabel_lnk_files_pattern($2, httpd_$1_script_exec_t, httpd_$1_script_exec_t)
Chris PeBenito a996bdf
Chris PeBenito e749cd1
	tunable_policy(`httpd_enable_cgi',`
Chris PeBenito e749cd1
		# If a user starts a script by hand it gets the proper context
Chris PeBenito c0868a7
		domtrans_pattern($2, httpd_$1_script_exec_t, httpd_$1_script_t)
Chris PeBenito e749cd1
	')
Chris PeBenito a996bdf
Chris PeBenito e749cd1
	tunable_policy(`httpd_enable_cgi && httpd_unified',`
Chris PeBenito e749cd1
		allow httpd_$1_script_t httpdcontent:file entrypoint;
Chris PeBenito a996bdf
Chris PeBenito c0868a7
		domtrans_pattern($2, httpdcontent, httpd_$1_script_t)
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	# allow accessing files/dirs below the users home dir
Chris PeBenito a996bdf
	tunable_policy(`httpd_enable_homedirs',`
Chris PeBenito 103fe28
		userdom_search_user_home_dirs($1,httpd_t)
Chris PeBenito 103fe28
		userdom_search_user_home_dirs($1,httpd_suexec_t)
Chris PeBenito 103fe28
		userdom_search_user_home_dirs($1,httpd_$1_script_t)
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
')
Chris PeBenito a996bdf
Chris PeBenito a996bdf
########################################
Chris PeBenito a996bdf
## <summary>
Chris PeBenito 123a990
##	Read httpd user scripts executables.
Chris PeBenito 123a990
## </summary>
Chris PeBenito 123a990
## <param name="domain_prefix">
Chris PeBenito 123a990
##	<summary>
Chris PeBenito 123a990
##	Prefix of the domain. Example, user would be
Chris PeBenito 123a990
##	the prefix for the uder_t domain.
Chris PeBenito 123a990
##	</summary>
Chris PeBenito 123a990
## </param>
Chris PeBenito 123a990
## <param name="domain">
Chris PeBenito 123a990
##	<summary>
Chris PeBenito 123a990
##	Domain allowed access.
Chris PeBenito 123a990
##	</summary>
Chris PeBenito 123a990
## </param>
Chris PeBenito 123a990
#
Chris PeBenito 123a990
template(`apache_read_user_scripts',`
Chris PeBenito 123a990
	gen_require(`
Chris PeBenito 123a990
		type httpd_$1_script_exec_t;
Chris PeBenito 123a990
	')
Chris PeBenito 123a990
Chris PeBenito c0868a7
	allow $2 httpd_$1_script_exec_t:dir list_dir_perms;
Chris PeBenito 0bfccda
	read_files_pattern($2, httpd_$1_script_exec_t, httpd_$1_script_exec_t)
Chris PeBenito 0bfccda
	read_lnk_files_pattern($2, httpd_$1_script_exec_t, httpd_$1_script_exec_t)
Chris PeBenito 123a990
')
Chris PeBenito 123a990
Chris PeBenito 123a990
########################################
Chris PeBenito 123a990
## <summary>
Chris PeBenito 123a990
##	Read user web content.
Chris PeBenito 123a990
## </summary>
Chris PeBenito 123a990
## <param name="domain_prefix">
Chris PeBenito 123a990
##	<summary>
Chris PeBenito 123a990
##	Prefix of the domain. Example, user would be
Chris PeBenito 123a990
##	the prefix for the uder_t domain.
Chris PeBenito 123a990
##	</summary>
Chris PeBenito 123a990
## </param>
Chris PeBenito 123a990
## <param name="domain">
Chris PeBenito 123a990
##	<summary>
Chris PeBenito 123a990
##	Domain allowed access.
Chris PeBenito 123a990
##	</summary>
Chris PeBenito 123a990
## </param>
Chris PeBenito 123a990
#
Chris PeBenito 123a990
template(`apache_read_user_content',`
Chris PeBenito 123a990
	gen_require(`
Chris PeBenito 123a990
		type httpd_$1_content_t;
Chris PeBenito 123a990
	')
Chris PeBenito 123a990
Chris PeBenito c0868a7
	allow $2 httpd_$1_content_t:dir list_dir_perms;
Chris PeBenito 0bfccda
	read_files_pattern($2, httpd_$1_content_t, httpd_$1_content_t)
Chris PeBenito 0bfccda
	read_lnk_files_pattern($2, httpd_$1_content_t, httpd_$1_content_t)
Chris PeBenito 123a990
')
Chris PeBenito 123a990
Chris PeBenito 123a990
########################################
Chris PeBenito 123a990
## <summary>
Chris PeBenito b1421d8
##	Transition to apache.
Chris PeBenito a996bdf
## </summary>
Chris PeBenito a996bdf
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito a996bdf
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito a996bdf
## </param>
Chris PeBenito a996bdf
#
Chris PeBenito a996bdf
interface(`apache_domtrans',`
Chris PeBenito a996bdf
	gen_require(`
Chris PeBenito a996bdf
		type httpd_t, httpd_exec_t;
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
Chris PeBenito 8021cb4
	corecmd_search_bin($1)
Chris PeBenito 0bfccda
	domtrans_pattern($1, httpd_exec_t, httpd_t)
Chris PeBenito a996bdf
')
Chris PeBenito a996bdf
Chris PeBenito a996bdf
########################################
Chris PeBenito a996bdf
## <summary>
Chris PeBenito a996bdf
##	Send a null signal to apache.
Chris PeBenito a996bdf
## </summary>
Chris PeBenito a996bdf
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito 799a0b4
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito a996bdf
## </param>
Chris PeBenito a996bdf
#
Chris PeBenito a996bdf
interface(`apache_signull',`
Chris PeBenito a996bdf
	gen_require(`
Chris PeBenito a996bdf
		type httpd_t;
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	allow $1 httpd_t:process signull;
Chris PeBenito a996bdf
')
Chris PeBenito a996bdf
Chris PeBenito a996bdf
########################################
Chris PeBenito a996bdf
## <summary>
Chris PeBenito 799a0b4
##	Send a SIGCHLD signal to apache.
Chris PeBenito 799a0b4
## </summary>
Chris PeBenito 799a0b4
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito 799a0b4
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito 799a0b4
## </param>
Chris PeBenito 799a0b4
#
Chris PeBenito 799a0b4
interface(`apache_sigchld',`
Chris PeBenito 799a0b4
	gen_require(`
Chris PeBenito 799a0b4
		type httpd_t;
Chris PeBenito 799a0b4
	')
Chris PeBenito 799a0b4
Chris PeBenito 799a0b4
	allow $1 httpd_t:process sigchld;
Chris PeBenito 799a0b4
')
Chris PeBenito 799a0b4
Chris PeBenito 799a0b4
########################################
Chris PeBenito 799a0b4
## <summary>
Chris PeBenito 799a0b4
##	Inherit and use file descriptors from Apache.
Chris PeBenito 799a0b4
## </summary>
Chris PeBenito 799a0b4
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito 799a0b4
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito 799a0b4
## </param>
Chris PeBenito 799a0b4
#
Chris PeBenito 1c1ac67
interface(`apache_use_fds',`
Chris PeBenito 799a0b4
	gen_require(`
Chris PeBenito 799a0b4
		type httpd_t;
Chris PeBenito 799a0b4
	')
Chris PeBenito 799a0b4
Chris PeBenito 799a0b4
	allow $1 httpd_t:fd use;
Chris PeBenito 799a0b4
')
Chris PeBenito 799a0b4
Chris PeBenito 799a0b4
########################################
Chris PeBenito 799a0b4
## <summary>
Chris PeBenito e749cd1
##	Do not audit attempts to read and write Apache
Chris PeBenito e749cd1
##	unix domain stream sockets.
Chris PeBenito e749cd1
## </summary>
Chris PeBenito e749cd1
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito e749cd1
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito e749cd1
## </param>
Chris PeBenito e749cd1
#
Chris PeBenito 1815bad
interface(`apache_dontaudit_rw_stream_sockets',`
Chris PeBenito e749cd1
	gen_require(`
Chris PeBenito e749cd1
		type httpd_t;
Chris PeBenito e749cd1
	')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
	dontaudit $1 httpd_t:unix_stream_socket { read write };
Chris PeBenito e749cd1
')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
########################################
Chris PeBenito e749cd1
## <summary>
Chris PeBenito e749cd1
##	Do not audit attempts to read and write Apache
Chris PeBenito e749cd1
##	TCP sockets.
Chris PeBenito e749cd1
## </summary>
Chris PeBenito e749cd1
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito e749cd1
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito e749cd1
## </param>
Chris PeBenito e749cd1
#
Chris PeBenito 1815bad
interface(`apache_dontaudit_rw_tcp_sockets',`
Chris PeBenito e749cd1
	gen_require(`
Chris PeBenito e749cd1
		type httpd_t;
Chris PeBenito e749cd1
	')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
	dontaudit $1 httpd_t:tcp_socket { read write };
Chris PeBenito e749cd1
')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
########################################
Chris PeBenito 013d746
## <summary>
Chris PeBenito 013d746
##	Create, read, write, and delete all web content.
Chris PeBenito 013d746
## </summary>
Chris PeBenito 013d746
## <param name="domain">
Chris PeBenito 013d746
##	<summary>
Chris PeBenito 013d746
##	Domain allowed access.
Chris PeBenito 013d746
##	</summary>
Chris PeBenito 013d746
## </param>
Chris PeBenito bbcd3c9
## <rolecap/>
Chris PeBenito 013d746
#
Chris PeBenito 013d746
interface(`apache_manage_all_content',`
Chris PeBenito 013d746
	gen_require(`
Chris PeBenito 123a990
		attribute httpdcontent, httpd_script_exec_type;
Chris PeBenito 013d746
	')
Chris PeBenito 013d746
Chris PeBenito 0bfccda
	manage_dirs_pattern($1, httpdcontent, httpdcontent)
Chris PeBenito 0bfccda
	manage_files_pattern($1, httpdcontent, httpdcontent)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($1, httpdcontent, httpdcontent)
Chris PeBenito 123a990
Chris PeBenito 0bfccda
	manage_dirs_pattern($1, httpd_script_exec_type, httpd_script_exec_type)
Chris PeBenito 0bfccda
	manage_files_pattern($1, httpd_script_exec_type, httpd_script_exec_type)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($1, httpd_script_exec_type, httpd_script_exec_type)
Chris PeBenito 013d746
')
Chris PeBenito 013d746
Chris PeBenito 013d746
########################################
Chris PeBenito e749cd1
## <summary>
Chris PeBenito a996bdf
##	Allow the specified domain to read
Chris PeBenito 5bd9fd7
##	and write Apache cache files.
Chris PeBenito 5bd9fd7
## </summary>
Chris PeBenito 5bd9fd7
## <param name="domain">
Chris PeBenito 5bd9fd7
##	<summary>
Chris PeBenito 5bd9fd7
##	Domain allowed access.
Chris PeBenito 5bd9fd7
##	</summary>
Chris PeBenito 5bd9fd7
## </param>
Chris PeBenito 5bd9fd7
#
Chris PeBenito 5bd9fd7
interface(`apache_rw_cache_files',`
Chris PeBenito 5bd9fd7
	gen_require(`
Chris PeBenito 5bd9fd7
		type httpd_cache_t;
Chris PeBenito 5bd9fd7
	')
Chris PeBenito 5bd9fd7
Chris PeBenito 5bd9fd7
	allow $1 httpd_cache_t:file rw_file_perms;
Chris PeBenito 5bd9fd7
')
Chris PeBenito 5bd9fd7
Chris PeBenito 5bd9fd7
########################################
Chris PeBenito 5bd9fd7
## <summary>
Chris PeBenito 5bd9fd7
##	Allow the specified domain to read
Chris PeBenito a996bdf
##	apache configuration files.
Chris PeBenito a996bdf
## </summary>
Chris PeBenito a996bdf
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito a996bdf
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito a996bdf
## </param>
Chris PeBenito bbcd3c9
## <rolecap/>
Chris PeBenito a996bdf
#
Chris PeBenito a996bdf
interface(`apache_read_config',`
Chris PeBenito a996bdf
	gen_require(`
Chris PeBenito a996bdf
		type httpd_config_t;
Chris PeBenito a996bdf
	')
Chris PeBenito a996bdf
Chris PeBenito a996bdf
	files_search_etc($1)
Chris PeBenito c0868a7
	allow $1 httpd_config_t:dir list_dir_perms;
Chris PeBenito 0bfccda
	read_files_pattern($1, httpd_config_t, httpd_config_t)
Chris PeBenito 0bfccda
	read_lnk_files_pattern($1, httpd_config_t, httpd_config_t)
Chris PeBenito a996bdf
')
Chris PeBenito 6e99a6c
Chris PeBenito 6e99a6c
########################################
Chris PeBenito 6e99a6c
## <summary>
Chris PeBenito 123a990
##	Allow the specified domain to manage
Chris PeBenito 123a990
##	apache configuration files.
Chris PeBenito 123a990
## </summary>
Chris PeBenito 123a990
## <param name="domain">
Chris PeBenito 123a990
##	<summary>
Chris PeBenito 123a990
##	Domain allowed access.
Chris PeBenito 123a990
##	</summary>
Chris PeBenito 123a990
## </param>
Chris PeBenito 123a990
#
Chris PeBenito 123a990
interface(`apache_manage_config',`
Chris PeBenito 123a990
	gen_require(`
Chris PeBenito 123a990
		type httpd_config_t;
Chris PeBenito 123a990
	')
Chris PeBenito 123a990
Chris PeBenito 123a990
	files_search_etc($1)
Chris PeBenito 0bfccda
	manage_dirs_pattern($1, httpd_config_t, httpd_config_t)
Chris PeBenito 0bfccda
	manage_files_pattern($1, httpd_config_t, httpd_config_t)
Chris PeBenito 0bfccda
	read_lnk_files_pattern($1, httpd_config_t, httpd_config_t)
Chris PeBenito 123a990
')
Chris PeBenito 123a990
Chris PeBenito 123a990
########################################
Chris PeBenito 123a990
## <summary>
Chris PeBenito c2b18fa
##	Execute the Apache helper program with
Chris PeBenito c2b18fa
##	a domain transition.
Chris PeBenito 6e99a6c
## </summary>
Chris PeBenito 6e99a6c
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito 6e99a6c
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito 6e99a6c
## </param>
Chris PeBenito 6e99a6c
#
Chris PeBenito c2b18fa
interface(`apache_domtrans_helper',`
Chris PeBenito 6e99a6c
	gen_require(`
Chris PeBenito c2b18fa
		type httpd_helper_t, httpd_helper_exec_t;
Chris PeBenito 6e99a6c
	')
Chris PeBenito 6e99a6c
Chris PeBenito 8021cb4
	corecmd_search_bin($1)
Chris PeBenito 0bfccda
	domtrans_pattern($1, httpd_helper_exec_t, httpd_helper_t)
Chris PeBenito c2b18fa
')
Chris PeBenito c2b18fa
Chris PeBenito c2b18fa
########################################
Chris PeBenito c2b18fa
## <summary>
Chris PeBenito c2b18fa
##	Execute the Apache helper program with
Chris PeBenito c2b18fa
##	a domain transition, and allow the
Chris PeBenito c2b18fa
##	specified role the dmidecode domain.
Chris PeBenito c2b18fa
## </summary>
Chris PeBenito c2b18fa
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito c2b18fa
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito c2b18fa
## </param>
Chris PeBenito c2b18fa
## <param name="role">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito c2b18fa
##	The role to be allowed the dmidecode domain.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito c2b18fa
## </param>
Chris PeBenito c2b18fa
## <param name="terminal">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito c2b18fa
##	The type of the terminal allow the dmidecode domain to use.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito c2b18fa
## </param>
Chris PeBenito bbcd3c9
## <rolecap/>
Chris PeBenito c2b18fa
#
Chris PeBenito c2b18fa
interface(`apache_run_helper',`
Chris PeBenito c2b18fa
	gen_require(`
Chris PeBenito c2b18fa
		type httpd_helper_t;
Chris PeBenito c2b18fa
	')
Chris PeBenito c2b18fa
Chris PeBenito c2b18fa
	apache_domtrans_helper($1)
Chris PeBenito c2b18fa
	role $2 types httpd_helper_t;
Chris PeBenito c2b18fa
	allow httpd_helper_t $3:chr_file rw_term_perms;
Chris PeBenito 6e99a6c
')
Chris PeBenito 799a0b4
Chris PeBenito 799a0b4
########################################
Chris PeBenito 799a0b4
## <summary>
Chris PeBenito be4690a
##	Allow the specified domain to read
Chris PeBenito be4690a
##	apache log files.
Chris PeBenito be4690a
## </summary>
Chris PeBenito be4690a
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito be4690a
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito be4690a
## </param>
Chris PeBenito bbcd3c9
## <rolecap/>
Chris PeBenito be4690a
#
Chris PeBenito be4690a
interface(`apache_read_log',`
Chris PeBenito be4690a
	gen_require(`
Chris PeBenito be4690a
		type httpd_log_t;
Chris PeBenito be4690a
	')
Chris PeBenito be4690a
Chris PeBenito f1e604b
	logging_search_logs($1)
Chris PeBenito c0868a7
	allow $1 httpd_log_t:dir list_dir_perms;
Chris PeBenito 0bfccda
	read_files_pattern($1, httpd_log_t, httpd_log_t)
Chris PeBenito 0bfccda
	read_lnk_files_pattern($1, httpd_log_t, httpd_log_t)
Chris PeBenito be4690a
')
Chris PeBenito be4690a
Chris PeBenito be4690a
########################################
Chris PeBenito be4690a
## <summary>
Chris PeBenito f1e604b
##	Allow the specified domain to append
Chris PeBenito f1e604b
##	to apache log files.
Chris PeBenito f1e604b
## </summary>
Chris PeBenito f1e604b
## <param name="domain">
Chris PeBenito f1e604b
##	<summary>
Chris PeBenito f1e604b
##	Domain allowed access.
Chris PeBenito f1e604b
##	</summary>
Chris PeBenito f1e604b
## </param>
Chris PeBenito f1e604b
#
Chris PeBenito f1e604b
interface(`apache_append_log',`
Chris PeBenito f1e604b
	gen_require(`
Chris PeBenito f1e604b
		type httpd_log_t;
Chris PeBenito f1e604b
	')
Chris PeBenito f1e604b
Chris PeBenito f1e604b
	logging_search_logs($1)
Chris PeBenito c0868a7
	allow $1 httpd_log_t:dir list_dir_perms;
Chris PeBenito 0bfccda
	append_files_pattern($1, httpd_log_t, httpd_log_t)
Chris PeBenito f1e604b
')
Chris PeBenito f1e604b
Chris PeBenito f1e604b
########################################
Chris PeBenito f1e604b
## <summary>
Chris PeBenito 799a0b4
##	Do not audit attempts to append to the
Chris PeBenito 799a0b4
##	Apache logs.
Chris PeBenito 799a0b4
## </summary>
Chris PeBenito 799a0b4
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito 799a0b4
##	Domain to not audit.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito 799a0b4
## </param>
Chris PeBenito 799a0b4
#
Chris PeBenito 799a0b4
interface(`apache_dontaudit_append_log',`
Chris PeBenito 799a0b4
	gen_require(`
Chris PeBenito 799a0b4
		type httpd_log_t;
Chris PeBenito 799a0b4
	')
Chris PeBenito 799a0b4
Chris PeBenito e749cd1
	dontaudit $1 httpd_log_t:file { getattr append };
Chris PeBenito 799a0b4
')
Chris PeBenito c2b18fa
Chris PeBenito c2b18fa
########################################
Chris PeBenito c2b18fa
## <summary>
Chris PeBenito 123a990
##	Allow the specified domain to manage
Chris PeBenito 123a990
##	to apache log files.
Chris PeBenito 123a990
## </summary>
Chris PeBenito 123a990
## <param name="domain">
Chris PeBenito 123a990
##	<summary>
Chris PeBenito 123a990
##	Domain allowed access.
Chris PeBenito 123a990
##	</summary>
Chris PeBenito 123a990
## </param>
Chris PeBenito 123a990
#
Chris PeBenito 123a990
interface(`apache_manage_log',`
Chris PeBenito 123a990
	gen_require(`
Chris PeBenito 123a990
		type httpd_log_t;
Chris PeBenito 123a990
	')
Chris PeBenito 123a990
Chris PeBenito 123a990
	logging_search_logs($1)
Chris PeBenito 0bfccda
	manage_dirs_pattern($1, httpd_log_t, httpd_log_t)
Chris PeBenito 0bfccda
	manage_files_pattern($1, httpd_log_t, httpd_log_t)
Chris PeBenito 0bfccda
	read_lnk_files_pattern($1, httpd_log_t, httpd_log_t)
Chris PeBenito 123a990
')
Chris PeBenito 123a990
Chris PeBenito 123a990
########################################
Chris PeBenito 123a990
## <summary>
Chris PeBenito c6d4c8f
##	Do not audit attempts to search Apache
Chris PeBenito c6d4c8f
##	module directories.
Chris PeBenito c6d4c8f
## </summary>
Chris PeBenito c6d4c8f
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito c6d4c8f
##	Domain to not audit.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito c6d4c8f
## </param>
Chris PeBenito c6d4c8f
#
Chris PeBenito c6d4c8f
interface(`apache_dontaudit_search_modules',`
Chris PeBenito c6d4c8f
	gen_require(`
Chris PeBenito c6d4c8f
		type httpd_modules_t;
Chris PeBenito c6d4c8f
	')
Chris PeBenito c6d4c8f
Chris PeBenito c31f672
	dontaudit $1 httpd_modules_t:dir search_dir_perms;
Chris PeBenito c6d4c8f
')
Chris PeBenito c6d4c8f
Chris PeBenito c6d4c8f
########################################
Chris PeBenito c6d4c8f
## <summary>
Chris PeBenito c2b18fa
##	Allow the specified domain to list
Chris PeBenito c2b18fa
##	the contents of the apache modules
Chris PeBenito c2b18fa
##	directory.
Chris PeBenito c2b18fa
## </summary>
Chris PeBenito c2b18fa
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito c2b18fa
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito c2b18fa
## </param>
Chris PeBenito c2b18fa
#
Chris PeBenito c2b18fa
interface(`apache_list_modules',`
Chris PeBenito c2b18fa
	gen_require(`
Chris PeBenito c2b18fa
		type httpd_modules_t;
Chris PeBenito c2b18fa
	')
Chris PeBenito c2b18fa
Chris PeBenito c0868a7
	allow $1 httpd_modules_t:dir list_dir_perms;
Chris PeBenito c2b18fa
')
Chris PeBenito c2b18fa
Chris PeBenito c2b18fa
########################################
Chris PeBenito c2b18fa
## <summary>
Chris PeBenito 2bcdbd8
##	Allow the specified domain to execute
Chris PeBenito 2bcdbd8
##	apache modules.
Chris PeBenito 2bcdbd8
## </summary>
Chris PeBenito 2bcdbd8
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito 2bcdbd8
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito 2bcdbd8
## </param>
Chris PeBenito 2bcdbd8
#
Chris PeBenito 2bcdbd8
interface(`apache_exec_modules',`
Chris PeBenito 2bcdbd8
	gen_require(`
Chris PeBenito 2bcdbd8
		type httpd_modules_t;
Chris PeBenito 2bcdbd8
	')
Chris PeBenito 2bcdbd8
Chris PeBenito c0868a7
	allow $1 httpd_modules_t:dir list_dir_perms;
Chris PeBenito c0868a7
	allow $1 httpd_modules_t:lnk_file read_file_perms;
Chris PeBenito 2bcdbd8
	can_exec($1,httpd_modules_t)
Chris PeBenito 2bcdbd8
')
Chris PeBenito 2bcdbd8
Chris PeBenito 2bcdbd8
########################################
Chris PeBenito 2bcdbd8
## <summary>
Chris PeBenito 123a990
##	Execute a domain transition to run httpd_rotatelogs.
Chris PeBenito 123a990
## </summary>
Chris PeBenito 123a990
## <param name="domain">
Chris PeBenito 123a990
##	<summary>
Chris PeBenito 123a990
##	Domain allowed access.
Chris PeBenito 123a990
##	</summary>
Chris PeBenito 123a990
## </param>
Chris PeBenito 123a990
#
Chris PeBenito 123a990
interface(`apache_domtrans_rotatelogs',`
Chris PeBenito 123a990
	gen_require(`
Chris PeBenito 123a990
		type httpd_rotatelogs_t, httpd_rotatelogs_exec_t;
Chris PeBenito 123a990
	')
Chris PeBenito 123a990
Chris PeBenito 0bfccda
	domtrans_pattern($1, httpd_rotatelogs_exec_t, httpd_rotatelogs_t)
Chris PeBenito 123a990
')
Chris PeBenito 123a990
Chris PeBenito 123a990
########################################
Chris PeBenito 123a990
## <summary>
Chris PeBenito be4690a
##	Allow the specified domain to manage
Chris PeBenito be4690a
##	apache system content files.
Chris PeBenito be4690a
## </summary>
Chris PeBenito be4690a
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito be4690a
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito be4690a
## </param>
Chris PeBenito bbcd3c9
## <rolecap/>
Chris PeBenito be4690a
#
Chris PeBenito be4690a
# Note that httpd_sys_content_t is found in /var, /etc, /srv and /usr
Chris PeBenito be4690a
interface(`apache_manage_sys_content',`
Chris PeBenito be4690a
	gen_require(`
Chris PeBenito 77f6e2c
		type httpd_sys_content_t;
Chris PeBenito be4690a
	')
Chris PeBenito be4690a
Chris PeBenito be4690a
	files_search_var($1)
Chris PeBenito 0bfccda
	manage_dirs_pattern($1, httpd_sys_content_t, httpd_sys_content_t)
Chris PeBenito 0bfccda
	manage_files_pattern($1, httpd_sys_content_t, httpd_sys_content_t)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($1, httpd_sys_content_t, httpd_sys_content_t)
Chris PeBenito be4690a
')
Chris PeBenito be4690a
Chris PeBenito be4690a
########################################
Chris PeBenito be4690a
## <summary>
Chris PeBenito c2b18fa
##	Execute all web scripts in the system
Chris PeBenito c2b18fa
##	script domain.
Chris PeBenito c2b18fa
## </summary>
Chris PeBenito c2b18fa
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito c2b18fa
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito c2b18fa
## </param>
Chris PeBenito c2b18fa
#
Chris PeBenito c2b18fa
# cjp: this interface specifically added to allow
Chris PeBenito c2b18fa
# sysadm_t to run scripts
Chris PeBenito c2b18fa
interface(`apache_domtrans_sys_script',`
Chris PeBenito c2b18fa
	gen_require(`
Chris PeBenito c2b18fa
		attribute httpdcontent;
Chris PeBenito c2b18fa
		type httpd_sys_script_t;
Chris PeBenito c2b18fa
	')
Chris PeBenito c2b18fa
Chris PeBenito c2b18fa
	tunable_policy(`httpd_enable_cgi && httpd_unified',`
Chris PeBenito c0868a7
		domtrans_pattern($1, httpdcontent, httpd_sys_script_t)
Chris PeBenito c2b18fa
	')
Chris PeBenito c2b18fa
')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
########################################
Chris PeBenito e749cd1
## <summary>
Chris PeBenito e749cd1
##	Do not audit attempts to read and write Apache
Chris PeBenito e749cd1
##	system script unix domain stream sockets.
Chris PeBenito e749cd1
## </summary>
Chris PeBenito e749cd1
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito e749cd1
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito e749cd1
## </param>
Chris PeBenito e749cd1
#
Chris PeBenito 1815bad
interface(`apache_dontaudit_rw_sys_script_stream_sockets',`
Chris PeBenito e749cd1
	gen_require(`
Chris PeBenito e749cd1
		type httpd_sys_script_t;
Chris PeBenito e749cd1
	')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
	dontaudit $1 httpd_sys_script_t:unix_stream_socket { read write };
Chris PeBenito e749cd1
')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
########################################
Chris PeBenito e749cd1
## <summary>
Chris PeBenito e749cd1
##	Execute all user scripts in the user
Chris PeBenito e749cd1
##	script domain.
Chris PeBenito e749cd1
## </summary>
Chris PeBenito e749cd1
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito e749cd1
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito e749cd1
## </param>
Chris PeBenito e749cd1
#
Chris PeBenito e749cd1
interface(`apache_domtrans_all_scripts',`
Chris PeBenito e749cd1
	gen_require(`
Chris PeBenito e749cd1
		attribute httpd_exec_scripts;
Chris PeBenito e749cd1
	')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
	typeattribute $1 httpd_exec_scripts;
Chris PeBenito e749cd1
')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
########################################
Chris PeBenito e749cd1
## <summary>
Chris PeBenito e749cd1
##	Execute all user scripts in the user
Chris PeBenito e749cd1
##	script domain.  Add user script domains
Chris PeBenito e749cd1
##	to the specified role.
Chris PeBenito e749cd1
## </summary>
Chris PeBenito e749cd1
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito e749cd1
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito e749cd1
## </param>
Chris PeBenito e749cd1
## <param name="role">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito e749cd1
##	The role to be allowed the script domains.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito e749cd1
## </param>
Chris PeBenito e749cd1
#
Chris PeBenito e749cd1
# cjp: this is missing the terminal since scripts
Chris PeBenito e749cd1
# do not output to the terminal
Chris PeBenito e749cd1
interface(`apache_run_all_scripts',`
Chris PeBenito e749cd1
	gen_require(`
Chris PeBenito e749cd1
		attribute httpd_exec_scripts, httpd_script_domains;
Chris PeBenito e749cd1
	')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
	role $2 types httpd_script_domains;
Chris PeBenito e749cd1
	apache_domtrans_all_scripts($1)
Chris PeBenito e749cd1
')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
########################################
Chris PeBenito e749cd1
## <summary>
Chris PeBenito e749cd1
##	Allow the specified domain to read
Chris PeBenito e749cd1
##	apache squirrelmail data.
Chris PeBenito e749cd1
## </summary>
Chris PeBenito e749cd1
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito e749cd1
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito e749cd1
## </param>
Chris PeBenito e749cd1
#
Chris PeBenito e749cd1
interface(`apache_read_squirrelmail_data',`
Chris PeBenito e749cd1
	gen_require(`
Chris PeBenito e749cd1
		type httpd_squirrelmail_t;
Chris PeBenito e749cd1
	')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
	allow $1 httpd_squirrelmail_t:file { getattr read };
Chris PeBenito e749cd1
')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
########################################
Chris PeBenito e749cd1
## <summary>
Chris PeBenito e749cd1
##	Allow the specified domain to append
Chris PeBenito e749cd1
##	apache squirrelmail data.
Chris PeBenito e749cd1
## </summary>
Chris PeBenito e749cd1
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito e749cd1
##	Domain allowed access.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito e749cd1
## </param>
Chris PeBenito e749cd1
#
Chris PeBenito e749cd1
interface(`apache_append_squirrelmail_data',`
Chris PeBenito e749cd1
	gen_require(`
Chris PeBenito e749cd1
		type httpd_squirrelmail_t;
Chris PeBenito e749cd1
	')
Chris PeBenito e749cd1
Chris PeBenito e749cd1
	allow $1 httpd_squirrelmail_t:file { getattr append };
Chris PeBenito e749cd1
')
Chris PeBenito 9fd4b81
Chris PeBenito 9fd4b81
########################################
Chris PeBenito 9fd4b81
## <summary>
Chris PeBenito 99c902f
##	Search apache system content.
Chris PeBenito 99c902f
## </summary>
Chris PeBenito 99c902f
## <param name="domain">
Chris PeBenito 99c902f
##	<summary>
Chris PeBenito 99c902f
##	Domain allowed access.
Chris PeBenito 99c902f
##	</summary>
Chris PeBenito 99c902f
## </param>
Chris PeBenito 99c902f
#
Chris PeBenito 99c902f
interface(`apache_search_sys_content',`
Chris PeBenito 99c902f
	gen_require(`
Chris PeBenito 99c902f
		type httpd_sys_content_t;
Chris PeBenito 99c902f
	')
Chris PeBenito 99c902f
Chris PeBenito 99c902f
	allow $1 httpd_sys_content_t:dir search_dir_perms;
Chris PeBenito 99c902f
')
Chris PeBenito 99c902f
Chris PeBenito 99c902f
########################################
Chris PeBenito 99c902f
## <summary>
Chris PeBenito 99c902f
##	Read apache system content.
Chris PeBenito 0f27d98
## </summary>
Chris PeBenito 0f27d98
## <param name="domain">
Chris PeBenito 0f27d98
##	<summary>
Chris PeBenito 0f27d98
##	Domain to not audit.
Chris PeBenito 0f27d98
##	</summary>
Chris PeBenito 0f27d98
## </param>
Chris PeBenito 0f27d98
#
Chris PeBenito 0f27d98
interface(`apache_read_sys_content',`
Chris PeBenito 0f27d98
	gen_require(`
Chris PeBenito 0f27d98
		type httpd_sys_content_t;
Chris PeBenito 0f27d98
	')
Chris PeBenito 0f27d98
Chris PeBenito c0868a7
	allow $1 httpd_sys_content_t:dir list_dir_perms;
Chris PeBenito 0bfccda
	read_files_pattern($1, httpd_sys_content_t, httpd_sys_content_t)
Chris PeBenito 0bfccda
	read_lnk_files_pattern($1, httpd_sys_content_t, httpd_sys_content_t)
Chris PeBenito 0f27d98
')
Chris PeBenito 0f27d98
Chris PeBenito 0f27d98
########################################
Chris PeBenito 0f27d98
## <summary>
Chris PeBenito 371d11e
##	Search apache system CGI directories.
Chris PeBenito 371d11e
## </summary>
Chris PeBenito 371d11e
## <param name="domain">
Chris PeBenito 371d11e
##	<summary>
Chris PeBenito 371d11e
##	Domain allowed access.
Chris PeBenito 371d11e
##	</summary>
Chris PeBenito 371d11e
## </param>
Chris PeBenito 371d11e
#
Chris PeBenito 371d11e
interface(`apache_search_sys_scripts',`
Chris PeBenito 371d11e
	gen_require(`
Chris PeBenito 371d11e
		type httpd_sys_content_t, httpd_sys_script_exec_t;
Chris PeBenito 371d11e
	')
Chris PeBenito 371d11e
Chris PeBenito 371d11e
	search_dirs_pattern($1, httpd_sys_content_t, httpd_sys_script_exec_t)
Chris PeBenito 371d11e
')
Chris PeBenito 371d11e
Chris PeBenito 371d11e
########################################
Chris PeBenito 371d11e
## <summary>
Chris PeBenito a334d29
##	Create, read, write, and delete all user web content.
Chris PeBenito a334d29
## </summary>
Chris PeBenito a334d29
## <param name="domain">
Chris PeBenito a334d29
##	<summary>
Chris PeBenito a334d29
##	Domain allowed access.
Chris PeBenito a334d29
##	</summary>
Chris PeBenito a334d29
## </param>
Chris PeBenito a334d29
## <rolecap/>
Chris PeBenito a334d29
#
Chris PeBenito a334d29
interface(`apache_manage_all_user_content',`
Chris PeBenito a334d29
	gen_require(`
Chris PeBenito a334d29
		attribute httpd_user_content_type, httpd_user_script_exec_type;
Chris PeBenito a334d29
	')
Chris PeBenito a334d29
Chris PeBenito 0bfccda
	manage_dirs_pattern($1, httpd_user_content_type, httpd_user_content_type)
Chris PeBenito 0bfccda
	manage_files_pattern($1, httpd_user_content_type, httpd_user_content_type)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($1, httpd_user_content_type, httpd_user_content_type)
Chris PeBenito a334d29
Chris PeBenito 0bfccda
	manage_dirs_pattern($1, httpd_user_script_exec_type, httpd_user_script_exec_type)
Chris PeBenito 0bfccda
	manage_files_pattern($1, httpd_user_script_exec_type, httpd_user_script_exec_type)
Chris PeBenito 0bfccda
	manage_lnk_files_pattern($1, httpd_user_script_exec_type, httpd_user_script_exec_type)
Chris PeBenito a334d29
')
Chris PeBenito a334d29
Chris PeBenito a334d29
########################################
Chris PeBenito a334d29
## <summary>
Chris PeBenito 9fd4b81
##	Search system script state directory.
Chris PeBenito 9fd4b81
## </summary>
Chris PeBenito 9fd4b81
## <param name="domain">
Chris PeBenito 885b83e
##	<summary>
Chris PeBenito 9fd4b81
##	Domain to not audit.
Chris PeBenito 885b83e
##	</summary>
Chris PeBenito 9fd4b81
## </param>
Chris PeBenito 9fd4b81
#
Chris PeBenito 9fd4b81
interface(`apache_search_sys_script_state',`
Chris PeBenito 9fd4b81
	gen_require(`
Chris PeBenito 9fd4b81
		type httpd_sys_script_t;
Chris PeBenito 9fd4b81
	')
Chris PeBenito 9fd4b81
Chris PeBenito c0868a7
	allow $1 httpd_sys_script_t:dir search_dir_perms;
Chris PeBenito 9fd4b81
')
Chris PeBenito 371d11e
Chris PeBenito 371d11e
########################################
Chris PeBenito 371d11e
## <summary>
Chris PeBenito 371d11e
##	Execute CGI in the specified domain.
Chris PeBenito 371d11e
## </summary>
Chris PeBenito 371d11e
##	<desc>
Chris PeBenito 371d11e
##	

Chris PeBenito 371d11e
##	Execute CGI in the specified domain.
Chris PeBenito 371d11e
##	

Chris PeBenito 371d11e
##	

Chris PeBenito 371d11e
##	This is an interface to support third party modules
Chris PeBenito 371d11e
##	and its use is not allowed in upstream reference
Chris PeBenito 371d11e
##	policy.
Chris PeBenito 371d11e
##	

Chris PeBenito 371d11e
##	</desc>
Chris PeBenito 371d11e
## <param name="domain">
Chris PeBenito 371d11e
##	<summary>
Chris PeBenito 371d11e
##	Domain run the cgi script in.
Chris PeBenito 371d11e
##	</summary>
Chris PeBenito 371d11e
## </param>
Chris PeBenito 371d11e
## <param name="entrypoint">
Chris PeBenito 371d11e
##	<summary>
Chris PeBenito 371d11e
##	Type of the executable to enter the cgi domain.
Chris PeBenito 371d11e
##	</summary>
Chris PeBenito 371d11e
## </param>
Chris PeBenito 371d11e
#
Chris PeBenito 371d11e
interface(`apache_cgi_domain',`
Chris PeBenito 371d11e
	gen_require(`
Chris PeBenito 371d11e
		type httpd_t, httpd_sys_script_exec_t;
Chris PeBenito 371d11e
	')
Chris PeBenito 371d11e
Chris PeBenito 371d11e
	domtrans_pattern(httpd_t, $2, $1)
Chris PeBenito 371d11e
	apache_search_sys_scripts($1)
Chris PeBenito 371d11e
Chris PeBenito 371d11e
	allow httpd_t $1:process signal;
Chris PeBenito 371d11e
')