3f097a
# This policy module provides support for mod_fcgid using the httpd system script domain.
3f097a
# It provides "allow" rules that will overlap to varying degrees with selinux-policy
3f097a
# packages for Fedora 5 onwards, and is a stepping stone to the merged policy included
3f097a
# as updates for selinux-policy in Fedora 8, 9, and 10.
3f097a
#
3f097a
# Rules existing in selinux-policy 2.6.4 (F7) have been stripped from this policy
3f097a
#
3f097a
# Previous versions of this policy module used a separate domain, httpd_fastcgi_script_t,
3f097a
# which is now an alias for httpd_sys_script_t.
3f097a
3f097a
policy_module(fastcgi, 0.2.6)
3f097a
3f097a
require {
3f097a
	type devpts_t;
3f097a
	type httpd_t;
3f097a
	type httpd_log_t;
3f097a
	type httpd_sys_content_t;
3f097a
	type httpd_sys_content_ra_t;
3f097a
	type httpd_sys_content_ro_t;
3f097a
	type httpd_sys_content_rw_t;
3f097a
	type httpd_sys_script_exec_t;
3f097a
	type httpd_sys_script_ra_t;
3f097a
	type httpd_sys_script_ro_t;
3f097a
	type httpd_sys_script_rw_t;
3f097a
	type httpd_sys_script_t;
3f097a
	type httpd_tmp_t;
3f097a
	type httpd_var_run_t;
3f097a
};
3f097a
3f097a
# Type aliases for contexts used with older policy modules
3f097a
typealias httpd_sys_content_t     alias httpd_fastcgi_content_t;
3f097a
typealias httpd_sys_content_ra_t  alias httpd_fastcgi_content_ra_t;
3f097a
typealias httpd_sys_content_ro_t  alias httpd_fastcgi_content_ro_t;
3f097a
typealias httpd_sys_content_rw_t  alias httpd_fastcgi_content_rw_t;
3f097a
typealias httpd_sys_script_exec_t alias httpd_fastcgi_script_exec_t;
3f097a
typealias httpd_sys_script_ra_t   alias httpd_fastcgi_script_ra_t;
3f097a
typealias httpd_sys_script_ro_t   alias httpd_fastcgi_script_ro_t;
3f097a
typealias httpd_sys_script_rw_t   alias httpd_fastcgi_script_rw_t;
3f097a
typealias httpd_sys_script_t      alias httpd_fastcgi_script_t;
3f097a
typealias httpd_var_run_t         alias httpd_fastcgi_var_run_t;
3f097a
3f097a
# ==========================================================
3f097a
# Re-use httpd_sys_script_t for mod_fcgid apps
3f097a
# ==========================================================
3f097a
3f097a
# Allow web applications to call getpw* functions
3f097a
auth_use_nsswitch(httpd_sys_script_t)
3f097a
3f097a
# Allow httpd to create and use files and sockets for communicating with mod_fcgid
3f097a
# Rules to do this are already in selinux-policy apart from dir setattr
3f097a
setattr_dirs_pattern(httpd_t,httpd_var_run_t,httpd_var_run_t)
3f097a
3f097a
# Allow FastCGI applications to listen for FastCGI requests on their
3f097a
# sockets and respond to them
3f097a
allow httpd_sys_script_t httpd_t:unix_stream_socket { rw_stream_socket_perms };
3f097a
3f097a
# These are probably leaked file descriptors
3f097a
dontaudit httpd_t devpts_t:chr_file ioctl;
3f097a
dontaudit httpd_sys_script_t httpd_log_t:file ioctl;
3f097a
3f097a
# PHP uploads a file to /tmp and then execs programs to action them
3f097a
# Rules to do this are already in selinux-policy 2.6.4 (F7) apart from filetrans
3f097a
files_tmp_filetrans(httpd_sys_script_t,httpd_sys_script_rw_t,{ dir file lnk_file sock_file fifo_file })