|
Chris PeBenito |
31b7c0 |
#DESC Apache - Web server
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# X-Debian-Packages: apache2-common apache
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
###############################################################################
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Policy file for running the Apache web server
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# NOTES:
|
|
Chris PeBenito |
31b7c0 |
# This policy will work with SUEXEC enabled as part of the Apache
|
|
Chris PeBenito |
31b7c0 |
# configuration. However, the user CGI scripts will run under the
|
|
Chris PeBenito |
31b7c0 |
# system_u:system_r:httpd_$1_script_t domain where $1 is the domain of the
|
|
Chris PeBenito |
31b7c0 |
# of the creating user.
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# The user CGI scripts must be labeled with the httpd_$1_script_exec_t
|
|
Chris PeBenito |
31b7c0 |
# type, and the directory containing the scripts should also be labeled
|
|
Chris PeBenito |
31b7c0 |
# with these types. This policy allows user_r role to perform that
|
|
Chris PeBenito |
31b7c0 |
# relabeling. If it is desired that only sysadm_r should be able to relabel
|
|
Chris PeBenito |
31b7c0 |
# the user CGI scripts, then relabel rule for user_r should be removed.
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
###############################################################################
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
define(`httpd_home_dirs', `
|
|
Chris PeBenito |
31b7c0 |
r_dir_file(httpd_t, $1)
|
|
Chris PeBenito |
31b7c0 |
r_dir_file(httpd_suexec_t, $1)
|
|
Chris PeBenito |
31b7c0 |
can_exec(httpd_suexec_t, $1)
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
bool httpd_unified false;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Allow httpd to use built in scripting (usually php)
|
|
Chris PeBenito |
31b7c0 |
bool httpd_builtin_scripting false;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Allow httpd cgi support
|
|
Chris PeBenito |
31b7c0 |
bool httpd_enable_cgi false;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Allow httpd to read home directories
|
|
Chris PeBenito |
31b7c0 |
bool httpd_enable_homedirs false;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Run SSI execs in system CGI script domain.
|
|
Chris PeBenito |
31b7c0 |
bool httpd_ssi_exec false;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Allow http daemon to communicate with the TTY
|
|
Chris PeBenito |
31b7c0 |
bool httpd_tty_comm false;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Allow http daemon to tcp connect
|
|
Chris PeBenito |
31b7c0 |
bool httpd_can_network_connect false;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#########################################################
|
|
Chris PeBenito |
31b7c0 |
# Apache types
|
|
Chris PeBenito |
31b7c0 |
#########################################################
|
|
Chris PeBenito |
31b7c0 |
# httpd_config_t is the type given to the configuration
|
|
Chris PeBenito |
31b7c0 |
# files for apache /etc/httpd/conf
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
type httpd_config_t, file_type, sysadmfile;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# httpd_modules_t is the type given to module files (libraries)
|
|
Chris PeBenito |
31b7c0 |
# that come with Apache /etc/httpd/modules and /usr/lib/apache
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
type httpd_modules_t, file_type, sysadmfile;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# httpd_cache_t is the type given to the /var/cache/httpd
|
|
Chris PeBenito |
31b7c0 |
# directory and the files under that directory
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
type httpd_cache_t, file_type, sysadmfile;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# httpd_exec_t is the type give to the httpd executable.
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
daemon_domain(httpd, `, privmail, nscd_client_domain')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
append_logdir_domain(httpd)
|
|
Chris PeBenito |
31b7c0 |
#can read /etc/httpd/logs
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t httpd_log_t:lnk_file read;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# For /etc/init.d/apache2 reload
|
|
Chris PeBenito |
31b7c0 |
can_tcp_connect(httpd_t, httpd_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
can_tcp_connect(web_client_domain, httpd_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
can_exec(httpd_t, httpd_exec_t)
|
|
Chris PeBenito |
31b7c0 |
file_type_auto_trans(httpd_t, var_run_t, httpd_var_run_t, sock_file)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
general_domain_access(httpd_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t { random_device_t urandom_device_t }:chr_file { getattr ioctl read };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
read_sysctl(httpd_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t crypt_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# for modules that want to access /etc/mtab and /proc/meminfo
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t { proc_t etc_runtime_t }:file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
uses_shlib(httpd_t)
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t { usr_t lib_t }:file { getattr read ioctl };
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t usr_t:lnk_file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# for apache2 memory mapped files
|
|
Chris PeBenito |
31b7c0 |
var_lib_domain(httpd)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# for tomcat
|
|
Chris PeBenito |
31b7c0 |
r_dir_file(httpd_t, var_lib_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# execute perl
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t { bin_t sbin_t }:dir r_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
can_exec(httpd_t, { bin_t sbin_t })
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t bin_t:lnk_file read;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
########################################
|
|
Chris PeBenito |
31b7c0 |
# Set up networking
|
|
Chris PeBenito |
31b7c0 |
########################################
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
can_network_server(httpd_t)
|
|
Chris PeBenito |
31b7c0 |
can_kerberos(httpd_t)
|
|
Chris PeBenito |
31b7c0 |
can_resolve(httpd_t)
|
|
Chris PeBenito |
31b7c0 |
nsswitch_domain(httpd_t)
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t { http_port_t http_cache_port_t }:tcp_socket name_bind;
|
|
Chris PeBenito |
31b7c0 |
# allow httpd to connect to mysql/posgresql
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t { postgresql_port_t mysqld_port_t }:tcp_socket name_connect;
|
|
Chris PeBenito |
31b7c0 |
# allow httpd to work as a relay
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t { gopher_port_t ftp_port_t http_port_t http_cache_port_t }:tcp_socket name_connect;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
if (httpd_can_network_connect) {
|
|
Chris PeBenito |
31b7c0 |
can_network_client(httpd_t)
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t port_type:tcp_socket name_connect;
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
##########################################
|
|
Chris PeBenito |
31b7c0 |
# Legacy: remove when it's fixed #
|
|
Chris PeBenito |
31b7c0 |
# Allow libphp5.so with text relocations #
|
|
Chris PeBenito |
31b7c0 |
##########################################
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t texrel_shlib_t:file execmod;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#########################################
|
|
Chris PeBenito |
31b7c0 |
# Allow httpd to search users directories
|
|
Chris PeBenito |
31b7c0 |
#########################################
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t home_root_t:dir { getattr search };
|
|
Chris PeBenito |
31b7c0 |
dontaudit httpd_t sysadm_home_dir_t:dir getattr;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
############################################################################
|
|
Chris PeBenito |
31b7c0 |
# Allow the httpd_t the capability to bind to a port and various other stuff
|
|
Chris PeBenito |
31b7c0 |
############################################################################
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t self:capability { chown dac_override kill setgid setuid net_bind_service sys_tty_config };
|
|
Chris PeBenito |
31b7c0 |
dontaudit httpd_t self:capability net_admin;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#################################################
|
|
Chris PeBenito |
31b7c0 |
# Allow the httpd_t to read the web servers config files
|
|
Chris PeBenito |
31b7c0 |
###################################################
|
|
Chris PeBenito |
31b7c0 |
r_dir_file(httpd_t, httpd_config_t)
|
|
Chris PeBenito |
31b7c0 |
# allow logrotate to read the config files for restart
|
|
Chris PeBenito |
31b7c0 |
ifdef(`logrotate.te', `
|
|
Chris PeBenito |
31b7c0 |
r_dir_file(logrotate_t, httpd_config_t)
|
|
Chris PeBenito |
31b7c0 |
domain_auto_trans(logrotate_t, httpd_exec_t, httpd_t)
|
|
Chris PeBenito |
31b7c0 |
allow logrotate_t httpd_t:process signull;
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
r_dir_file(initrc_t, httpd_config_t)
|
|
Chris PeBenito |
31b7c0 |
##################################################
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
###############################
|
|
Chris PeBenito |
31b7c0 |
# Allow httpd_t to put files in /var/cache/httpd etc
|
|
Chris PeBenito |
31b7c0 |
##############################
|
|
Chris PeBenito |
31b7c0 |
create_dir_file(httpd_t, httpd_cache_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
###############################
|
|
Chris PeBenito |
31b7c0 |
# Allow httpd_t to access the tmpfs file system
|
|
Chris PeBenito |
31b7c0 |
##############################
|
|
Chris PeBenito |
31b7c0 |
tmpfs_domain(httpd)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#####################
|
|
Chris PeBenito |
31b7c0 |
# Allow httpd_t to access
|
|
Chris PeBenito |
31b7c0 |
# libraries for its modules
|
|
Chris PeBenito |
31b7c0 |
###############################
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t httpd_modules_t:file rx_file_perms;
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t httpd_modules_t:dir r_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t httpd_modules_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
######################################################################
|
|
Chris PeBenito |
31b7c0 |
# Allow initrc_t to access the Apache modules directory.
|
|
Chris PeBenito |
31b7c0 |
######################################################################
|
|
Chris PeBenito |
31b7c0 |
allow initrc_t httpd_modules_t:dir r_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
##############################################
|
|
Chris PeBenito |
31b7c0 |
# Allow httpd_t to have access to files
|
|
Chris PeBenito |
31b7c0 |
# such as nisswitch.conf
|
|
Chris PeBenito |
31b7c0 |
# need ioctl for php
|
|
Chris PeBenito |
31b7c0 |
###############################################
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t etc_t:file { read getattr ioctl };
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t etc_t:lnk_file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# setup the system domain for system CGI scripts
|
|
Chris PeBenito |
31b7c0 |
apache_domain(sys)
|
|
Chris PeBenito |
31b7c0 |
dontaudit httpd_sys_script_t httpd_config_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Run SSI execs in system CGI script domain.
|
|
Chris PeBenito |
31b7c0 |
if (httpd_ssi_exec) {
|
|
Chris PeBenito |
31b7c0 |
domain_auto_trans(httpd_t, shell_exec_t, httpd_sys_script_t)
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
allow httpd_sys_script_t httpd_t:tcp_socket { read write };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
##################################################
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# PHP Directives
|
|
Chris PeBenito |
31b7c0 |
##################################################
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
type httpd_php_exec_t, file_type, sysadmfile, exec_type;
|
|
Chris PeBenito |
31b7c0 |
type httpd_php_t, domain;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Transition from the user domain to this domain.
|
|
Chris PeBenito |
31b7c0 |
domain_auto_trans(httpd_t, httpd_php_exec_t, httpd_php_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# The system role is authorized for this domain.
|
|
Chris PeBenito |
31b7c0 |
role system_r types httpd_php_t;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
general_domain_access(httpd_php_t)
|
|
Chris PeBenito |
31b7c0 |
uses_shlib(httpd_php_t)
|
|
Chris PeBenito |
31b7c0 |
can_exec(httpd_php_t, lib_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# allow php to read and append to apache logfiles
|
|
Chris PeBenito |
31b7c0 |
allow httpd_php_t httpd_log_t:file ra_file_perms;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# access to /tmp
|
|
Chris PeBenito |
31b7c0 |
tmp_domain(httpd)
|
|
Chris PeBenito |
31b7c0 |
tmp_domain(httpd_php)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Creation of lock files for apache2
|
|
Chris PeBenito |
31b7c0 |
lock_domain(httpd)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Allow apache to used public_content_t
|
|
Chris PeBenito |
31b7c0 |
anonymous_domain(httpd)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# connect to mysql
|
|
Chris PeBenito |
31b7c0 |
ifdef(`mysqld.te', `
|
|
Chris PeBenito |
31b7c0 |
can_unix_connect(httpd_php_t, mysqld_t)
|
|
Chris PeBenito |
31b7c0 |
can_unix_connect(httpd_t, mysqld_t)
|
|
Chris PeBenito |
31b7c0 |
can_unix_connect(httpd_sys_script_t, mysqld_t)
|
|
Chris PeBenito |
31b7c0 |
allow httpd_php_t mysqld_var_run_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
allow httpd_php_t mysqld_var_run_t:sock_file write;
|
|
Chris PeBenito |
31b7c0 |
allow { httpd_t httpd_sys_script_t } mysqld_db_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
allow { httpd_t httpd_sys_script_t } mysqld_db_t:sock_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
allow { httpd_t httpd_sys_script_t } mysqld_var_run_t:sock_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t bin_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t sbin_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t httpd_log_t:dir remove_name;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
read_fonts(httpd_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t self:netlink_route_socket { bind create getattr nlmsg_read read write };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t autofs_t:dir { search getattr };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
if (use_nfs_home_dirs && httpd_enable_homedirs) {
|
|
Chris PeBenito |
31b7c0 |
httpd_home_dirs(nfs_t)
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
if (use_samba_home_dirs && httpd_enable_homedirs) {
|
|
Chris PeBenito |
31b7c0 |
httpd_home_dirs(cifs_t)
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Allow users to mount additional directories as http_source
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t mnt_t:dir r_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
ifdef(`targeted_policy', `
|
|
Chris PeBenito |
31b7c0 |
domain_auto_trans(unconfined_t, httpd_exec_t, httpd_t)
|
|
Chris PeBenito |
31b7c0 |
typealias httpd_sys_content_t alias httpd_user_content_t;
|
|
Chris PeBenito |
31b7c0 |
typealias httpd_sys_script_exec_t alias httpd_user_script_exec_t;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
if (httpd_enable_homedirs) {
|
|
Chris PeBenito |
31b7c0 |
allow { httpd_t httpd_sys_script_t httpd_suexec_t } user_home_dir_t:dir { getattr search };
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
') dnl targeted policy
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# We no longer call httpd_domain(sysadm), but need httpd_sysadm_content_t for file context
|
|
Chris PeBenito |
31b7c0 |
typealias httpd_sys_content_t alias httpd_sysadm_content_t;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
ifdef(`distro_redhat', `
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# mod_jk2 creates /var/log/httpd/jk2.shm to communicate with tomcat
|
|
Chris PeBenito |
31b7c0 |
# This is a bug but it still exists in FC2
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
typealias httpd_log_t alias httpd_runtime_t;
|
|
Chris PeBenito |
31b7c0 |
allow { httpd_t httpd_sys_script_t } httpd_runtime_t:file { getattr append };
|
|
Chris PeBenito |
31b7c0 |
dontaudit httpd_t httpd_runtime_t:file ioctl;
|
|
Chris PeBenito |
31b7c0 |
') dnl distro_redhat
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Customer reported the following
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
ifdef(`snmpd.te', `
|
|
Chris PeBenito |
31b7c0 |
dontaudit httpd_t snmpd_var_lib_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
dontaudit httpd_t snmpd_var_lib_t:file { getattr write read };
|
|
Chris PeBenito |
31b7c0 |
', `
|
|
Chris PeBenito |
31b7c0 |
dontaudit httpd_t usr_t:dir write;
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
application_domain(httpd_helper)
|
|
Chris PeBenito |
31b7c0 |
role system_r types httpd_helper_t;
|
|
Chris PeBenito |
31b7c0 |
domain_auto_trans(httpd_t, httpd_helper_exec_t, httpd_helper_t)
|
|
Chris PeBenito |
31b7c0 |
allow httpd_helper_t httpd_config_t:file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
allow httpd_helper_t httpd_log_t:file { append };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
########################################
|
|
Chris PeBenito |
31b7c0 |
# When the admin starts the server, the server wants to access
|
|
Chris PeBenito |
31b7c0 |
# the TTY or PTY associated with the session. The httpd appears
|
|
Chris PeBenito |
31b7c0 |
# to run correctly without this permission, so the permission
|
|
Chris PeBenito |
31b7c0 |
# are dontaudited here.
|
|
Chris PeBenito |
31b7c0 |
##################################################
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
if (httpd_tty_comm) {
|
|
Chris PeBenito |
31b7c0 |
allow { httpd_t httpd_helper_t } devpts_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
ifdef(`targeted_policy', `
|
|
Chris PeBenito |
31b7c0 |
allow { httpd_helper_t httpd_t } { devtty_t devpts_t }:chr_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
allow { httpd_t httpd_helper_t } admin_tty_type:chr_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
} else {
|
|
Chris PeBenito |
31b7c0 |
dontaudit httpd_t admin_tty_type:chr_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
read_sysctl(httpd_sys_script_t)
|
|
Chris PeBenito |
31b7c0 |
allow httpd_sys_script_t var_lib_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
dontaudit httpd_t selinux_config_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
r_dir_file(httpd_t, cert_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# unconfined domain for apache scripts. Only to be used as a last resort
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
type httpd_unconfined_script_exec_t, file_type, sysadmfile, customizable;
|
|
Chris PeBenito |
31b7c0 |
type httpd_unconfined_script_t, domain, nscd_client_domain;
|
|
Chris PeBenito |
31b7c0 |
role system_r types httpd_unconfined_script_t;
|
|
Chris PeBenito |
31b7c0 |
unconfined_domain(httpd_unconfined_script_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# The following are types for SUEXEC,which runs user scripts as their
|
|
Chris PeBenito |
31b7c0 |
# own user ID
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
daemon_sub_domain(httpd_t, httpd_suexec, `, transitionbool')
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t httpd_suexec_exec_t:file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#########################################################
|
|
Chris PeBenito |
31b7c0 |
# Permissions for running child processes and scripts
|
|
Chris PeBenito |
31b7c0 |
##########################################################
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t self:capability { setuid setgid };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
dontaudit httpd_suexec_t var_run_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t { var_t var_log_t }:dir search;
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t home_root_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t httpd_log_t:dir ra_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t httpd_log_t:file { create ra_file_perms };
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t httpd_t:fifo_file getattr;
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t etc_t:file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
read_locale(httpd_suexec_t)
|
|
Chris PeBenito |
31b7c0 |
read_sysctl(httpd_suexec_t)
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t urandom_device_t:chr_file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# for shell scripts
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t bin_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t bin_t:lnk_file read;
|
|
Chris PeBenito |
31b7c0 |
can_exec(httpd_suexec_t, { bin_t shell_exec_t })
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
if (httpd_can_network_connect) {
|
|
Chris PeBenito |
31b7c0 |
can_network(httpd_suexec_t)
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t port_type:tcp_socket name_connect;
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
can_ypbind(httpd_suexec_t)
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t { usr_t lib_t }:file { getattr read ioctl };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow httpd_suexec_t autofs_t:dir { search getattr };
|
|
Chris PeBenito |
31b7c0 |
tmp_domain(httpd_suexec)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
if (httpd_enable_cgi && httpd_unified) {
|
|
Chris PeBenito |
31b7c0 |
domain_auto_trans(httpd_suexec_t, httpdcontent, httpd_sys_script_t)
|
|
Chris PeBenito |
31b7c0 |
ifdef(`targeted_policy', `', `
|
|
Chris PeBenito |
31b7c0 |
domain_auto_trans(sysadm_t, httpdcontent, httpd_sys_script_t)
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
if (httpd_enable_cgi && httpd_unified && httpd_builtin_scripting) {
|
|
Chris PeBenito |
31b7c0 |
domain_auto_trans(httpd_t, httpdcontent, httpd_sys_script_t)
|
|
Chris PeBenito |
31b7c0 |
create_dir_file(httpd_t, httpdcontent)
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
if (httpd_enable_cgi) {
|
|
Chris PeBenito |
31b7c0 |
domain_auto_trans(httpd_t, httpd_unconfined_script_exec_t, httpd_unconfined_script_t)
|
|
Chris PeBenito |
31b7c0 |
domain_auto_trans(httpd_suexec_t, httpd_unconfined_script_exec_t, httpd_unconfined_script_t)
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t httpd_unconfined_script_t:process { signal sigkill sigstop };
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t httpd_unconfined_script_exec_t:dir r_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Types for squirrelmail
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
type httpd_squirrelmail_t, file_type, sysadmfile;
|
|
Chris PeBenito |
31b7c0 |
create_dir_file(httpd_t, httpd_squirrelmail_t)
|
|
Chris PeBenito |
31b7c0 |
allow httpd_sys_script_t httpd_squirrelmail_t:file { append read };
|
|
Chris PeBenito |
31b7c0 |
# File Type of squirrelmail attachments
|
|
Chris PeBenito |
31b7c0 |
type squirrelmail_spool_t, file_type, sysadmfile, tmpfile;
|
|
Chris PeBenito |
31b7c0 |
allow { httpd_t httpd_sys_script_t } var_spool_t:dir { getattr search };
|
|
Chris PeBenito |
31b7c0 |
create_dir_file(httpd_t, squirrelmail_spool_t)
|
|
Chris PeBenito |
31b7c0 |
r_dir_file(httpd_sys_script_t, squirrelmail_spool_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
ifdef(`mta.te', `
|
|
Chris PeBenito |
31b7c0 |
# apache should set close-on-exec
|
|
Chris PeBenito |
31b7c0 |
dontaudit httpd_suexec_t httpd_t:unix_stream_socket { read write };
|
|
Chris PeBenito |
31b7c0 |
dontaudit { system_mail_t mta_user_agent } { httpd_t httpd_sys_script_t }:unix_stream_socket { read write };
|
|
Chris PeBenito |
31b7c0 |
dontaudit system_mail_t httpd_log_t:file { append getattr };
|
|
Chris PeBenito |
31b7c0 |
allow system_mail_t httpd_squirrelmail_t:file { append read };
|
|
Chris PeBenito |
31b7c0 |
dontaudit system_mail_t httpd_t:tcp_socket { read write };
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
bool httpd_enable_ftp_server false;
|
|
Chris PeBenito |
31b7c0 |
if (httpd_enable_ftp_server) {
|
|
Chris PeBenito |
31b7c0 |
allow httpd_t ftp_port_t:tcp_socket name_bind;
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
|