selinux-policy/policy/modules/services/apache.te

1193 lines
34 KiB
Plaintext
Raw Normal View History

2010-05-24 19:32:01 +00:00
policy_module(apache, 2.2.0)
2005-09-29 20:59:00 +00:00
#
2010-04-05 18:05:05 +00:00
# NOTES:
2005-09-29 20:59:00 +00:00
# This policy will work with SUEXEC enabled as part of the Apache
# configuration. However, the user CGI scripts will run under the
2008-11-05 16:10:46 +00:00
# system_u:system_r:httpd_user_script_t.
2005-09-29 20:59:00 +00:00
#
2008-11-05 16:10:46 +00:00
# The user CGI scripts must be labeled with the httpd_user_script_exec_t
2005-09-29 20:59:00 +00:00
# type, and the directory containing the scripts should also be labeled
2010-04-05 18:05:05 +00:00
# with these types. This policy allows the user role to perform that
2008-11-05 16:10:46 +00:00
# relabeling. If it is desired that only admin role should be able to relabel
# the user CGI scripts, then relabel rule for user roles should be removed.
2005-09-29 20:59:00 +00:00
#
########################################
#
# Declarations
#
2010-08-26 13:41:21 +00:00
selinux_genbool(httpd_bool_t)
## <desc>
## <p>
## Allow Apache to modify public files
## used for public file transfer services. Directories/Files must
## be labeled public_content_rw_t.
## </p>
## </desc>
gen_tunable(allow_httpd_anon_write, false)
## <desc>
## <p>
## Allow Apache to use mod_auth_pam
## </p>
## </desc>
gen_tunable(allow_httpd_mod_auth_pam, false)
2010-09-17 06:56:33 +00:00
## <desc>
## <p>
## Allow Apache to use mod_auth_pam
## </p>
## </desc>
gen_tunable(allow_httpd_mod_auth_ntlm_winbind, false)
2010-08-26 13:41:21 +00:00
## <desc>
## <p>
## Allow httpd scripts and modules execmem/execstack
## </p>
2010-08-26 13:41:21 +00:00
## </desc>
gen_tunable(httpd_execmem, false)
## <desc>
## <p>
## Allow httpd daemon to change system limits
## </p>
2010-08-26 13:41:21 +00:00
## </desc>
gen_tunable(httpd_setrlimit, false)
## <desc>
## <p>
## Allow httpd to use built in scripting (usually php)
## </p>
## </desc>
gen_tunable(httpd_builtin_scripting, false)
## <desc>
## <p>
## Allow HTTPD scripts and modules to connect to the network using any TCP port.
## </p>
## </desc>
gen_tunable(httpd_can_network_connect, false)
2010-08-26 13:41:21 +00:00
## <desc>
## <p>
## Allow HTTPD scripts and modules to connect to cobbler over the network.
## </p>
2010-08-26 13:41:21 +00:00
## </desc>
gen_tunable(httpd_can_network_connect_cobbler, false)
## <desc>
## <p>
## Allow HTTPD scripts and modules to connect to databases over the network.
## </p>
## </desc>
gen_tunable(httpd_can_network_connect_db, false)
## <desc>
## <p>
## Allow httpd to connect to memcache server
## </p>
## </desc>
gen_tunable(httpd_can_network_memcache, false)
## <desc>
## <p>
## Allow httpd to act as a relay
## </p>
## </desc>
gen_tunable(httpd_can_network_relay, false)
## <desc>
## <p>
## Allow http daemon to send mail
## </p>
## </desc>
gen_tunable(httpd_can_sendmail, false)
2010-08-26 13:41:21 +00:00
## <desc>
## <p>
## Allow http daemon to check spam
## </p>
2010-08-26 13:41:21 +00:00
## </desc>
gen_tunable(httpd_can_check_spam, false)
## <desc>
## <p>
## Allow Apache to communicate with avahi service via dbus
## </p>
## </desc>
gen_tunable(httpd_dbus_avahi, false)
## <desc>
## <p>
## Allow httpd to execute cgi scripts
## </p>
## </desc>
gen_tunable(httpd_enable_cgi, false)
## <desc>
## <p>
## Allow httpd to act as a FTP server by
## listening on the ftp port.
## </p>
## </desc>
gen_tunable(httpd_enable_ftp_server, false)
## <desc>
## <p>
## Allow httpd to read home directories
## </p>
## </desc>
gen_tunable(httpd_enable_homedirs, false)
2010-08-26 13:41:21 +00:00
## <desc>
## <p>
## Allow httpd to read user content
## </p>
2010-08-26 13:41:21 +00:00
## </desc>
gen_tunable(httpd_read_user_content, false)
## <desc>
## <p>
## Allow HTTPD to run SSI executables in the same domain as system CGI scripts.
## </p>
## </desc>
gen_tunable(httpd_ssi_exec, false)
2010-08-26 13:41:21 +00:00
## <desc>
## <p>
## Allow Apache to execute tmp content.
## </p>
2010-08-26 13:41:21 +00:00
## </desc>
gen_tunable(httpd_tmp_exec, false)
## <desc>
## <p>
## Unify HTTPD to communicate with the terminal.
## Needed for entering the passphrase for certificates at
## the terminal.
## </p>
## </desc>
gen_tunable(httpd_tty_comm, false)
## <desc>
## <p>
## Unify HTTPD handling of all content files.
## </p>
## </desc>
gen_tunable(httpd_unified, false)
## <desc>
## <p>
## Allow httpd to access cifs file systems
## </p>
## </desc>
gen_tunable(httpd_use_cifs, false)
## <desc>
## <p>
## Allow httpd to run gpg in gpg-web domain
## </p>
## </desc>
gen_tunable(httpd_use_gpg, false)
## <desc>
## <p>
## Allow httpd to access nfs file systems
## </p>
## </desc>
gen_tunable(httpd_use_nfs, false)
2010-08-26 13:41:21 +00:00
## <desc>
## <p>
## Allow apache scripts to write to public content. Directories/Files must be labeled public_rw_content_t.
## </p>
2010-08-26 13:41:21 +00:00
## </desc>
gen_tunable(allow_httpd_sys_script_anon_write, false)
2005-09-29 20:59:00 +00:00
attribute httpdcontent;
attribute httpd_user_content_type;
2005-09-29 20:59:00 +00:00
2005-10-17 17:55:38 +00:00
# domains that can exec all users scripts
attribute httpd_exec_scripts;
attribute httpd_script_exec_type;
attribute httpd_user_script_exec_type;
2005-10-17 17:55:38 +00:00
# user script domains
attribute httpd_script_domains;
2005-09-29 20:59:00 +00:00
type httpd_t;
type httpd_exec_t;
init_daemon_domain(httpd_t, httpd_exec_t)
2005-10-17 17:55:38 +00:00
role system_r types httpd_t;
2005-09-29 20:59:00 +00:00
# httpd_cache_t is the type given to the /var/cache/httpd
# directory and the files under that directory
type httpd_cache_t;
files_type(httpd_cache_t)
# httpd_config_t is the type given to the configuration files
type httpd_config_t;
files_type(httpd_config_t)
type httpd_helper_t;
type httpd_helper_exec_t;
2005-10-17 17:55:38 +00:00
domain_type(httpd_helper_t)
domain_entry_file(httpd_helper_t, httpd_helper_exec_t)
2005-10-17 17:55:38 +00:00
role system_r types httpd_helper_t;
2005-09-29 20:59:00 +00:00
type httpd_initrc_exec_t;
init_script_file(httpd_initrc_exec_t)
2005-09-29 20:59:00 +00:00
type httpd_lock_t;
files_lock_file(httpd_lock_t)
type httpd_log_t;
logging_log_file(httpd_log_t)
2010-04-05 18:05:05 +00:00
# httpd_modules_t is the type given to module files (libraries)
2005-09-29 20:59:00 +00:00
# that come with Apache /etc/httpd/modules and /usr/lib/apache
type httpd_modules_t;
files_type(httpd_modules_t)
type httpd_php_t;
type httpd_php_exec_t;
2005-10-17 17:55:38 +00:00
domain_type(httpd_php_t)
domain_entry_file(httpd_php_t, httpd_php_exec_t)
2005-10-17 17:55:38 +00:00
role system_r types httpd_php_t;
2005-09-29 20:59:00 +00:00
type httpd_php_tmp_t;
files_tmp_file(httpd_php_tmp_t)
type httpd_rotatelogs_t;
type httpd_rotatelogs_exec_t;
init_daemon_domain(httpd_rotatelogs_t, httpd_rotatelogs_exec_t)
2005-09-29 20:59:00 +00:00
type httpd_squirrelmail_t;
files_type(httpd_squirrelmail_t)
# SUEXEC runs user scripts as their own user ID
type httpd_suexec_t; #, daemon;
type httpd_suexec_exec_t;
2005-10-17 17:55:38 +00:00
domain_type(httpd_suexec_t)
domain_entry_file(httpd_suexec_t, httpd_suexec_exec_t)
2005-10-17 17:55:38 +00:00
role system_r types httpd_suexec_t;
2005-09-29 20:59:00 +00:00
type httpd_suexec_tmp_t;
files_tmp_file(httpd_suexec_tmp_t)
2005-10-12 16:23:22 +00:00
# setup the system domain for system CGI scripts
apache_content_template(sys)
2010-08-26 13:41:21 +00:00
typeattribute httpd_sys_content_t httpdcontent; # customizable
typeattribute httpd_sys_rw_content_t httpdcontent; # customizable
typeattribute httpd_sys_ra_content_t httpdcontent; # customizable
2005-10-12 16:23:22 +00:00
# Removal of fastcgi, will cause problems without the following
typealias httpd_sys_script_exec_t alias httpd_fastcgi_script_exec_t;
typealias httpd_sys_content_t alias { httpd_fastcgi_content_t httpd_fastcgi_script_ro_t };
typealias httpd_sys_rw_content_t alias { httpd_fastcgi_rw_content_t httpd_fastcgi_script_rw_t };
typealias httpd_sys_ra_content_t alias httpd_fastcgi_script_ra_t;
typealias httpd_sys_script_t alias httpd_fastcgi_script_t;
2005-09-29 20:59:00 +00:00
type httpd_tmp_t;
files_tmp_file(httpd_tmp_t)
type httpd_tmpfs_t;
files_tmpfs_file(httpd_tmpfs_t)
2008-11-05 16:10:46 +00:00
apache_content_template(user)
ubac_constrained(httpd_user_script_t)
2010-08-26 13:41:21 +00:00
typeattribute httpd_user_content_t httpdcontent;
typeattribute httpd_user_rw_content_t httpdcontent;
typeattribute httpd_user_ra_content_t httpdcontent;
2008-11-05 16:10:46 +00:00
userdom_user_home_content(httpd_user_content_t)
userdom_user_home_content(httpd_user_htaccess_t)
userdom_user_home_content(httpd_user_script_exec_t)
userdom_user_home_content(httpd_user_ra_content_t)
userdom_user_home_content(httpd_user_rw_content_t)
2008-11-05 16:10:46 +00:00
typeattribute httpd_user_script_t httpd_script_domains;
typealias httpd_user_content_t alias { httpd_staff_content_t httpd_sysadm_content_t };
2010-08-26 13:41:21 +00:00
typealias httpd_user_content_t alias httpd_unconfined_content_t;
2008-11-05 16:10:46 +00:00
typealias httpd_user_content_t alias { httpd_auditadm_content_t httpd_secadm_content_t };
typealias httpd_user_content_t alias { httpd_staff_script_ro_t httpd_sysadm_script_ro_t };
typealias httpd_user_content_t alias { httpd_auditadm_script_ro_t httpd_secadm_script_ro_t };
2008-11-05 16:10:46 +00:00
typealias httpd_user_htaccess_t alias { httpd_staff_htaccess_t httpd_sysadm_htaccess_t };
typealias httpd_user_htaccess_t alias { httpd_auditadm_htaccess_t httpd_secadm_htaccess_t };
typealias httpd_user_script_t alias { httpd_staff_script_t httpd_sysadm_script_t };
typealias httpd_user_script_t alias { httpd_auditadm_script_t httpd_secadm_script_t };
typealias httpd_user_script_exec_t alias { httpd_staff_script_exec_t httpd_sysadm_script_exec_t };
typealias httpd_user_script_exec_t alias { httpd_auditadm_script_exec_t httpd_secadm_script_exec_t };
typealias httpd_user_rw_content_t alias { httpd_staff_script_rw_t httpd_sysadm_script_rw_t };
typealias httpd_user_rw_content_t alias { httpd_auditadm_script_rw_t httpd_secadm_script_rw_t };
typealias httpd_user_ra_content_t alias { httpd_staff_script_ra_t httpd_sysadm_script_ra_t };
typealias httpd_user_ra_content_t alias { httpd_auditadm_script_ra_t httpd_secadm_script_ra_t };
2008-11-05 16:10:46 +00:00
2005-09-29 20:59:00 +00:00
# for apache2 memory mapped files
type httpd_var_lib_t;
files_type(httpd_var_lib_t)
type httpd_var_run_t;
files_pid_file(httpd_var_run_t)
# Removal of fastcgi, will cause problems without the following
typealias httpd_var_run_t alias httpd_fastcgi_var_run_t;
2005-09-29 20:59:00 +00:00
# File Type of squirrelmail attachments
type squirrelmail_spool_t;
files_tmp_file(squirrelmail_spool_t)
optional_policy(`
2006-01-11 23:20:28 +00:00
prelink_object_file(httpd_modules_t)
')
2005-09-29 20:59:00 +00:00
########################################
#
# Apache server local policy
#
allow httpd_t self:capability { chown dac_override kill setgid setuid sys_nice sys_tty_config };
2005-09-29 20:59:00 +00:00
dontaudit httpd_t self:capability { net_admin sys_tty_config };
allow httpd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
allow httpd_t self:fd use;
2006-12-12 20:08:08 +00:00
allow httpd_t self:sock_file read_sock_file_perms;
allow httpd_t self:fifo_file rw_fifo_file_perms;
2005-09-29 20:59:00 +00:00
allow httpd_t self:shm create_shm_perms;
allow httpd_t self:sem create_sem_perms;
allow httpd_t self:msgq create_msgq_perms;
allow httpd_t self:msg { send receive };
2006-05-12 18:43:31 +00:00
allow httpd_t self:unix_dgram_socket { create_socket_perms sendto };
allow httpd_t self:unix_stream_socket { create_stream_socket_perms connectto };
2006-08-15 20:00:58 +00:00
allow httpd_t self:tcp_socket create_stream_socket_perms;
2006-05-12 18:43:31 +00:00
allow httpd_t self:udp_socket create_socket_perms;
dontaudit httpd_t self:netlink_audit_socket create_socket_perms;
2005-09-29 20:59:00 +00:00
# Allow httpd_t to put files in /var/cache/httpd etc
manage_dirs_pattern(httpd_t, httpd_cache_t, httpd_cache_t)
manage_files_pattern(httpd_t, httpd_cache_t, httpd_cache_t)
manage_lnk_files_pattern(httpd_t, httpd_cache_t, httpd_cache_t)
2010-08-26 13:41:21 +00:00
files_var_filetrans(httpd_t, httpd_cache_t, { file dir })
2005-09-29 20:59:00 +00:00
# Allow the httpd_t to read the web servers config files
2006-12-12 20:08:08 +00:00
allow httpd_t httpd_config_t:dir list_dir_perms;
read_files_pattern(httpd_t, httpd_config_t, httpd_config_t)
read_lnk_files_pattern(httpd_t, httpd_config_t, httpd_config_t)
2005-09-29 20:59:00 +00:00
can_exec(httpd_t, httpd_exec_t)
2006-12-12 20:08:08 +00:00
allow httpd_t httpd_lock_t:file manage_file_perms;
files_lock_filetrans(httpd_t, httpd_lock_t, file)
2005-09-29 20:59:00 +00:00
2006-12-12 20:08:08 +00:00
allow httpd_t httpd_log_t:dir setattr;
create_files_pattern(httpd_t, httpd_log_t, httpd_log_t)
append_files_pattern(httpd_t, httpd_log_t, httpd_log_t)
read_files_pattern(httpd_t, httpd_log_t, httpd_log_t)
read_lnk_files_pattern(httpd_t, httpd_log_t, httpd_log_t)
2005-10-12 16:23:22 +00:00
# cjp: need to refine create interfaces to
# cut this back to add_name only
logging_log_filetrans(httpd_t, httpd_log_t, file)
2005-09-29 20:59:00 +00:00
2006-12-12 20:08:08 +00:00
allow httpd_t httpd_modules_t:dir list_dir_perms;
mmap_files_pattern(httpd_t, httpd_modules_t, httpd_modules_t)
read_files_pattern(httpd_t, httpd_modules_t, httpd_modules_t)
read_lnk_files_pattern(httpd_t, httpd_modules_t, httpd_modules_t)
2005-09-29 20:59:00 +00:00
apache_domtrans_rotatelogs(httpd_t)
# Apache-httpd needs to be able to send signals to the log rotate procs.
allow httpd_t httpd_rotatelogs_t:process signal_perms;
manage_dirs_pattern(httpd_t, httpd_squirrelmail_t, httpd_squirrelmail_t)
manage_files_pattern(httpd_t, httpd_squirrelmail_t, httpd_squirrelmail_t)
manage_lnk_files_pattern(httpd_t, httpd_squirrelmail_t, httpd_squirrelmail_t)
2005-09-29 20:59:00 +00:00
allow httpd_t httpd_suexec_exec_t:file read_file_perms;
2005-11-08 22:00:30 +00:00
2006-12-12 20:08:08 +00:00
allow httpd_t httpd_sys_content_t:dir list_dir_perms;
read_files_pattern(httpd_t, httpd_sys_content_t, httpd_sys_content_t)
read_lnk_files_pattern(httpd_t, httpd_sys_content_t, httpd_sys_content_t)
allow httpd_t httpd_sys_script_t:unix_stream_socket connectto;
manage_dirs_pattern(httpd_t, httpd_tmp_t, httpd_tmp_t)
manage_files_pattern(httpd_t, httpd_tmp_t, httpd_tmp_t)
manage_lnk_files_pattern(httpd_t, httpd_tmp_t, httpd_tmp_t)
files_tmp_filetrans(httpd_t, httpd_tmp_t, { file dir lnk_file })
2005-09-29 20:59:00 +00:00
manage_dirs_pattern(httpd_t, httpd_tmpfs_t, httpd_tmpfs_t)
manage_files_pattern(httpd_t, httpd_tmpfs_t, httpd_tmpfs_t)
manage_lnk_files_pattern(httpd_t, httpd_tmpfs_t, httpd_tmpfs_t)
manage_fifo_files_pattern(httpd_t, httpd_tmpfs_t, httpd_tmpfs_t)
manage_sock_files_pattern(httpd_t, httpd_tmpfs_t, httpd_tmpfs_t)
2010-04-05 18:05:05 +00:00
fs_tmpfs_filetrans(httpd_t, httpd_tmpfs_t, { dir file lnk_file sock_file fifo_file })
2005-09-29 20:59:00 +00:00
manage_files_pattern(httpd_t, httpd_var_lib_t, httpd_var_lib_t)
files_var_lib_filetrans(httpd_t, httpd_var_lib_t, file)
2005-09-29 20:59:00 +00:00
setattr_dirs_pattern(httpd_t, httpd_var_run_t, httpd_var_run_t)
manage_dirs_pattern(httpd_t, httpd_var_run_t, httpd_var_run_t)
manage_files_pattern(httpd_t, httpd_var_run_t, httpd_var_run_t)
manage_sock_files_pattern(httpd_t, httpd_var_run_t, httpd_var_run_t)
files_pid_filetrans(httpd_t, httpd_var_run_t, { file sock_file dir })
2005-09-29 20:59:00 +00:00
manage_dirs_pattern(httpd_t, squirrelmail_spool_t, squirrelmail_spool_t)
manage_files_pattern(httpd_t, squirrelmail_spool_t, squirrelmail_spool_t)
manage_lnk_files_pattern(httpd_t, squirrelmail_spool_t, squirrelmail_spool_t)
2005-09-29 20:59:00 +00:00
kernel_read_kernel_sysctls(httpd_t)
2005-09-29 20:59:00 +00:00
# for modules that want to access /proc/meminfo
kernel_read_system_state(httpd_t)
2010-08-26 13:41:21 +00:00
kernel_search_network_sysctl(httpd_t)
2005-09-29 20:59:00 +00:00
corenet_all_recvfrom_unlabeled(httpd_t)
corenet_all_recvfrom_netlabel(httpd_t)
corenet_tcp_sendrecv_generic_if(httpd_t)
corenet_udp_sendrecv_generic_if(httpd_t)
corenet_tcp_sendrecv_generic_node(httpd_t)
corenet_udp_sendrecv_generic_node(httpd_t)
2005-09-29 20:59:00 +00:00
corenet_tcp_sendrecv_all_ports(httpd_t)
corenet_udp_sendrecv_all_ports(httpd_t)
corenet_tcp_bind_generic_node(httpd_t)
2010-08-26 13:41:21 +00:00
corenet_udp_bind_generic_node(httpd_t)
2005-09-29 20:59:00 +00:00
corenet_tcp_bind_http_port(httpd_t)
corenet_tcp_bind_http_cache_port(httpd_t)
2010-08-26 13:41:21 +00:00
corenet_tcp_bind_ntop_port(httpd_t)
2006-05-26 20:46:37 +00:00
corenet_sendrecv_http_server_packets(httpd_t)
# Signal self for shutdown
corenet_tcp_connect_http_port(httpd_t)
2005-09-29 20:59:00 +00:00
dev_read_sysfs(httpd_t)
dev_read_rand(httpd_t)
dev_read_urand(httpd_t)
2005-10-12 16:23:22 +00:00
dev_rw_crypto(httpd_t)
2005-09-29 20:59:00 +00:00
fs_getattr_all_fs(httpd_t)
fs_search_auto_mountpoints(httpd_t)
2010-08-26 13:41:21 +00:00
fs_read_iso9660_files(httpd_t)
fs_read_anon_inodefs_files(httpd_t)
2005-09-29 20:59:00 +00:00
auth_use_nsswitch(httpd_t)
2010-08-26 13:41:21 +00:00
application_exec_all(httpd_t)
2005-09-29 20:59:00 +00:00
2006-02-20 21:33:25 +00:00
domain_use_interactive_fds(httpd_t)
2005-09-29 20:59:00 +00:00
files_dontaudit_getattr_all_pids(httpd_t)
2005-09-29 20:59:00 +00:00
files_read_usr_files(httpd_t)
files_list_mnt(httpd_t)
files_search_spool(httpd_t)
files_read_var_lib_files(httpd_t)
files_search_home(httpd_t)
files_getattr_home_dir(httpd_t)
# for modules that want to access /etc/mtab
files_read_etc_runtime_files(httpd_t)
# Allow httpd_t to have access to files such as nisswitch.conf
files_read_etc_files(httpd_t)
2005-10-05 21:17:22 +00:00
# for tomcat
files_read_var_lib_symlinks(httpd_t)
2005-09-29 20:59:00 +00:00
fs_search_auto_mountpoints(httpd_sys_script_t)
2010-08-26 13:41:21 +00:00
# php uploads a file to /tmp and then execs programs to acton them
manage_dirs_pattern(httpd_sys_script_t, httpd_tmp_t, httpd_tmp_t)
manage_files_pattern(httpd_sys_script_t, httpd_tmp_t, httpd_tmp_t)
files_tmp_filetrans(httpd_sys_script_t, httpd_sys_rw_content_t, { dir file lnk_file sock_file fifo_file })
2006-02-02 21:08:12 +00:00
libs_read_lib_files(httpd_t)
2005-09-29 20:59:00 +00:00
logging_send_syslog_msg(httpd_t)
miscfiles_read_localization(httpd_t)
miscfiles_read_fonts(httpd_t)
2005-10-05 21:17:22 +00:00
miscfiles_read_public_files(httpd_t)
miscfiles_read_generic_certs(httpd_t)
2005-09-29 20:59:00 +00:00
seutil_dontaudit_search_config(httpd_t)
2006-02-21 18:40:44 +00:00
userdom_use_unpriv_users_fds(httpd_t)
2005-09-29 20:59:00 +00:00
2010-08-26 13:41:21 +00:00
tunable_policy(`httpd_setrlimit',`
allow httpd_t self:process setrlimit;
')
2005-10-05 21:17:22 +00:00
tunable_policy(`allow_httpd_anon_write',`
miscfiles_manage_public_files(httpd_t)
2010-04-05 18:05:05 +00:00
')
2005-10-05 21:17:22 +00:00
#
# We need optionals to be able to be within booleans to make this work
#
tunable_policy(`allow_httpd_mod_auth_pam',`
2010-08-26 13:41:21 +00:00
auth_domtrans_chkpwd(httpd_t)
logging_send_audit_msgs(httpd_t)
')
optional_policy(`
tunable_policy(`allow_httpd_mod_auth_ntlm_winbind',`
2010-08-26 13:41:21 +00:00
samba_domtrans_winbind_helper(httpd_t)
')
')
2005-10-05 21:17:22 +00:00
tunable_policy(`httpd_can_network_connect',`
corenet_tcp_connect_all_ports(httpd_t)
')
2010-09-17 07:21:55 +00:00
tunable_policy(`httpd_can_network_connect_db',`
corenet_tcp_connect_mssql_port(httpd_t)
corenet_sendrecv_mssql_client_packets(httpd_t)
')
tunable_policy(`httpd_can_network_memcache',`
corenet_tcp_connect_memcache_port(httpd_t)
')
2005-12-12 21:47:43 +00:00
tunable_policy(`httpd_can_network_relay',`
# allow httpd to work as a relay
corenet_tcp_connect_gopher_port(httpd_t)
corenet_tcp_connect_ftp_port(httpd_t)
corenet_tcp_connect_http_port(httpd_t)
corenet_tcp_connect_http_cache_port(httpd_t)
2010-08-26 13:41:21 +00:00
corenet_tcp_connect_squid_port(httpd_t)
corenet_tcp_connect_memcache_port(httpd_t)
2006-05-30 19:46:34 +00:00
corenet_sendrecv_gopher_client_packets(httpd_t)
corenet_sendrecv_ftp_client_packets(httpd_t)
corenet_sendrecv_http_client_packets(httpd_t)
corenet_sendrecv_http_cache_client_packets(httpd_t)
2010-08-26 13:41:21 +00:00
corenet_sendrecv_squid_client_packets(httpd_t)
')
tunable_policy(`httpd_execmem',`
allow httpd_t self:process { execmem execstack };
allow httpd_sys_script_t self:process { execmem execstack };
allow httpd_suexec_t self:process { execmem execstack };
')
2010-08-26 13:41:21 +00:00
tunable_policy(`httpd_enable_cgi && httpd_unified',`
allow httpd_sys_script_t httpd_sys_content_t:file entrypoint;
filetrans_pattern(httpd_sys_script_t, httpd_sys_content_t, httpd_sys_rw_content_t, { file dir lnk_file })
can_exec(httpd_sys_script_t, httpd_sys_content_t)
2005-12-12 21:47:43 +00:00
')
2010-08-26 13:41:21 +00:00
tunable_policy(`allow_httpd_sys_script_anon_write',`
miscfiles_manage_public_files(httpd_sys_script_t)
')
2010-08-26 13:41:21 +00:00
tunable_policy(`httpd_enable_cgi && httpd_use_nfs',`
fs_nfs_domtrans(httpd_t, httpd_sys_script_t)
')
tunable_policy(`httpd_enable_cgi && httpd_use_cifs',`
fs_cifs_domtrans(httpd_t, httpd_sys_script_t)
')
2005-10-05 21:17:22 +00:00
tunable_policy(`httpd_enable_cgi && httpd_unified && httpd_builtin_scripting',`
2006-12-12 20:08:08 +00:00
domtrans_pattern(httpd_t, httpdcontent, httpd_sys_script_t)
2010-08-26 13:41:21 +00:00
filetrans_pattern(httpd_t, httpd_sys_content_t, httpd_sys_rw_content_t, { file dir lnk_file })
manage_dirs_pattern(httpd_t, httpdcontent, httpd_sys_rw_content_t)
manage_files_pattern(httpd_t, httpdcontent, httpd_sys_rw_content_t)
manage_lnk_files_pattern(httpd_t, httpdcontent, httpd_sys_rw_content_t)
2005-10-05 21:17:22 +00:00
manage_dirs_pattern(httpd_t, httpdcontent, httpdcontent)
manage_files_pattern(httpd_t, httpdcontent, httpdcontent)
manage_lnk_files_pattern(httpd_t, httpdcontent, httpdcontent)
2005-10-05 21:17:22 +00:00
')
2005-10-31 19:58:51 +00:00
tunable_policy(`httpd_enable_ftp_server',`
corenet_tcp_bind_ftp_port(httpd_t)
')
2010-08-26 13:41:21 +00:00
tunable_policy(`httpd_tmp_exec && httpd_builtin_scripting',`
can_exec(httpd_t, httpd_tmp_t)
2010-08-26 13:41:21 +00:00
')
tunable_policy(`httpd_tmp_exec && httpd_enable_cgi',`
can_exec(httpd_sys_script_t, httpd_tmp_t)
2010-08-26 13:41:21 +00:00
')
2005-09-29 20:59:00 +00:00
tunable_policy(`httpd_enable_homedirs && use_nfs_home_dirs',`
fs_read_nfs_files(httpd_t)
fs_read_nfs_symlinks(httpd_t)
')
2010-08-26 13:41:21 +00:00
tunable_policy(`httpd_use_nfs',`
fs_manage_nfs_dirs(httpd_t)
fs_manage_nfs_files(httpd_t)
fs_manage_nfs_symlinks(httpd_t)
')
2005-09-29 20:59:00 +00:00
tunable_policy(`httpd_enable_homedirs && use_samba_home_dirs',`
fs_read_cifs_files(httpd_t)
fs_read_cifs_symlinks(httpd_t)
')
tunable_policy(`httpd_can_sendmail',`
# allow httpd to connect to mail servers
corenet_tcp_connect_smtp_port(httpd_t)
corenet_sendrecv_smtp_client_packets(httpd_t)
2010-08-26 13:41:21 +00:00
corenet_tcp_connect_pop_port(httpd_t)
corenet_sendrecv_pop_client_packets(httpd_t)
mta_send_mail(httpd_t)
2010-08-26 13:41:21 +00:00
mta_signal_system_mail(httpd_t)
')
tunable_policy(`httpd_use_cifs',`
fs_manage_cifs_dirs(httpd_t)
fs_manage_cifs_files(httpd_t)
fs_manage_cifs_symlinks(httpd_t)
')
2005-10-17 17:55:38 +00:00
tunable_policy(`httpd_ssi_exec',`
2009-06-26 14:40:13 +00:00
corecmd_shell_domtrans(httpd_t, httpd_sys_script_t)
2005-10-17 17:55:38 +00:00
allow httpd_sys_script_t httpd_t:fd use;
allow httpd_sys_script_t httpd_t:fifo_file rw_file_perms;
allow httpd_sys_script_t httpd_t:process sigchld;
')
2005-10-05 21:17:22 +00:00
# When the admin starts the server, the server wants to access
# the TTY or PTY associated with the session. The httpd appears
# to run correctly without this permission, so the permission
2010-04-05 18:05:05 +00:00
# are dontaudited here.
2005-10-05 21:17:22 +00:00
tunable_policy(`httpd_tty_comm',`
2008-11-05 16:10:46 +00:00
userdom_use_user_terminals(httpd_t)
2010-08-26 13:41:21 +00:00
userdom_use_user_terminals(httpd_suexec_t)
2005-10-05 21:17:22 +00:00
',`
2008-11-05 16:10:46 +00:00
userdom_dontaudit_use_user_terminals(httpd_t)
2010-08-26 13:41:21 +00:00
userdom_dontaudit_use_user_terminals(httpd_suexec_t)
2005-09-29 20:59:00 +00:00
')
optional_policy(`
2006-03-21 20:12:24 +00:00
calamaris_read_www_files(httpd_t)
')
optional_policy(`
ccs_read_config(httpd_t)
')
optional_policy(`
2010-08-26 13:41:21 +00:00
cobbler_list_config(httpd_t)
cobbler_read_config(httpd_t)
2010-08-26 16:55:57 +00:00
cobbler_read_lib_files(httpd_t)
2010-08-26 13:41:21 +00:00
tunable_policy(`httpd_can_network_connect_cobbler',`
corenet_tcp_connect_cobbler_port(httpd_t)
')
')
optional_policy(`
cron_system_entry(httpd_t, httpd_exec_t)
')
optional_policy(`
cvs_read_data(httpd_t)
')
optional_policy(`
daemontools_service_domain(httpd_t, httpd_exec_t)
')
2010-08-26 13:41:21 +00:00
optional_policy(`
dbus_system_bus_client(httpd_t)
tunable_policy(`httpd_dbus_avahi',`
avahi_dbus_chat(httpd_t)
')
')
2010-08-26 13:41:21 +00:00
optional_policy(`
gitosis_read_lib_files(httpd_t)
')
optional_policy(`
tunable_policy(`httpd_enable_cgi && httpd_use_gpg',`
2010-08-26 13:41:21 +00:00
gpg_domtrans_web(httpd_t)
')
')
optional_policy(`
kerberos_keytab_template(httpd, httpd_t)
2005-09-29 20:59:00 +00:00
')
optional_policy(`
2005-10-11 15:36:53 +00:00
mailman_signal_cgi(httpd_t)
mailman_domtrans_cgi(httpd_t)
mailman_read_data_files(httpd_t)
2005-10-11 15:36:53 +00:00
# should have separate types for public and private archives
mailman_search_data(httpd_t)
2005-10-11 15:36:53 +00:00
mailman_read_archive(httpd_t)
')
2010-10-05 12:47:38 +00:00
optional_policy(`
mediawiki_read_tmp_files(httpd_t)
mediawiki_delete_tmp_files(httpd_t)
')
optional_policy(`
# Allow httpd to work with mysql
2010-08-26 13:41:21 +00:00
mysql_read_config(httpd_t)
2005-09-29 20:59:00 +00:00
mysql_stream_connect(httpd_t)
2006-02-02 21:08:12 +00:00
mysql_rw_db_sockets(httpd_t)
tunable_policy(`httpd_can_network_connect_db',`
mysql_tcp_connect(httpd_t)
')
2005-09-29 20:59:00 +00:00
')
2006-04-06 15:03:23 +00:00
optional_policy(`
nagios_read_config(httpd_t)
2010-08-26 13:41:21 +00:00
nagios_read_log(httpd_t)
2006-04-06 15:03:23 +00:00
')
2006-05-02 17:42:41 +00:00
optional_policy(`
openca_domtrans(httpd_t)
openca_signal(httpd_t)
openca_sigstop(httpd_t)
openca_kill(httpd_t)
')
2010-09-13 09:49:37 +00:00
optional_policy(`
passenger_domtrans(httpd_t)
passenger_manage_pid_content(httpd_t)
passenger_read_lib_files(httpd_t)
2010-09-13 09:49:37 +00:00
')
2010-08-26 13:41:21 +00:00
optional_policy(`
rpc_search_nfs_state_data(httpd_t)
')
optional_policy(`
2005-11-08 22:00:30 +00:00
# Allow httpd to work with postgresql
2006-02-02 21:08:12 +00:00
postgresql_stream_connect(httpd_t)
postgresql_unpriv_client(httpd_t)
tunable_policy(`httpd_can_network_connect_db',`
postgresql_tcp_connect(httpd_t)
')
2005-11-08 22:00:30 +00:00
')
optional_policy(`
2005-09-29 20:59:00 +00:00
seutil_sigchld_newrole(httpd_t)
')
optional_policy(`
smokeping_read_lib_files(httpd_t)
2010-08-26 13:41:21 +00:00
')
optional_policy(`
files_dontaudit_rw_usr_dirs(httpd_t)
snmp_dontaudit_read_snmp_var_lib_files(httpd_t)
snmp_dontaudit_write_snmp_var_lib_files(httpd_t)
')
optional_policy(`
2005-09-29 20:59:00 +00:00
udev_read_db(httpd_t)
')
2006-04-28 18:30:02 +00:00
optional_policy(`
yam_read_content(httpd_t)
')
2010-08-26 13:41:21 +00:00
optional_policy(`
zarafa_stream_connect_server(httpd_t)
')
2005-09-29 20:59:00 +00:00
########################################
#
# Apache helper local policy
#
2006-12-12 20:08:08 +00:00
domtrans_pattern(httpd_t, httpd_helper_exec_t, httpd_helper_t)
2005-09-29 20:59:00 +00:00
allow httpd_helper_t httpd_config_t:file read_file_perms;
2005-09-29 20:59:00 +00:00
allow httpd_helper_t httpd_log_t:file append_file_perms;
2005-09-29 20:59:00 +00:00
2005-10-17 17:55:38 +00:00
logging_send_syslog_msg(httpd_helper_t)
2008-11-05 16:10:46 +00:00
userdom_use_user_terminals(httpd_helper_t)
2005-10-31 20:58:44 +00:00
2010-08-26 13:41:21 +00:00
tunable_policy(`httpd_tty_comm',`
userdom_use_user_terminals(httpd_helper_t)
')
2005-09-29 20:59:00 +00:00
########################################
#
# Apache PHP script local policy
#
allow httpd_php_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
allow httpd_php_t self:fd use;
2006-12-12 20:08:08 +00:00
allow httpd_php_t self:fifo_file rw_fifo_file_perms;
allow httpd_php_t self:sock_file read_sock_file_perms;
2005-09-29 20:59:00 +00:00
allow httpd_php_t self:unix_dgram_socket create_socket_perms;
allow httpd_php_t self:unix_stream_socket create_stream_socket_perms;
allow httpd_php_t self:unix_dgram_socket sendto;
allow httpd_php_t self:unix_stream_socket connectto;
allow httpd_php_t self:shm create_shm_perms;
allow httpd_php_t self:sem create_sem_perms;
allow httpd_php_t self:msgq create_msgq_perms;
allow httpd_php_t self:msg { send receive };
2006-12-12 20:08:08 +00:00
domtrans_pattern(httpd_t, httpd_php_exec_t, httpd_php_t)
2005-09-29 20:59:00 +00:00
# allow php to read and append to apache logfiles
2006-12-12 20:08:08 +00:00
allow httpd_php_t httpd_log_t:file { read_file_perms append_file_perms };
2005-09-29 20:59:00 +00:00
manage_dirs_pattern(httpd_php_t, httpd_php_tmp_t, httpd_php_tmp_t)
manage_files_pattern(httpd_php_t, httpd_php_tmp_t, httpd_php_tmp_t)
2006-02-21 18:40:44 +00:00
files_tmp_filetrans(httpd_php_t, httpd_php_tmp_t, { file dir })
2005-09-29 20:59:00 +00:00
fs_search_auto_mountpoints(httpd_php_t)
auth_use_nsswitch(httpd_php_t)
2005-09-29 20:59:00 +00:00
libs_exec_lib_files(httpd_php_t)
2006-02-21 18:40:44 +00:00
userdom_use_unpriv_users_fds(httpd_php_t)
2005-09-29 20:59:00 +00:00
tunable_policy(`httpd_can_network_connect_db',`
2010-09-17 07:21:55 +00:00
corenet_tcp_connect_mssql_port(httpd_php_t)
corenet_sendrecv_mssql_client_packets(httpd_php_t)
2005-09-29 20:59:00 +00:00
')
optional_policy(`
mysql_stream_connect(httpd_php_t)
2010-09-17 07:21:55 +00:00
mysql_rw_db_sockets(httpd_php_t)
mysql_read_config(httpd_php_t)
2010-09-17 07:21:55 +00:00
tunable_policy(`httpd_can_network_connect_db',`
mysql_tcp_connect(httpd_php_t)
')
2005-09-29 20:59:00 +00:00
')
optional_policy(`
postgresql_stream_connect(httpd_php_t)
2010-09-17 07:21:55 +00:00
postgresql_unpriv_client(httpd_php_t)
tunable_policy(`httpd_can_network_connect_db',`
postgresql_tcp_connect(httpd_php_t)
')
')
2005-09-29 20:59:00 +00:00
########################################
#
# Apache suexec local policy
#
allow httpd_suexec_t self:capability { setuid setgid };
allow httpd_suexec_t self:process signal_perms;
allow httpd_suexec_t self:unix_stream_socket create_stream_socket_perms;
domtrans_pattern(httpd_t, httpd_suexec_exec_t, httpd_suexec_t)
2005-09-29 20:59:00 +00:00
create_files_pattern(httpd_suexec_t, httpd_log_t, httpd_log_t)
append_files_pattern(httpd_suexec_t, httpd_log_t, httpd_log_t)
read_files_pattern(httpd_suexec_t, httpd_log_t, httpd_log_t)
2006-12-12 20:08:08 +00:00
allow httpd_suexec_t httpd_t:fifo_file read_fifo_file_perms;
2005-09-29 20:59:00 +00:00
manage_dirs_pattern(httpd_suexec_t, httpd_suexec_tmp_t, httpd_suexec_tmp_t)
manage_files_pattern(httpd_suexec_t, httpd_suexec_tmp_t, httpd_suexec_tmp_t)
2006-02-21 18:40:44 +00:00
files_tmp_filetrans(httpd_suexec_t, httpd_suexec_tmp_t, { file dir })
2005-09-29 20:59:00 +00:00
2010-08-26 13:41:21 +00:00
can_exec(httpd_suexec_t, httpd_sys_script_exec_t)
read_files_pattern(httpd_suexec_t, httpd_user_content_t, httpd_user_content_t)
read_files_pattern(httpd_suexec_t, httpd_user_rw_content_t, httpd_user_rw_content_t)
read_files_pattern(httpd_suexec_t, httpd_user_ra_content_t, httpd_user_ra_content_t)
kernel_read_kernel_sysctls(httpd_suexec_t)
2005-09-29 20:59:00 +00:00
kernel_list_proc(httpd_suexec_t)
kernel_read_proc_symlinks(httpd_suexec_t)
dev_read_urand(httpd_suexec_t)
2010-08-26 13:41:21 +00:00
fs_read_iso9660_files(httpd_suexec_t)
2005-09-29 20:59:00 +00:00
fs_search_auto_mountpoints(httpd_suexec_t)
2010-08-26 13:41:21 +00:00
application_exec_all(httpd_suexec_t)
2005-09-29 20:59:00 +00:00
files_read_etc_files(httpd_suexec_t)
files_read_usr_files(httpd_suexec_t)
2005-10-05 21:17:22 +00:00
files_dontaudit_search_pids(httpd_suexec_t)
2005-11-08 22:00:30 +00:00
files_search_home(httpd_suexec_t)
2005-09-29 20:59:00 +00:00
auth_use_nsswitch(httpd_suexec_t)
2005-09-29 20:59:00 +00:00
logging_search_logs(httpd_suexec_t)
logging_send_syslog_msg(httpd_suexec_t)
miscfiles_read_localization(httpd_suexec_t)
miscfiles_read_public_files(httpd_suexec_t)
2005-09-29 20:59:00 +00:00
tunable_policy(`httpd_can_network_connect',`
allow httpd_suexec_t self:tcp_socket create_stream_socket_perms;
allow httpd_suexec_t self:udp_socket create_socket_perms;
corenet_all_recvfrom_unlabeled(httpd_suexec_t)
corenet_all_recvfrom_netlabel(httpd_suexec_t)
corenet_tcp_sendrecv_generic_if(httpd_suexec_t)
corenet_udp_sendrecv_generic_if(httpd_suexec_t)
corenet_tcp_sendrecv_generic_node(httpd_suexec_t)
corenet_udp_sendrecv_generic_node(httpd_suexec_t)
2005-09-29 20:59:00 +00:00
corenet_tcp_sendrecv_all_ports(httpd_suexec_t)
corenet_udp_sendrecv_all_ports(httpd_suexec_t)
corenet_tcp_connect_all_ports(httpd_suexec_t)
2006-05-30 19:46:34 +00:00
corenet_sendrecv_all_client_packets(httpd_suexec_t)
2005-09-29 20:59:00 +00:00
')
2010-09-17 07:21:55 +00:00
tunable_policy(`httpd_can_network_connect_db',`
corenet_tcp_connect_mssql_port(httpd_suexec_t)
corenet_sendrecv_mssql_client_packets(httpd_suexec_t)
')
2010-08-26 13:41:21 +00:00
domain_entry_file(httpd_sys_script_t, httpd_sys_content_t)
2005-10-05 21:17:22 +00:00
tunable_policy(`httpd_enable_cgi && httpd_unified',`
allow httpd_sys_script_t httpdcontent:file entrypoint;
2006-12-12 20:08:08 +00:00
domtrans_pattern(httpd_suexec_t, httpdcontent, httpd_sys_script_t)
2010-08-26 13:41:21 +00:00
manage_dirs_pattern(httpd_sys_script_t, httpdcontent, httpdcontent)
manage_files_pattern(httpd_sys_script_t, httpdcontent, httpdcontent)
manage_sock_files_pattern(httpd_sys_script_t, httpdcontent, httpdcontent)
manage_lnk_files_pattern(httpd_sys_script_t, httpdcontent, httpdcontent)
')
2005-09-29 20:59:00 +00:00
tunable_policy(`httpd_enable_homedirs && use_nfs_home_dirs',`
fs_read_nfs_files(httpd_suexec_t)
fs_read_nfs_symlinks(httpd_suexec_t)
fs_exec_nfs_files(httpd_suexec_t)
2005-09-29 20:59:00 +00:00
')
tunable_policy(`httpd_enable_homedirs && use_samba_home_dirs',`
fs_read_cifs_files(httpd_suexec_t)
fs_read_cifs_symlinks(httpd_suexec_t)
fs_exec_cifs_files(httpd_suexec_t)
2005-09-29 20:59:00 +00:00
')
optional_policy(`
2005-10-11 15:36:53 +00:00
mailman_domtrans_cgi(httpd_suexec_t)
')
optional_policy(`
2005-11-08 22:00:30 +00:00
mta_stub(httpd_suexec_t)
# apache should set close-on-exec
dontaudit httpd_suexec_t httpd_t:unix_stream_socket { read write };
')
2010-08-26 13:41:21 +00:00
optional_policy(`
mysql_stream_connect(httpd_suexec_t)
mysql_rw_db_sockets(httpd_suexec_t)
mysql_read_config(httpd_suexec_t)
2010-09-17 07:21:55 +00:00
tunable_policy(`httpd_can_network_connect_db',`
mysql_tcp_connect(httpd_suexec_t)
')
')
optional_policy(`
postgresql_stream_connect(httpd_suexec_t)
postgresql_unpriv_client(httpd_suexec_t)
tunable_policy(`httpd_can_network_connect_db',`
postgresql_tcp_connect(httpd_suexec_t)
')
2010-08-26 13:41:21 +00:00
')
2005-09-29 20:59:00 +00:00
########################################
#
# Apache system script local policy
#
allow httpd_sys_script_t self:process getsched;
allow httpd_sys_script_t httpd_t:unix_stream_socket rw_stream_socket_perms;
2005-10-05 21:17:22 +00:00
allow httpd_sys_script_t httpd_t:tcp_socket { read write };
dontaudit httpd_sys_script_t httpd_config_t:dir search;
allow httpd_sys_script_t httpd_squirrelmail_t:file { append_file_perms read_file_perms };
2005-10-05 21:17:22 +00:00
2006-12-12 20:08:08 +00:00
allow httpd_sys_script_t squirrelmail_spool_t:dir list_dir_perms;
read_files_pattern(httpd_sys_script_t, squirrelmail_spool_t, squirrelmail_spool_t)
read_lnk_files_pattern(httpd_sys_script_t, squirrelmail_spool_t, squirrelmail_spool_t)
2005-10-05 21:17:22 +00:00
kernel_read_kernel_sysctls(httpd_sys_script_t)
2005-10-05 21:17:22 +00:00
files_search_var_lib(httpd_sys_script_t)
files_search_spool(httpd_sys_script_t)
2010-08-26 13:41:21 +00:00
logging_inherit_append_all_logs(httpd_sys_script_t)
# Should we add a boolean?
apache_domtrans_rotatelogs(httpd_sys_script_t)
2010-08-26 13:41:21 +00:00
auth_use_nsswitch(httpd_sys_script_t)
2005-10-05 21:17:22 +00:00
ifdef(`distro_redhat',`
allow httpd_sys_script_t httpd_log_t:file append_file_perms;
2005-10-05 21:17:22 +00:00
')
tunable_policy(`httpd_can_sendmail',`
mta_send_mail(httpd_sys_script_t)
')
2010-08-26 13:41:21 +00:00
optional_policy(`
tunable_policy(`httpd_can_sendmail && httpd_can_check_spam',`
spamassassin_domtrans_client(httpd_t)
')
2010-08-26 13:41:21 +00:00
')
2010-09-17 07:21:55 +00:00
tunable_policy(`httpd_can_network_connect_db',`
corenet_tcp_connect_mssql_port(httpd_sys_script_t)
corenet_sendrecv_mssql_client_packets(httpd_sys_script_t)
')
fs_cifs_entry_type(httpd_sys_script_t)
fs_read_iso9660_files(httpd_sys_script_t)
fs_nfs_entry_type(httpd_sys_script_t)
2010-08-26 13:41:21 +00:00
tunable_policy(`httpd_use_nfs',`
fs_manage_nfs_dirs(httpd_sys_script_t)
fs_manage_nfs_files(httpd_sys_script_t)
fs_manage_nfs_symlinks(httpd_sys_script_t)
fs_exec_nfs_files(httpd_sys_script_t)
fs_manage_nfs_dirs(httpd_suexec_t)
fs_manage_nfs_files(httpd_suexec_t)
fs_manage_nfs_symlinks(httpd_suexec_t)
fs_exec_nfs_files(httpd_suexec_t)
')
tunable_policy(`httpd_enable_cgi && httpd_can_network_connect',`
allow httpd_sys_script_t self:tcp_socket create_stream_socket_perms;
allow httpd_sys_script_t self:udp_socket create_socket_perms;
corenet_tcp_bind_all_nodes(httpd_sys_script_t)
corenet_udp_bind_all_nodes(httpd_sys_script_t)
corenet_all_recvfrom_unlabeled(httpd_sys_script_t)
corenet_all_recvfrom_netlabel(httpd_sys_script_t)
corenet_tcp_sendrecv_all_if(httpd_sys_script_t)
corenet_udp_sendrecv_all_if(httpd_sys_script_t)
corenet_tcp_sendrecv_all_nodes(httpd_sys_script_t)
corenet_udp_sendrecv_all_nodes(httpd_sys_script_t)
corenet_tcp_sendrecv_all_ports(httpd_sys_script_t)
corenet_udp_sendrecv_all_ports(httpd_sys_script_t)
corenet_tcp_connect_all_ports(httpd_sys_script_t)
corenet_sendrecv_all_client_packets(httpd_sys_script_t)
')
tunable_policy(`httpd_enable_homedirs',`
userdom_search_user_home_dirs(httpd_sys_script_t)
')
tunable_policy(`httpd_enable_homedirs && use_nfs_home_dirs',`
fs_read_nfs_files(httpd_sys_script_t)
fs_read_nfs_symlinks(httpd_sys_script_t)
')
tunable_policy(`httpd_read_user_content',`
userdom_read_user_home_content_files(httpd_sys_script_t)
')
2010-08-26 13:41:21 +00:00
tunable_policy(`httpd_use_cifs',`
fs_manage_cifs_dirs(httpd_sys_script_t)
fs_manage_cifs_files(httpd_sys_script_t)
fs_manage_cifs_symlinks(httpd_sys_script_t)
fs_manage_cifs_dirs(httpd_suexec_t)
fs_manage_cifs_files(httpd_suexec_t)
fs_manage_cifs_symlinks(httpd_suexec_t)
fs_exec_cifs_files(httpd_suexec_t)
')
tunable_policy(`httpd_enable_homedirs && use_samba_home_dirs',`
fs_read_cifs_files(httpd_sys_script_t)
fs_read_cifs_symlinks(httpd_sys_script_t)
')
optional_policy(`
clamav_domtrans_clamscan(httpd_sys_script_t)
')
optional_policy(`
2005-10-05 21:17:22 +00:00
mysql_stream_connect(httpd_sys_script_t)
2006-02-02 21:08:12 +00:00
mysql_rw_db_sockets(httpd_sys_script_t)
2010-08-26 13:41:21 +00:00
mysql_read_config(httpd_sys_script_t)
2010-09-17 07:21:55 +00:00
tunable_policy(`httpd_can_network_connect_db',`
mysql_tcp_connect(httpd_sys_script_t)
')
2005-10-05 21:17:22 +00:00
')
optional_policy(`
postgresql_stream_connect(httpd_sys_script_t)
2010-09-17 07:21:55 +00:00
postgresql_unpriv_client(httpd_sys_script_t)
tunable_policy(`httpd_can_network_connect_db',`
postgresql_tcp_connect(httpd_sys_script_t)
')
')
########################################
#
# httpd_rotatelogs local policy
#
allow httpd_rotatelogs_t self:capability dac_override;
manage_files_pattern(httpd_rotatelogs_t, httpd_log_t, httpd_log_t)
kernel_read_kernel_sysctls(httpd_rotatelogs_t)
kernel_dontaudit_list_proc(httpd_rotatelogs_t)
kernel_dontaudit_read_proc_symlinks(httpd_rotatelogs_t)
files_read_etc_files(httpd_rotatelogs_t)
logging_search_logs(httpd_rotatelogs_t)
miscfiles_read_localization(httpd_rotatelogs_t)
2008-11-05 16:10:46 +00:00
########################################
#
# Unconfined script local policy
#
optional_policy(`
type httpd_unconfined_script_t;
type httpd_unconfined_script_exec_t;
domain_type(httpd_unconfined_script_t)
domain_entry_file(httpd_unconfined_script_t, httpd_unconfined_script_exec_t)
domtrans_pattern(httpd_t, httpd_unconfined_script_exec_t, httpd_unconfined_script_t)
unconfined_domain(httpd_unconfined_script_t)
role system_r types httpd_unconfined_script_t;
allow httpd_t httpd_unconfined_script_t:process signal_perms;
')
2008-11-05 16:10:46 +00:00
########################################
#
# User content local policy
#
tunable_policy(`httpd_enable_cgi && httpd_unified',`
allow httpd_user_script_t httpdcontent:file entrypoint;
2010-08-26 13:41:21 +00:00
manage_dirs_pattern(httpd_user_script_t, httpd_user_content_t, httpd_user_content_t)
manage_files_pattern(httpd_user_script_t, httpd_user_content_t, httpd_user_content_t)
manage_dirs_pattern(httpd_user_script_t, httpd_user_ra_content_t, httpd_user_ra_content_t)
manage_files_pattern(httpd_user_script_t, httpd_user_ra_content_t, httpd_user_ra_content_t)
2008-11-05 16:10:46 +00:00
')
# allow accessing files/dirs below the users home dir
tunable_policy(`httpd_enable_homedirs',`
2010-08-26 13:41:21 +00:00
userdom_search_user_home_content(httpd_t)
userdom_search_user_home_content(httpd_suexec_t)
userdom_search_user_home_content(httpd_user_script_t)
2008-11-05 16:10:46 +00:00
')
2010-08-26 13:41:21 +00:00
tunable_policy(`httpd_read_user_content',`
userdom_read_user_home_content_files(httpd_t)
2010-08-26 13:41:21 +00:00
userdom_read_user_home_content_files(httpd_suexec_t)
userdom_read_user_home_content_files(httpd_user_script_t)
2010-08-26 13:41:21 +00:00
')