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

209 lines
5.9 KiB
Plaintext
Raw Normal View History

2010-05-24 19:32:01 +00:00
policy_module(squid, 1.10.0)
2005-09-02 19:11:07 +00:00
########################################
#
# Declarations
#
## <desc>
## <p>
## Allow squid to connect to all ports, not just
## HTTP, FTP, and Gopher ports.
## </p>
## </desc>
gen_tunable(squid_connect_any, false)
## <desc>
## <p>
## Allow squid to run as a transparent proxy (TPROXY)
## </p>
## </desc>
gen_tunable(squid_use_tproxy, false)
2005-09-02 19:11:07 +00:00
type squid_t;
type squid_exec_t;
init_daemon_domain(squid_t, squid_exec_t)
2005-09-02 19:11:07 +00:00
# type for /var/cache/squid
type squid_cache_t;
files_type(squid_cache_t)
type squid_conf_t;
files_type(squid_conf_t)
type squid_initrc_exec_t;
init_script_file(squid_initrc_exec_t)
2005-09-02 19:11:07 +00:00
type squid_log_t;
logging_log_file(squid_log_t)
type squid_tmpfs_t;
files_tmpfs_file(squid_tmpfs_t)
2005-09-02 19:11:07 +00:00
type squid_var_run_t;
files_pid_file(squid_var_run_t)
########################################
#
# Local policy
#
2008-09-15 13:31:28 +00:00
allow squid_t self:capability { setgid kill setuid dac_override sys_resource };
2005-09-02 19:11:07 +00:00
dontaudit squid_t self:capability sys_tty_config;
allow squid_t self:process ~{ ptrace setcurrent setexec setfscreate execmem execstack execheap };
2006-12-12 20:08:08 +00:00
allow squid_t self:fifo_file rw_fifo_file_perms;
allow squid_t self:sock_file read_sock_file_perms;
2005-09-02 19:11:07 +00:00
allow squid_t self:fd use;
allow squid_t self:shm create_shm_perms;
allow squid_t self:sem create_sem_perms;
allow squid_t self:msgq create_msgq_perms;
allow squid_t self:msg { send receive };
2005-10-26 18:07:20 +00:00
allow squid_t self:unix_stream_socket create_stream_socket_perms;
allow squid_t self:unix_dgram_socket create_socket_perms;
allow squid_t self:unix_dgram_socket sendto;
allow squid_t self:unix_stream_socket connectto;
allow squid_t self:tcp_socket create_stream_socket_perms;
allow squid_t self:udp_socket create_socket_perms;
2005-09-02 19:11:07 +00:00
# Grant permissions to create, access, and delete cache files.
manage_dirs_pattern(squid_t, squid_cache_t, squid_cache_t)
manage_files_pattern(squid_t, squid_cache_t, squid_cache_t)
manage_lnk_files_pattern(squid_t, squid_cache_t, squid_cache_t)
2005-09-02 19:11:07 +00:00
2006-12-12 20:08:08 +00:00
allow squid_t squid_conf_t:dir list_dir_perms;
read_files_pattern(squid_t, squid_conf_t, squid_conf_t)
read_lnk_files_pattern(squid_t, squid_conf_t, squid_conf_t)
2005-09-02 19:11:07 +00:00
can_exec(squid_t, squid_exec_t)
2005-09-02 19:11:07 +00:00
manage_dirs_pattern(squid_t, squid_log_t, squid_log_t)
manage_files_pattern(squid_t, squid_log_t, squid_log_t)
manage_lnk_files_pattern(squid_t, squid_log_t, squid_log_t)
logging_log_filetrans(squid_t, squid_log_t, { file dir })
2005-09-02 19:11:07 +00:00
#squid requires the following when run in diskd mode, the recommended setting
manage_files_pattern(squid_t, squid_tmpfs_t, squid_tmpfs_t)
2010-05-24 15:50:50 +00:00
fs_tmpfs_filetrans(squid_t, squid_tmpfs_t, file)
manage_files_pattern(squid_t, squid_var_run_t, squid_var_run_t)
files_pid_filetrans(squid_t, squid_var_run_t, file)
2005-09-02 19:11:07 +00:00
kernel_read_kernel_sysctls(squid_t)
2005-09-02 19:11:07 +00:00
kernel_read_system_state(squid_t)
files_dontaudit_getattr_boot_dirs(squid_t)
2005-09-02 19:11:07 +00:00
corenet_all_recvfrom_unlabeled(squid_t)
corenet_all_recvfrom_netlabel(squid_t)
corenet_tcp_sendrecv_generic_if(squid_t)
corenet_udp_sendrecv_generic_if(squid_t)
corenet_tcp_sendrecv_generic_node(squid_t)
corenet_udp_sendrecv_generic_node(squid_t)
2005-09-02 19:11:07 +00:00
corenet_tcp_sendrecv_all_ports(squid_t)
corenet_udp_sendrecv_all_ports(squid_t)
corenet_tcp_bind_generic_node(squid_t)
corenet_udp_bind_generic_node(squid_t)
2008-09-15 13:31:28 +00:00
corenet_tcp_bind_http_port(squid_t)
2005-09-02 19:11:07 +00:00
corenet_tcp_bind_http_cache_port(squid_t)
corenet_udp_bind_http_cache_port(squid_t)
corenet_tcp_bind_ftp_port(squid_t)
corenet_tcp_bind_gopher_port(squid_t)
corenet_udp_bind_gopher_port(squid_t)
corenet_tcp_bind_squid_port(squid_t)
corenet_udp_bind_squid_port(squid_t)
2008-09-15 13:31:28 +00:00
corenet_udp_bind_wccp_port(squid_t)
2005-09-13 13:06:07 +00:00
corenet_tcp_connect_ftp_port(squid_t)
corenet_tcp_connect_gopher_port(squid_t)
corenet_tcp_connect_http_port(squid_t)
2006-07-12 13:17:24 +00:00
corenet_tcp_connect_http_cache_port(squid_t)
2008-09-15 13:31:28 +00:00
corenet_tcp_connect_pgpkeyserver_port(squid_t)
2006-05-26 20:29:51 +00:00
corenet_sendrecv_ftp_client_packets(squid_t)
corenet_sendrecv_gopher_client_packets(squid_t)
2008-09-15 13:31:28 +00:00
corenet_sendrecv_http_client_packets(squid_t)
corenet_sendrecv_http_server_packets(squid_t)
2006-05-26 20:29:51 +00:00
corenet_sendrecv_http_cache_server_packets(squid_t)
corenet_sendrecv_http_cache_client_packets(squid_t)
2008-09-15 13:31:28 +00:00
corenet_sendrecv_pgpkeyserver_client_packets(squid_t)
corenet_sendrecv_squid_client_packets(squid_t)
corenet_sendrecv_squid_server_packets(squid_t)
2008-09-15 13:31:28 +00:00
corenet_sendrecv_wccp_server_packets(squid_t)
2005-09-02 19:11:07 +00:00
dev_read_sysfs(squid_t)
dev_read_urand(squid_t)
fs_getattr_all_fs(squid_t)
fs_search_auto_mountpoints(squid_t)
2009-05-06 14:26:20 +00:00
fs_list_inotifyfs(squid_t)
2005-09-02 19:11:07 +00:00
selinux_dontaudit_getattr_dir(squid_t)
2006-02-02 21:08:12 +00:00
term_dontaudit_getattr_pty_dirs(squid_t)
2005-09-02 19:11:07 +00:00
# to allow running programs from /usr/lib/squid (IE unlinkd)
corecmd_exec_bin(squid_t)
corecmd_exec_shell(squid_t)
2006-02-20 21:33:25 +00:00
domain_use_interactive_fds(squid_t)
2005-09-02 19:11:07 +00:00
files_read_etc_files(squid_t)
files_read_etc_runtime_files(squid_t)
files_read_usr_files(squid_t)
files_search_spool(squid_t)
files_dontaudit_getattr_tmp_dirs(squid_t)
2005-09-02 19:11:07 +00:00
files_getattr_home_dir(squid_t)
auth_use_nsswitch(squid_t)
2008-09-15 13:31:28 +00:00
auth_domtrans_chk_passwd(squid_t)
2005-09-02 19:11:07 +00:00
# to allow running programs from /usr/lib/squid (IE unlinkd)
libs_exec_lib_files(squid_t)
logging_send_syslog_msg(squid_t)
miscfiles_read_generic_certs(squid_t)
2005-09-02 19:11:07 +00:00
miscfiles_read_localization(squid_t)
2006-02-21 18:40:44 +00:00
userdom_use_unpriv_users_fds(squid_t)
2008-11-05 16:10:46 +00:00
userdom_dontaudit_search_user_home_dirs(squid_t)
2005-09-02 19:11:07 +00:00
2005-09-13 13:06:07 +00:00
tunable_policy(`squid_connect_any',`
corenet_tcp_connect_all_ports(squid_t)
2008-10-08 15:50:03 +00:00
corenet_tcp_bind_all_ports(squid_t)
corenet_sendrecv_all_packets(squid_t)
2005-09-13 13:06:07 +00:00
')
tunable_policy(`squid_use_tproxy',`
allow squid_t self:capability net_admin;
corenet_tcp_bind_netport_port(squid_t)
')
optional_policy(`
2008-09-15 13:31:28 +00:00
apache_content_template(squid)
allow httpd_squid_script_t self:tcp_socket create_socket_perms;
corenet_all_recvfrom_unlabeled(httpd_squid_script_t)
corenet_all_recvfrom_netlabel(httpd_squid_script_t)
corenet_tcp_connect_http_cache_port(httpd_squid_script_t)
sysnet_dns_name_resolve(httpd_squid_script_t)
squid_read_config(httpd_squid_script_t)
')
optional_policy(`
cron_system_entry(squid_t, squid_exec_t)
2005-09-02 19:11:07 +00:00
')
optional_policy(`
2005-10-26 18:07:20 +00:00
samba_domtrans_winbind_helper(squid_t)
')
optional_policy(`
2005-09-02 19:11:07 +00:00
seutil_sigchld_newrole(squid_t)
')
optional_policy(`
2005-09-02 19:11:07 +00:00
udev_read_db(squid_t)
')