6554bb3
diff -up serefpolicy-3.10.0/policy/modules/kernel/domain.if.apache serefpolicy-3.10.0/policy/modules/kernel/domain.if
6554bb3
diff -up serefpolicy-3.10.0/policy/modules/kernel/domain.te.apache serefpolicy-3.10.0/policy/modules/kernel/domain.te
6554bb3
diff -up serefpolicy-3.10.0/policy/modules/services/apache.if.apache serefpolicy-3.10.0/policy/modules/services/apache.if
6554bb3
--- serefpolicy-3.10.0/policy/modules/services/apache.if.apache	2011-10-11 10:17:05.262944711 -0400
6554bb3
+++ serefpolicy-3.10.0/policy/modules/services/apache.if	2011-10-11 10:17:13.416929487 -0400
2a89dff
@@ -16,55 +16,43 @@ template(`apache_content_template',`
2a89dff
 		attribute httpd_exec_scripts, httpd_script_exec_type;
2a89dff
 		type httpd_t, httpd_suexec_t, httpd_log_t;
2a89dff
 		type httpd_sys_content_t;
2a89dff
+		attribute httpd_script_type, httpd_content_type;
2a89dff
 	')
2a89dff
 
2a89dff
 	#This type is for webpages
2a89dff
 	type httpd_$1_content_t; # customizable;
2a89dff
+	typeattribute httpd_$1_content_t httpd_content_type;
2a89dff
 	typealias httpd_$1_content_t alias httpd_$1_script_ro_t;
2a89dff
 	files_type(httpd_$1_content_t)
2a89dff
 
2a89dff
 	# This type is used for .htaccess files
2a89dff
-	type httpd_$1_htaccess_t; # customizable;
2a89dff
+	type httpd_$1_htaccess_t, httpd_content_type; # customizable;
2a89dff
+	typeattribute httpd_$1_htaccess_t httpd_content_type;
2a89dff
 	files_type(httpd_$1_htaccess_t)
2a89dff
 
2a89dff
 	# Type that CGI scripts run as
2a89dff
-	type httpd_$1_script_t;
2a89dff
+	type httpd_$1_script_t,	httpd_script_type;
2a89dff
 	domain_type(httpd_$1_script_t)
2a89dff
 	role system_r types httpd_$1_script_t;
2a89dff
 
2a89dff
-	search_dirs_pattern(httpd_$1_script_t, httpd_sys_content_t, httpd_script_exec_type)
2a89dff
-
2a89dff
 	# This type is used for executable scripts files
2a89dff
 	type httpd_$1_script_exec_t, httpd_script_exec_type; # customizable;
2a89dff
-	corecmd_shell_entry_type(httpd_$1_script_t)
2a89dff
+	typeattribute httpd_$1_script_exec_t httpd_content_type;
2a89dff
 	domain_entry_file(httpd_$1_script_t, httpd_$1_script_exec_t)
2a89dff
 
2a89dff
 	type httpd_$1_rw_content_t; # customizable
2a89dff
+	typeattribute httpd_$1_rw_content_t httpd_content_type;
2a89dff
 	typealias httpd_$1_rw_content_t alias { httpd_$1_script_rw_t httpd_$1_content_rw_t };
2a89dff
 	files_type(httpd_$1_rw_content_t)
2a89dff
 
2a89dff
-	type httpd_$1_ra_content_t; # customizable
2a89dff
+	type httpd_$1_ra_content_t, httpd_content_type; # customizable
2a89dff
+	typeattribute httpd_$1_ra_content_t httpd_content_type;
2a89dff
 	typealias httpd_$1_ra_content_t alias { httpd_$1_script_ra_t httpd_$1_content_ra_t };
2a89dff
 	files_type(httpd_$1_ra_content_t)
2a89dff
 
2a89dff
-	read_files_pattern(httpd_t, httpd_$1_content_t, httpd_$1_htaccess_t)
2a89dff
-
2a89dff
-	allow httpd_t { httpd_$1_content_t httpd_$1_rw_content_t httpd_$1_script_exec_t }:dir search_dir_perms;
2a89dff
-	allow httpd_suexec_t { httpd_$1_content_t httpd_$1_rw_content_t httpd_$1_script_exec_t }:dir search_dir_perms;
2a89dff
-
2a89dff
-	allow httpd_$1_script_t self:fifo_file rw_file_perms;
2a89dff
-	allow httpd_$1_script_t self:unix_stream_socket connectto;
2a89dff
-
2a89dff
-	allow httpd_$1_script_t httpd_t:fifo_file write;
2a89dff
-	# apache should set close-on-exec
2a89dff
-	apache_dontaudit_leaks(httpd_$1_script_t)
2a89dff
-
2a89dff
 	# Allow the script process to search the cgi directory, and users directory
2a89dff
 	allow httpd_$1_script_t httpd_$1_content_t:dir search_dir_perms;
2a89dff
 
2a89dff
-	append_files_pattern(httpd_$1_script_t, httpd_log_t, httpd_log_t)
2a89dff
-	logging_search_logs(httpd_$1_script_t)
2a89dff
-
2a89dff
 	can_exec(httpd_$1_script_t, httpd_$1_script_exec_t)
2a89dff
 	allow httpd_$1_script_t httpd_$1_script_exec_t:dir list_dir_perms;
2a89dff
 
2a89dff
@@ -83,27 +71,6 @@ template(`apache_content_template',`
2a89dff
 	manage_fifo_files_pattern(httpd_$1_script_t, httpd_$1_rw_content_t, httpd_$1_rw_content_t)
2a89dff
 	manage_sock_files_pattern(httpd_$1_script_t, httpd_$1_rw_content_t, httpd_$1_rw_content_t)
2a89dff
 
2a89dff
-	kernel_dontaudit_search_sysctl(httpd_$1_script_t)
2a89dff
-	kernel_dontaudit_search_kernel_sysctl(httpd_$1_script_t)
2a89dff
-
2a89dff
-	dev_read_rand(httpd_$1_script_t)
2a89dff
-	dev_read_urand(httpd_$1_script_t)
2a89dff
-
2a89dff
-	corecmd_exec_all_executables(httpd_$1_script_t)
2a89dff
-	application_exec_all(httpd_$1_script_t)
2a89dff
-
2a89dff
-	files_exec_etc_files(httpd_$1_script_t)
2a89dff
-	files_read_etc_files(httpd_$1_script_t)
2a89dff
-	files_search_home(httpd_$1_script_t)
2a89dff
-
2a89dff
-	libs_exec_ld_so(httpd_$1_script_t)
2a89dff
-	libs_exec_lib_files(httpd_$1_script_t)
2a89dff
-
2a89dff
-	miscfiles_read_fonts(httpd_$1_script_t)
2a89dff
-	miscfiles_read_public_files(httpd_$1_script_t)
2a89dff
-
2a89dff
-	seutil_dontaudit_search_config(httpd_$1_script_t)
2a89dff
-
2a89dff
 	# Allow the web server to run scripts and serve pages
2a89dff
 	tunable_policy(`httpd_builtin_scripting',`
2a89dff
 		manage_dirs_pattern(httpd_t, httpd_$1_rw_content_t, httpd_$1_rw_content_t)
2a89dff
@@ -111,19 +78,11 @@ template(`apache_content_template',`
2a89dff
 		manage_lnk_files_pattern(httpd_t, httpd_$1_rw_content_t, httpd_$1_rw_content_t)
2a89dff
 		rw_sock_files_pattern(httpd_t, httpd_$1_rw_content_t, httpd_$1_rw_content_t)
2a89dff
 
2a89dff
-		allow httpd_t httpd_$1_ra_content_t:dir { list_dir_perms add_entry_dir_perms };
2a89dff
+		allow httpd_t httpd_$1_ra_content_t:dir { add_entry_dir_perms };
2a89dff
 		read_files_pattern(httpd_t, httpd_$1_ra_content_t, httpd_$1_ra_content_t)
2a89dff
 		append_files_pattern(httpd_t, httpd_$1_ra_content_t, httpd_$1_ra_content_t)
2a89dff
 		read_lnk_files_pattern(httpd_t, httpd_$1_ra_content_t, httpd_$1_ra_content_t)
2a89dff
 
2a89dff
-		allow httpd_t httpd_$1_content_t:dir list_dir_perms;
2a89dff
-		read_files_pattern(httpd_t, httpd_$1_content_t, httpd_$1_content_t)
2a89dff
-		read_lnk_files_pattern(httpd_t, httpd_$1_content_t, httpd_$1_content_t)
2a89dff
-
2a89dff
-		allow httpd_t httpd_$1_content_t:dir list_dir_perms;
2a89dff
-		read_files_pattern(httpd_t, httpd_$1_content_t, httpd_$1_content_t)
2a89dff
-		read_lnk_files_pattern(httpd_t, httpd_$1_content_t, httpd_$1_content_t)
2a89dff
-		allow httpd_t httpd_$1_script_t:unix_stream_socket connectto;
2a89dff
 	')
2a89dff
 
2a89dff
 	tunable_policy(`httpd_enable_cgi',`
2a89dff
@@ -138,49 +97,6 @@ template(`apache_content_template',`
2a89dff
 
2a89dff
 		# apache runs the script:
2a89dff
 		domtrans_pattern(httpd_t, httpd_$1_script_exec_t, httpd_$1_script_t)
2a89dff
-
2a89dff
-		allow httpd_t httpd_$1_script_exec_t:file read_file_perms;
2a89dff
-		allow httpd_t httpd_$1_script_exec_t:lnk_file read_lnk_file_perms;
2a89dff
-
2a89dff
-		allow httpd_t httpd_$1_script_t:process { signal sigkill sigstop };
2a89dff
-		allow httpd_t httpd_$1_script_exec_t:dir list_dir_perms;
2a89dff
-
2a89dff
-		allow httpd_$1_script_t self:process { setsched signal_perms };
2a89dff
-		allow httpd_$1_script_t self:unix_stream_socket create_stream_socket_perms;
2a89dff
-		allow httpd_$1_script_t self:unix_dgram_socket create_socket_perms;
2a89dff
-
2a89dff
-		allow httpd_$1_script_t httpd_t:fd use;
2a89dff
-		allow httpd_$1_script_t httpd_t:process sigchld;
2a89dff
-
2a89dff
-		dontaudit httpd_$1_script_t httpd_t:tcp_socket { read write };
2a89dff
-
2a89dff
-		kernel_read_system_state(httpd_$1_script_t)
2a89dff
-
2a89dff
-		dev_read_urand(httpd_$1_script_t)
2a89dff
-
2a89dff
-		fs_getattr_xattr_fs(httpd_$1_script_t)
2a89dff
-
2a89dff
-		files_read_etc_runtime_files(httpd_$1_script_t)
2a89dff
-		files_read_usr_files(httpd_$1_script_t)
2a89dff
-
2a89dff
-		libs_read_lib_files(httpd_$1_script_t)
2a89dff
-
2a89dff
-		miscfiles_read_localization(httpd_$1_script_t)
2a89dff
-		allow httpd_$1_script_t httpd_sys_content_t:dir search_dir_perms;
2a89dff
-	')
2a89dff
-
2a89dff
-	optional_policy(`
2a89dff
-		tunable_policy(`httpd_enable_cgi && allow_ypbind',`
2a89dff
-			nis_use_ypbind_uncond(httpd_$1_script_t)
2a89dff
-		')
2a89dff
-	')
2a89dff
-
2a89dff
-	optional_policy(`
2a89dff
-		postgresql_unpriv_client(httpd_$1_script_t)
2a89dff
-	')
2a89dff
-
2a89dff
-	optional_policy(`
2a89dff
-		nscd_socket_use(httpd_$1_script_t)
2a89dff
 	')
2a89dff
 ')
2a89dff
 
6554bb3
diff -up serefpolicy-3.10.0/policy/modules/services/apache.te.apache serefpolicy-3.10.0/policy/modules/services/apache.te
6554bb3
--- serefpolicy-3.10.0/policy/modules/services/apache.te.apache	2011-10-11 10:17:05.263944709 -0400
6554bb3
+++ serefpolicy-3.10.0/policy/modules/services/apache.te	2011-10-11 10:17:13.418929446 -0400
6554bb3
@@ -217,10 +217,12 @@ gen_tunable(allow_httpd_sys_script_anon_
2a89dff
 
2a89dff
 attribute httpdcontent;
2a89dff
 attribute httpd_user_content_type;
2a89dff
+attribute httpd_content_type;
2a89dff
 
2a89dff
 # domains that can exec all users scripts
2a89dff
 attribute httpd_exec_scripts;
2a89dff
 
2a89dff
+attribute httpd_script_type;
2a89dff
 attribute httpd_script_exec_type;
2a89dff
 attribute httpd_user_script_exec_type;
2a89dff
 
2a89dff
@@ -293,6 +295,10 @@ files_tmp_file(httpd_suexec_tmp_t)
2a89dff
 # setup the system domain for system CGI scripts
2a89dff
 apache_content_template(sys)
2a89dff
 
2a89dff
+optional_policy(`
2a89dff
+	postgresql_unpriv_client(httpd_sys_script_t)
2a89dff
+')
2a89dff
+
2a89dff
 typeattribute httpd_sys_content_t httpdcontent; # customizable
2a89dff
 typeattribute httpd_sys_rw_content_t httpdcontent; # customizable
2a89dff
 typeattribute httpd_sys_ra_content_t httpdcontent; # customizable
2a89dff
@@ -1308,3 +1314,91 @@ systemd_passwd_agent_dev_template(httpd)
2a89dff
 domtrans_pattern(httpd_t, httpd_passwd_exec_t, httpd_passwd_t)
2a89dff
 dontaudit httpd_passwd_t httpd_config_t:file read;
2a89dff
 
2a89dff
+
2a89dff
+search_dirs_pattern(httpd_script_type, httpd_sys_content_t, httpd_script_exec_type)
2a89dff
+corecmd_shell_entry_type(httpd_script_type)
2a89dff
+
2a89dff
+allow httpd_script_type self:fifo_file rw_file_perms;
2a89dff
+allow httpd_script_type self:unix_stream_socket connectto;
2a89dff
+
2a89dff
+allow httpd_script_type httpd_t:fifo_file write;
2a89dff
+# apache should set close-on-exec
2a89dff
+apache_dontaudit_leaks(httpd_script_type)
2a89dff
+
2a89dff
+append_files_pattern(httpd_script_type, httpd_log_t, httpd_log_t)
2a89dff
+logging_search_logs(httpd_script_type)
2a89dff
+
2a89dff
+kernel_dontaudit_search_sysctl(httpd_script_type)
2a89dff
+kernel_dontaudit_search_kernel_sysctl(httpd_script_type)
2a89dff
+
2a89dff
+dev_read_rand(httpd_script_type)
2a89dff
+dev_read_urand(httpd_script_type)
2a89dff
+
2a89dff
+corecmd_exec_all_executables(httpd_script_type)
2a89dff
+application_exec_all(httpd_script_type)
2a89dff
+
2a89dff
+files_exec_etc_files(httpd_script_type)
2a89dff
+files_read_etc_files(httpd_script_type)
2a89dff
+files_search_home(httpd_script_type)
2a89dff
+
2a89dff
+libs_exec_ld_so(httpd_script_type)
2a89dff
+libs_exec_lib_files(httpd_script_type)
2a89dff
+
2a89dff
+miscfiles_read_fonts(httpd_script_type)
2a89dff
+miscfiles_read_public_files(httpd_script_type)
2a89dff
+
2a89dff
+seutil_dontaudit_search_config(httpd_script_type)
2a89dff
+allow httpd_t httpd_script_type:unix_stream_socket connectto;
2a89dff
+
2a89dff
+allow httpd_t httpd_script_exec_type:file read_file_perms;
2a89dff
+allow httpd_t httpd_script_exec_type:lnk_file read_lnk_file_perms;
2a89dff
+allow httpd_t httpd_script_type:process { signal sigkill sigstop };
2a89dff
+allow httpd_t httpd_script_exec_type:dir list_dir_perms;
2a89dff
+
2a89dff
+allow httpd_script_type self:process { setsched signal_perms };
2a89dff
+allow httpd_script_type self:unix_stream_socket create_stream_socket_perms;
2a89dff
+allow httpd_script_type self:unix_dgram_socket create_socket_perms;
2a89dff
+
2a89dff
+allow httpd_script_type httpd_t:fd use;
2a89dff
+allow httpd_script_type httpd_t:process sigchld;
2a89dff
+
2a89dff
+dontaudit httpd_script_type httpd_t:tcp_socket { read write };
2a89dff
+
2a89dff
+kernel_read_system_state(httpd_script_type)
2a89dff
+
2a89dff
+dev_read_urand(httpd_script_type)
2a89dff
+
2a89dff
+fs_getattr_xattr_fs(httpd_script_type)
2a89dff
+
2a89dff
+files_read_etc_runtime_files(httpd_script_type)
2a89dff
+files_read_usr_files(httpd_script_type)
2a89dff
+
2a89dff
+libs_read_lib_files(httpd_script_type)
2a89dff
+
2a89dff
+miscfiles_read_localization(httpd_script_type)
2a89dff
+allow httpd_script_type httpd_sys_content_t:dir search_dir_perms;
2a89dff
+
2a89dff
+tunable_policy(`httpd_enable_cgi && allow_ypbind',`
2a89dff
+	nis_use_ypbind_uncond(httpd_script_type)
2a89dff
+')
2a89dff
+
2a89dff
+optional_policy(`
2a89dff
+	nscd_socket_use(httpd_script_type)
2a89dff
+')
2a89dff
+
2a89dff
+read_files_pattern(httpd_t, httpd_content_type, httpd_content_type)
2a89dff
+
2a89dff
+tunable_policy(`httpd_builtin_scripting',`
2a89dff
+	allow httpd_t httpd_content_type:dir search_dir_perms;
2a89dff
+	allow httpd_suexec_t httpd_content_type:dir search_dir_perms;
2a89dff
+
2a89dff
+	allow httpd_t httpd_content_type:dir list_dir_perms;
2a89dff
+	read_files_pattern(httpd_t, httpd_content_type, httpd_content_type)
2a89dff
+	read_lnk_files_pattern(httpd_t, httpd_content_type, httpd_content_type)
2a89dff
+
2a89dff
+	allow httpd_t httpd_content_type:dir list_dir_perms;
2a89dff
+	read_files_pattern(httpd_t, httpd_content_type, httpd_content_type)
2a89dff
+	read_lnk_files_pattern(httpd_t, httpd_content_type, httpd_content_type)
2a89dff
+')
2a89dff
+
2a89dff
+