2005-09-29 20:59:00 +00:00
|
|
|
|
2006-05-30 19:46:34 +00:00
|
|
|
policy_module(apache,1.3.12)
|
2005-09-29 20:59:00 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# NOTES:
|
|
|
|
# This policy will work with SUEXEC enabled as part of the Apache
|
|
|
|
# configuration. However, the user CGI scripts will run under the
|
|
|
|
# system_u:system_r:httpd_$1_script_t domain where $1 is the domain of the
|
|
|
|
# of the creating user.
|
|
|
|
#
|
|
|
|
# The user CGI scripts must be labeled with the httpd_$1_script_exec_t
|
|
|
|
# type, and the directory containing the scripts should also be labeled
|
|
|
|
# with these types. This policy allows user_r role to perform that
|
|
|
|
# relabeling. If it is desired that only sysadm_r should be able to relabel
|
|
|
|
# the user CGI scripts, then relabel rule for user_r should be removed.
|
|
|
|
#
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
|
|
|
attribute httpdcontent;
|
|
|
|
|
2005-10-17 17:55:38 +00:00
|
|
|
# domains that can exec all users scripts
|
|
|
|
attribute httpd_exec_scripts;
|
|
|
|
|
|
|
|
# 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)
|
2005-09-29 20:59:00 +00:00
|
|
|
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_lock_t;
|
|
|
|
files_lock_file(httpd_lock_t)
|
|
|
|
|
|
|
|
type httpd_log_t;
|
|
|
|
logging_log_file(httpd_log_t)
|
|
|
|
|
|
|
|
# httpd_modules_t is the type given to module files (libraries)
|
|
|
|
# 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)
|
2005-09-29 20:59:00 +00:00
|
|
|
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_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)
|
2005-09-29 20:59:00 +00:00
|
|
|
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)
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
# Unconfined domain for apache scripts.
|
|
|
|
# Only to be used as a last resort
|
|
|
|
type httpd_unconfined_script_t;
|
2005-10-17 17:55:38 +00:00
|
|
|
type httpd_unconfined_script_exec_t; # customizable
|
2005-09-29 20:59:00 +00:00
|
|
|
domain_type(httpd_unconfined_script_t)
|
2005-10-17 17:55:38 +00:00
|
|
|
domain_entry_file(httpd_unconfined_script_t,httpd_unconfined_script_exec_t)
|
2005-09-29 20:59:00 +00:00
|
|
|
role system_r types httpd_unconfined_script_t;
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
|
|
|
# File Type of squirrelmail attachments
|
|
|
|
type squirrelmail_spool_t;
|
|
|
|
files_tmp_file(squirrelmail_spool_t)
|
|
|
|
|
2005-10-05 21:17:22 +00:00
|
|
|
# mod_jk2 creates /var/log/httpd/jk2.shm to communicate with tomcat
|
|
|
|
# This is a bug but it still exists in FC2
|
|
|
|
# cjp: probably can remove this
|
|
|
|
ifdef(`distro_redhat',`
|
|
|
|
typealias httpd_log_t alias httpd_runtime_t;
|
2005-10-31 20:54:33 +00:00
|
|
|
dontaudit httpd_t httpd_runtime_t:file ioctl;
|
2005-10-05 21:17:22 +00:00
|
|
|
')
|
|
|
|
|
2005-10-12 16:23:22 +00:00
|
|
|
ifdef(`targeted_policy',`
|
|
|
|
typealias httpd_sys_content_t alias httpd_user_content_t;
|
|
|
|
typealias httpd_sys_script_exec_t alias httpd_user_script_exec_t;
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
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_tty_config };
|
|
|
|
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;
|
2005-10-31 20:32:53 +00:00
|
|
|
allow httpd_t self:sock_file r_file_perms;
|
2005-09-29 20:59:00 +00:00
|
|
|
allow httpd_t self:fifo_file rw_file_perms;
|
|
|
|
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 };
|
2005-09-29 20:59:00 +00:00
|
|
|
allow httpd_t self:netlink_route_socket { bind create getattr nlmsg_read read write };
|
2006-05-12 18:43:31 +00:00
|
|
|
allow httpd_t self:tcp_socket { create_stream_socket_perms acceptfrom connectto recvfrom };
|
|
|
|
allow httpd_t self:udp_socket create_socket_perms;
|
2005-09-29 20:59:00 +00:00
|
|
|
|
|
|
|
# Allow httpd_t to put files in /var/cache/httpd etc
|
|
|
|
allow httpd_t httpd_cache_t:dir create_dir_perms;
|
|
|
|
allow httpd_t httpd_cache_t:file create_file_perms;
|
|
|
|
allow httpd_t httpd_cache_t:lnk_file create_lnk_perms;
|
|
|
|
|
|
|
|
# Allow the httpd_t to read the web servers config files
|
|
|
|
allow httpd_t httpd_config_t:dir r_dir_perms;
|
|
|
|
allow httpd_t httpd_config_t:file r_file_perms;
|
|
|
|
allow httpd_t httpd_config_t:lnk_file { getattr read };
|
|
|
|
|
|
|
|
can_exec(httpd_t, httpd_exec_t)
|
|
|
|
|
|
|
|
allow httpd_t httpd_lock_t:file create_file_perms;
|
2006-03-02 23:41:11 +00:00
|
|
|
files_lock_filetrans(httpd_t,httpd_lock_t,file)
|
2005-09-29 20:59:00 +00:00
|
|
|
|
|
|
|
allow httpd_t httpd_log_t:dir { setattr rw_dir_perms };
|
|
|
|
allow httpd_t httpd_log_t:file { create ra_file_perms };
|
|
|
|
allow httpd_t httpd_log_t:lnk_file read;
|
2005-10-12 16:23:22 +00:00
|
|
|
# cjp: need to refine create interfaces to
|
|
|
|
# cut this back to add_name only
|
2006-03-02 23:41:11 +00:00
|
|
|
logging_log_filetrans(httpd_t,httpd_log_t,file)
|
2005-09-29 20:59:00 +00:00
|
|
|
|
|
|
|
allow httpd_t httpd_modules_t:file rx_file_perms;
|
|
|
|
allow httpd_t httpd_modules_t:dir r_dir_perms;
|
|
|
|
allow httpd_t httpd_modules_t:lnk_file r_file_perms;
|
|
|
|
|
|
|
|
allow httpd_t httpd_squirrelmail_t:dir create_dir_perms;
|
|
|
|
allow httpd_t httpd_squirrelmail_t:lnk_file create_lnk_perms;
|
|
|
|
allow httpd_t httpd_squirrelmail_t:file create_file_perms;
|
|
|
|
|
2005-11-08 22:00:30 +00:00
|
|
|
allow httpd_t httpd_suexec_exec_t:file { getattr read };
|
|
|
|
|
2005-10-24 11:21:28 +00:00
|
|
|
allow httpd_t httpd_sys_content_t:dir r_dir_perms;
|
2005-10-24 22:01:08 +00:00
|
|
|
allow httpd_t httpd_sys_content_t:file r_file_perms;
|
2006-03-08 18:43:05 +00:00
|
|
|
allow httpd_t httpd_sys_content_t:lnk_file r_file_perms;
|
2005-10-24 11:21:28 +00:00
|
|
|
|
2005-09-29 20:59:00 +00:00
|
|
|
allow httpd_t httpd_tmp_t:dir create_dir_perms;
|
|
|
|
allow httpd_t httpd_tmp_t:file create_file_perms;
|
2006-02-21 18:40:44 +00:00
|
|
|
files_tmp_filetrans(httpd_t, httpd_tmp_t, { file dir })
|
2005-09-29 20:59:00 +00:00
|
|
|
|
2005-10-17 17:55:38 +00:00
|
|
|
allow httpd_t httpd_tmpfs_t:dir create_dir_perms;
|
|
|
|
allow httpd_t httpd_tmpfs_t:file create_file_perms;
|
|
|
|
allow httpd_t httpd_tmpfs_t:lnk_file create_lnk_perms;
|
|
|
|
allow httpd_t httpd_tmpfs_t:sock_file create_file_perms;
|
|
|
|
allow httpd_t httpd_tmpfs_t:fifo_file create_file_perms;
|
2006-02-21 18:40:44 +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
|
|
|
|
|
|
|
allow httpd_t httpd_var_lib_t:file create_file_perms;
|
2005-10-17 17:55:38 +00:00
|
|
|
allow httpd_t httpd_var_lib_t:dir rw_dir_perms;
|
2006-03-02 23:41:11 +00:00
|
|
|
files_var_lib_filetrans(httpd_t,httpd_var_lib_t,file)
|
2005-09-29 20:59:00 +00:00
|
|
|
|
|
|
|
allow httpd_t httpd_var_run_t:file create_file_perms;
|
|
|
|
allow httpd_t httpd_var_run_t:sock_file create_file_perms;
|
|
|
|
allow httpd_t httpd_var_run_t:dir rw_dir_perms;
|
2006-02-21 18:40:44 +00:00
|
|
|
files_pid_filetrans(httpd_t,httpd_var_run_t, { file sock_file })
|
2005-09-29 20:59:00 +00:00
|
|
|
|
|
|
|
allow httpd_t squirrelmail_spool_t:dir create_dir_perms;
|
|
|
|
allow httpd_t squirrelmail_spool_t:file create_file_perms;
|
|
|
|
allow httpd_t squirrelmail_spool_t:lnk_file create_lnk_perms;
|
|
|
|
|
2006-01-31 16:49:43 +00:00
|
|
|
kernel_read_kernel_sysctls(httpd_t)
|
2005-09-29 20:59:00 +00:00
|
|
|
kernel_tcp_recvfrom(httpd_t)
|
|
|
|
# for modules that want to access /proc/meminfo
|
|
|
|
kernel_read_system_state(httpd_t)
|
|
|
|
|
2006-05-12 18:43:31 +00:00
|
|
|
corenet_non_ipsec_sendrecv(httpd_t)
|
2005-09-29 20:59:00 +00:00
|
|
|
corenet_tcp_sendrecv_all_if(httpd_t)
|
|
|
|
corenet_udp_sendrecv_all_if(httpd_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes(httpd_t)
|
|
|
|
corenet_udp_sendrecv_all_nodes(httpd_t)
|
|
|
|
corenet_tcp_sendrecv_all_ports(httpd_t)
|
|
|
|
corenet_udp_sendrecv_all_ports(httpd_t)
|
|
|
|
corenet_tcp_bind_all_nodes(httpd_t)
|
|
|
|
corenet_tcp_bind_http_port(httpd_t)
|
|
|
|
corenet_tcp_bind_http_cache_port(httpd_t)
|
2006-05-26 20:46:37 +00:00
|
|
|
corenet_sendrecv_http_server_packets(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)
|
|
|
|
|
|
|
|
term_dontaudit_use_console(httpd_t)
|
|
|
|
|
2005-10-13 20:59:36 +00:00
|
|
|
auth_use_nsswitch(httpd_t)
|
|
|
|
|
2005-09-29 20:59:00 +00:00
|
|
|
# execute perl
|
|
|
|
corecmd_exec_bin(httpd_t)
|
|
|
|
corecmd_exec_sbin(httpd_t)
|
|
|
|
|
2006-02-20 21:33:25 +00:00
|
|
|
domain_use_interactive_fds(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
|
|
|
|
2006-03-02 23:41:11 +00:00
|
|
|
init_use_fds(httpd_t)
|
2006-02-02 21:08:12 +00:00
|
|
|
init_use_script_ptys(httpd_t)
|
2005-09-29 20:59:00 +00:00
|
|
|
|
|
|
|
libs_use_ld_so(httpd_t)
|
|
|
|
libs_use_shared_libs(httpd_t)
|
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_certs(httpd_t)
|
2005-09-29 20:59:00 +00:00
|
|
|
|
|
|
|
seutil_dontaudit_search_config(httpd_t)
|
|
|
|
|
|
|
|
sysnet_use_ldap(httpd_t)
|
|
|
|
sysnet_read_config(httpd_t)
|
|
|
|
|
2006-02-21 18:40:44 +00:00
|
|
|
userdom_use_unpriv_users_fds(httpd_t)
|
|
|
|
userdom_dontaudit_search_sysadm_home_dirs(httpd_t)
|
2005-09-29 20:59:00 +00:00
|
|
|
|
|
|
|
mta_send_mail(httpd_t)
|
|
|
|
|
|
|
|
ifdef(`targeted_policy',`
|
2006-02-02 21:08:12 +00:00
|
|
|
term_dontaudit_use_unallocated_ttys(httpd_t)
|
|
|
|
term_dontaudit_use_generic_ptys(httpd_t)
|
2006-01-31 19:21:01 +00:00
|
|
|
files_dontaudit_read_root_files(httpd_t)
|
2005-10-26 21:03:19 +00:00
|
|
|
|
|
|
|
tunable_policy(`httpd_enable_homedirs',`
|
2006-02-21 18:40:44 +00:00
|
|
|
userdom_search_generic_user_home_dirs(httpd_t)
|
2005-10-26 21:03:19 +00:00
|
|
|
')
|
2005-09-29 20:59:00 +00:00
|
|
|
')
|
|
|
|
|
2005-10-05 21:17:22 +00:00
|
|
|
tunable_policy(`allow_httpd_anon_write',`
|
|
|
|
miscfiles_manage_public_files(httpd_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`httpd_can_network_connect',`
|
|
|
|
corenet_tcp_connect_all_ports(httpd_t)
|
|
|
|
')
|
|
|
|
|
2005-12-12 21:47:43 +00:00
|
|
|
tunable_policy(`httpd_can_network_connect_db',`
|
|
|
|
# allow httpd to connect to mysql/posgresql
|
|
|
|
corenet_tcp_connect_postgresql_port(httpd_t)
|
|
|
|
corenet_tcp_connect_mysqld_port(httpd_t)
|
2006-05-30 19:46:34 +00:00
|
|
|
corenet_sendrecv_postgresql_client_packets(httpd_t)
|
|
|
|
corenet_sendrecv_mysqld_client_packets(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)
|
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)
|
2005-12-12 21:47:43 +00:00
|
|
|
')
|
|
|
|
|
2005-09-29 20:59:00 +00:00
|
|
|
tunable_policy(`httpd_enable_cgi',`
|
|
|
|
domain_auto_trans(httpd_t, httpd_unconfined_script_exec_t, httpd_unconfined_script_t)
|
|
|
|
allow httpd_t httpd_unconfined_script_t:fd use;
|
|
|
|
allow httpd_unconfined_script_t httpd_t:fd use;
|
|
|
|
allow httpd_unconfined_script_t httpd_t:fifo_file rw_file_perms;
|
|
|
|
allow httpd_unconfined_script_t httpd_t:process sigchld;
|
|
|
|
|
|
|
|
allow httpd_t httpd_unconfined_script_t:process { signal sigkill sigstop };
|
|
|
|
allow httpd_t httpd_unconfined_script_exec_t:dir r_dir_perms;
|
|
|
|
')
|
|
|
|
|
2005-10-05 21:17:22 +00:00
|
|
|
tunable_policy(`httpd_enable_cgi && httpd_unified && httpd_builtin_scripting',`
|
|
|
|
domain_auto_trans(httpd_t, httpdcontent, httpd_sys_script_t)
|
|
|
|
allow httpd_t httpd_sys_script_t:fd use;
|
|
|
|
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;
|
|
|
|
|
|
|
|
allow httpd_t httpdcontent:dir create_dir_perms;
|
|
|
|
allow httpd_t httpdcontent:file create_file_perms;
|
|
|
|
allow httpd_t httpdcontent:lnk_file create_lnk_perms;
|
|
|
|
')
|
|
|
|
|
2005-10-31 19:58:51 +00:00
|
|
|
tunable_policy(`httpd_enable_ftp_server',`
|
|
|
|
corenet_tcp_bind_ftp_port(httpd_t)
|
|
|
|
')
|
|
|
|
|
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)
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`httpd_enable_homedirs && use_samba_home_dirs',`
|
|
|
|
fs_read_cifs_files(httpd_t)
|
|
|
|
fs_read_cifs_symlinks(httpd_t)
|
|
|
|
')
|
|
|
|
|
2005-10-17 17:55:38 +00:00
|
|
|
tunable_policy(`httpd_ssi_exec',`
|
|
|
|
corecmd_shell_domtrans(httpd_t,httpd_sys_script_t)
|
|
|
|
allow httpd_t httpd_sys_script_t:fd use;
|
|
|
|
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
|
|
|
|
# are dontaudited here.
|
|
|
|
tunable_policy(`httpd_tty_comm',`
|
2005-10-31 20:54:33 +00:00
|
|
|
# cjp: this is redundant:
|
|
|
|
term_use_controlling_term(httpd_t)
|
|
|
|
|
2005-10-05 21:17:22 +00:00
|
|
|
userdom_use_sysadm_terms(httpd_t)
|
|
|
|
',`
|
|
|
|
userdom_dontaudit_use_sysadm_terms(httpd_t)
|
2005-09-29 20:59:00 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-03-21 20:12:24 +00:00
|
|
|
calamaris_read_www_files(httpd_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-16 18:30:14 +00:00
|
|
|
daemontools_service_domain(httpd_t, httpd_exec_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-09-29 20:59:00 +00:00
|
|
|
kerberos_use(httpd_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-10-11 15:36:53 +00:00
|
|
|
mailman_signal_cgi(httpd_t)
|
|
|
|
mailman_domtrans_cgi(httpd_t)
|
|
|
|
# should have separate types for public and private archives
|
2005-10-31 20:32:53 +00:00
|
|
|
mailman_search_data(httpd_t)
|
2005-10-11 15:36:53 +00:00
|
|
|
mailman_read_archive(httpd_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
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)
|
2005-09-29 20:59:00 +00:00
|
|
|
')
|
|
|
|
|
2006-04-06 15:03:23 +00:00
|
|
|
optional_policy(`
|
|
|
|
nagios_read_config(httpd_t)
|
|
|
|
nagios_domtrans_cgi(httpd_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-02-02 21:08:12 +00:00
|
|
|
nscd_socket_use(httpd_t)
|
2005-09-29 20:59:00 +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)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
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)
|
2005-11-08 22:00:30 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-09-29 20:59:00 +00:00
|
|
|
seutil_sigchld_newrole(httpd_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
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)
|
|
|
|
')
|
|
|
|
|
2005-09-29 20:59:00 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Apache helper local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
domain_auto_trans(httpd_t, httpd_helper_exec_t, httpd_helper_t)
|
|
|
|
allow httpd_t httpd_helper_t:fd use;
|
|
|
|
allow httpd_helper_t httpd_t:fd use;
|
|
|
|
allow httpd_helper_t httpd_t:fifo_file rw_file_perms;
|
|
|
|
allow httpd_helper_t httpd_t:process sigchld;
|
|
|
|
|
|
|
|
allow httpd_helper_t httpd_config_t:file { getattr read };
|
|
|
|
|
|
|
|
allow httpd_helper_t httpd_log_t:file append;
|
|
|
|
|
|
|
|
libs_use_ld_so(httpd_helper_t)
|
|
|
|
libs_use_shared_libs(httpd_helper_t)
|
|
|
|
|
2005-10-17 17:55:38 +00:00
|
|
|
logging_send_syslog_msg(httpd_helper_t)
|
|
|
|
|
2005-10-31 20:58:44 +00:00
|
|
|
tunable_policy(`httpd_tty_comm',`
|
|
|
|
# cjp: this is redundant:
|
|
|
|
term_use_controlling_term(httpd_helper_t)
|
|
|
|
|
|
|
|
userdom_use_sysadm_terms(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;
|
|
|
|
allow httpd_php_t self:fifo_file rw_file_perms;
|
2005-10-31 20:54:33 +00:00
|
|
|
allow httpd_php_t self:sock_file r_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 };
|
|
|
|
|
|
|
|
domain_auto_trans(httpd_t, httpd_php_exec_t, httpd_php_t)
|
|
|
|
allow httpd_t httpd_php_t:fd use;
|
|
|
|
allow httpd_php_t httpd_t:fd use;
|
|
|
|
allow httpd_php_t httpd_t:fifo_file rw_file_perms;
|
|
|
|
allow httpd_php_t httpd_t:process sigchld;
|
|
|
|
|
|
|
|
# allow php to read and append to apache logfiles
|
|
|
|
allow httpd_php_t httpd_log_t:file ra_file_perms;
|
|
|
|
|
|
|
|
allow httpd_php_t httpd_php_tmp_t:dir create_dir_perms;
|
|
|
|
allow httpd_php_t httpd_php_tmp_t:file create_file_perms;
|
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)
|
|
|
|
|
|
|
|
libs_exec_lib_files(httpd_php_t)
|
|
|
|
libs_use_ld_so(httpd_php_t)
|
|
|
|
libs_use_shared_libs(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
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-09-29 20:59:00 +00:00
|
|
|
mysql_stream_connect(httpd_php_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-09-29 20:59:00 +00:00
|
|
|
nis_use_ypbind(httpd_php_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# 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;
|
|
|
|
|
2005-10-26 21:03:19 +00:00
|
|
|
ifdef(`targeted_policy',`
|
|
|
|
gen_tunable(httpd_suexec_disable_trans,false)
|
|
|
|
|
|
|
|
tunable_policy(`httpd_suexec_disable_trans',`',`
|
|
|
|
domain_auto_trans(httpd_t, httpd_suexec_exec_t, httpd_suexec_t)
|
|
|
|
allow httpd_t httpd_suexec_t:fd use;
|
|
|
|
allow httpd_suexec_t httpd_t:fd use;
|
|
|
|
allow httpd_suexec_t httpd_t:fifo_file rw_file_perms;
|
|
|
|
allow httpd_suexec_t httpd_t:process sigchld;
|
|
|
|
')
|
|
|
|
')
|
2005-09-29 20:59:00 +00:00
|
|
|
|
|
|
|
allow httpd_suexec_t httpd_log_t:dir ra_dir_perms;
|
|
|
|
allow httpd_suexec_t httpd_log_t:file { create ra_file_perms };
|
|
|
|
allow httpd_suexec_t httpd_t:fifo_file getattr;
|
|
|
|
|
|
|
|
allow httpd_suexec_t httpd_suexec_tmp_t:dir create_dir_perms;
|
|
|
|
allow httpd_suexec_t httpd_suexec_tmp_t:file create_file_perms;
|
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
|
|
|
|
2006-01-31 16:49:43 +00:00
|
|
|
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)
|
|
|
|
|
|
|
|
fs_search_auto_mountpoints(httpd_suexec_t)
|
|
|
|
|
|
|
|
# for shell scripts
|
|
|
|
corecmd_exec_bin(httpd_suexec_t)
|
|
|
|
corecmd_exec_shell(httpd_suexec_t)
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
libs_use_ld_so(httpd_suexec_t)
|
|
|
|
libs_use_shared_libs(httpd_suexec_t)
|
|
|
|
|
|
|
|
logging_search_logs(httpd_suexec_t)
|
|
|
|
logging_send_syslog_msg(httpd_suexec_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(httpd_suexec_t)
|
|
|
|
|
2005-10-26 21:03:19 +00:00
|
|
|
ifdef(`targeted_policy',`
|
|
|
|
tunable_policy(`httpd_enable_homedirs',`
|
2006-02-21 18:40:44 +00:00
|
|
|
userdom_search_generic_user_home_dirs(httpd_suexec_t)
|
2005-10-26 21:03:19 +00:00
|
|
|
')
|
|
|
|
')
|
|
|
|
|
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;
|
|
|
|
|
2006-05-12 18:43:31 +00:00
|
|
|
corenet_non_ipsec_sendrecv(httpd_suexec_t)
|
2005-09-29 20:59:00 +00:00
|
|
|
corenet_tcp_sendrecv_all_if(httpd_suexec_t)
|
|
|
|
corenet_udp_sendrecv_all_if(httpd_suexec_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes(httpd_suexec_t)
|
|
|
|
corenet_udp_sendrecv_all_nodes(httpd_suexec_t)
|
|
|
|
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
|
|
|
|
|
|
|
sysnet_read_config(httpd_suexec_t)
|
|
|
|
')
|
|
|
|
|
2005-10-05 21:17:22 +00:00
|
|
|
tunable_policy(`httpd_enable_cgi',`
|
|
|
|
domain_auto_trans(httpd_suexec_t, httpd_unconfined_script_exec_t, httpd_unconfined_script_t)
|
2005-10-26 21:03:19 +00:00
|
|
|
allow httpd_suexec_t httpd_unconfined_script_t:fd use;
|
|
|
|
allow httpd_unconfined_script_t httpd_suexec_t:fd use;
|
|
|
|
allow httpd_unconfined_script_t httpd_suexec_t:fifo_file rw_file_perms;
|
|
|
|
allow httpd_unconfined_script_t httpd_suexec_t:process sigchld;
|
2005-10-05 21:17:22 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`httpd_enable_cgi && httpd_unified',`
|
|
|
|
domain_auto_trans(httpd_suexec_t, httpdcontent, httpd_sys_script_t)
|
|
|
|
allow httpd_suexec_t httpd_sys_script_t:fd use;
|
|
|
|
allow httpd_sys_script_t httpd_suexec_t:fd use;
|
|
|
|
allow httpd_sys_script_t httpd_suexec_t:fifo_file rw_file_perms;
|
|
|
|
allow httpd_sys_script_t httpd_suexec_t:process sigchld;
|
|
|
|
')
|
|
|
|
|
2006-02-06 22:47:46 +00:00
|
|
|
tunable_policy(`httpd_enable_cgi && httpd_unified && httpd_builtin_scripting',`
|
|
|
|
domain_auto_trans(httpd_suexec_t, httpdcontent, httpd_sys_script_t)
|
|
|
|
')
|
|
|
|
|
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)
|
2006-01-31 20:29:27 +00:00
|
|
|
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)
|
2006-01-31 20:29:27 +00:00
|
|
|
fs_exec_cifs_files(httpd_suexec_t)
|
2005-09-29 20:59:00 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-10-11 15:36:53 +00:00
|
|
|
mailman_domtrans_cgi(httpd_suexec_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
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 };
|
|
|
|
')
|
|
|
|
|
2006-04-06 15:03:23 +00:00
|
|
|
optional_policy(`
|
|
|
|
nagios_domtrans_cgi(httpd_suexec_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-09-29 20:59:00 +00:00
|
|
|
nis_use_ypbind(httpd_suexec_t)
|
|
|
|
')
|
2005-10-25 18:28:41 +00:00
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-02-02 21:08:12 +00:00
|
|
|
nscd_socket_use(httpd_suexec_t)
|
2005-10-25 18:28:41 +00:00
|
|
|
')
|
2005-09-29 20:59:00 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Apache system script local policy
|
|
|
|
#
|
|
|
|
|
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 read };
|
|
|
|
|
|
|
|
allow httpd_sys_script_t squirrelmail_spool_t:dir r_dir_perms;
|
|
|
|
allow httpd_sys_script_t squirrelmail_spool_t:file r_file_perms;
|
|
|
|
allow httpd_sys_script_t squirrelmail_spool_t:lnk_file { getattr read };
|
|
|
|
|
2006-01-31 16:49:43 +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)
|
|
|
|
|
|
|
|
ifdef(`distro_redhat',`
|
|
|
|
allow httpd_sys_script_t httpd_log_t:file { getattr append };
|
|
|
|
')
|
|
|
|
|
2005-10-26 21:03:19 +00:00
|
|
|
ifdef(`targeted_policy',`
|
|
|
|
tunable_policy(`httpd_enable_homedirs',`
|
2006-02-21 18:40:44 +00:00
|
|
|
userdom_search_generic_user_home_dirs(httpd_sys_script_t)
|
2005-10-26 21:03:19 +00:00
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2006-05-17 14:50:31 +00:00
|
|
|
optional_policy(`
|
|
|
|
clamav_domtrans_clamscan(httpd_sys_script_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
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)
|
2005-10-05 21:17:22 +00:00
|
|
|
')
|
|
|
|
|
2005-09-29 20:59:00 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Apache unconfined script local policy
|
|
|
|
#
|
|
|
|
|
2006-02-06 22:47:46 +00:00
|
|
|
unconfined_domain(httpd_unconfined_script_t)
|
2005-09-29 20:59:00 +00:00
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-17 17:50:10 +00:00
|
|
|
cron_system_entry(httpd_t, httpd_exec_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-02-02 21:08:12 +00:00
|
|
|
nscd_socket_use(httpd_unconfined_script_t)
|
2005-09-29 20:59:00 +00:00
|
|
|
')
|