Chris PeBenito 29af4c
policy_module(squid, 1.10.0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## Allow squid to connect to all ports, not just
Chris PeBenito 56e1b3
## HTTP, FTP, and Gopher ports.
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 0bfccd
gen_tunable(squid_connect_any, false)
Chris PeBenito 56e1b3
Jeremy Solt d86c09
## <desc>
Jeremy Solt d86c09
## 

Jeremy Solt d86c09
## Allow squid to run as a transparent proxy (TPROXY)
Jeremy Solt d86c09
## 

Jeremy Solt d86c09
## </desc>
Jeremy Solt d86c09
gen_tunable(squid_use_tproxy, false)
Jeremy Solt d86c09
Chris PeBenito 17de1b
type squid_t;
Chris PeBenito 17de1b
type squid_exec_t;
Chris PeBenito 0bfccd
init_daemon_domain(squid_t, squid_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# type for /var/cache/squid
Chris PeBenito 17de1b
type squid_cache_t;
Chris PeBenito 17de1b
files_type(squid_cache_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type squid_conf_t;
Chris PeBenito 17de1b
files_type(squid_conf_t)
Chris PeBenito 17de1b
Chris PeBenito 48f645
type squid_initrc_exec_t;
Chris PeBenito 48f645
init_script_file(squid_initrc_exec_t)
Chris PeBenito 48f645
Chris PeBenito 17de1b
type squid_log_t;
Chris PeBenito 17de1b
logging_log_file(squid_log_t)
Chris PeBenito 17de1b
Jeremy Solt 599e8f
type squid_tmpfs_t;
Jeremy Solt 599e8f
files_tmpfs_file(squid_tmpfs_t)
Jeremy Solt 599e8f
Chris PeBenito 17de1b
type squid_var_run_t;
Chris PeBenito 17de1b
files_pid_file(squid_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito a46b60
allow squid_t self:capability { setgid kill setuid dac_override sys_resource };
Chris PeBenito 17de1b
dontaudit squid_t self:capability sys_tty_config;
Chris PeBenito a5e213
allow squid_t self:process ~{ ptrace setcurrent setexec setfscreate execmem execstack execheap };
Chris PeBenito c0868a
allow squid_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito c0868a
allow squid_t self:sock_file read_sock_file_perms;
Chris PeBenito 17de1b
allow squid_t self:fd use;
Chris PeBenito 17de1b
allow squid_t self:shm create_shm_perms;
Chris PeBenito 17de1b
allow squid_t self:sem create_sem_perms;
Chris PeBenito 17de1b
allow squid_t self:msgq create_msgq_perms;
Chris PeBenito 17de1b
allow squid_t self:msg { send receive };
Chris PeBenito 17de1b
allow squid_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow squid_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow squid_t self:unix_dgram_socket sendto;
Chris PeBenito 17de1b
allow squid_t self:unix_stream_socket connectto;
Chris PeBenito 17de1b
allow squid_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow squid_t self:udp_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# Grant permissions to create, access, and delete cache files.
Chris PeBenito 0bfccd
manage_dirs_pattern(squid_t, squid_cache_t, squid_cache_t)
Chris PeBenito 0bfccd
manage_files_pattern(squid_t, squid_cache_t, squid_cache_t)
Chris PeBenito 0bfccd
manage_lnk_files_pattern(squid_t, squid_cache_t, squid_cache_t)
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow squid_t squid_conf_t:dir list_dir_perms;
Chris PeBenito 0bfccd
read_files_pattern(squid_t, squid_conf_t, squid_conf_t)
Chris PeBenito 0bfccd
read_lnk_files_pattern(squid_t, squid_conf_t, squid_conf_t)
Chris PeBenito 17de1b
Chris PeBenito 0bfccd
can_exec(squid_t, squid_exec_t)
Chris PeBenito 17de1b
Jeremy Solt d86c09
manage_dirs_pattern(squid_t, squid_log_t, squid_log_t)
Chris PeBenito 0bfccd
manage_files_pattern(squid_t, squid_log_t, squid_log_t)
Jeremy Solt d86c09
manage_lnk_files_pattern(squid_t, squid_log_t, squid_log_t)
Chris PeBenito 0bfccd
logging_log_filetrans(squid_t, squid_log_t, { file dir })
Chris PeBenito 17de1b
Jeremy Solt 599e8f
#squid requires the following when run in diskd mode, the recommended setting
Jeremy Solt 599e8f
manage_files_pattern(squid_t, squid_tmpfs_t, squid_tmpfs_t)
Chris PeBenito bdf5e1
fs_tmpfs_filetrans(squid_t, squid_tmpfs_t, file)
Jeremy Solt 599e8f
Chris PeBenito 0bfccd
manage_files_pattern(squid_t, squid_var_run_t, squid_var_run_t)
Chris PeBenito 0bfccd
files_pid_filetrans(squid_t, squid_var_run_t, file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(squid_t)
Chris PeBenito 17de1b
kernel_read_system_state(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_dontaudit_getattr_boot_dirs(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(squid_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(squid_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(squid_t)
Chris PeBenito 668b30
corenet_udp_sendrecv_generic_if(squid_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(squid_t)
Chris PeBenito c12621
corenet_udp_sendrecv_generic_node(squid_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(squid_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(squid_t)
Chris PeBenito c12621
corenet_tcp_bind_generic_node(squid_t)
Chris PeBenito c12621
corenet_udp_bind_generic_node(squid_t)
Chris PeBenito a46b60
corenet_tcp_bind_http_port(squid_t)
Chris PeBenito 17de1b
corenet_tcp_bind_http_cache_port(squid_t)
Chris PeBenito 465510
corenet_udp_bind_http_cache_port(squid_t)
Chris PeBenito 17de1b
corenet_tcp_bind_ftp_port(squid_t)
Chris PeBenito 17de1b
corenet_tcp_bind_gopher_port(squid_t)
Chris PeBenito 465510
corenet_udp_bind_gopher_port(squid_t)
Chris PeBenito b129e2
corenet_tcp_bind_squid_port(squid_t)
Chris PeBenito b129e2
corenet_udp_bind_squid_port(squid_t)
Chris PeBenito a46b60
corenet_udp_bind_wccp_port(squid_t)
Chris PeBenito 17de1b
corenet_tcp_connect_ftp_port(squid_t)
Chris PeBenito 17de1b
corenet_tcp_connect_gopher_port(squid_t)
Chris PeBenito 17de1b
corenet_tcp_connect_http_port(squid_t)
Chris PeBenito 17de1b
corenet_tcp_connect_http_cache_port(squid_t)
Chris PeBenito a46b60
corenet_tcp_connect_pgpkeyserver_port(squid_t)
Chris PeBenito 17de1b
corenet_sendrecv_ftp_client_packets(squid_t)
Chris PeBenito 17de1b
corenet_sendrecv_gopher_client_packets(squid_t)
Chris PeBenito a46b60
corenet_sendrecv_http_client_packets(squid_t)
Chris PeBenito a46b60
corenet_sendrecv_http_server_packets(squid_t)
Chris PeBenito 17de1b
corenet_sendrecv_http_cache_server_packets(squid_t)
Chris PeBenito 17de1b
corenet_sendrecv_http_cache_client_packets(squid_t)
Chris PeBenito a46b60
corenet_sendrecv_pgpkeyserver_client_packets(squid_t)
Chris PeBenito b129e2
corenet_sendrecv_squid_client_packets(squid_t)
Chris PeBenito b129e2
corenet_sendrecv_squid_server_packets(squid_t)
Chris PeBenito a46b60
corenet_sendrecv_wccp_server_packets(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_sysfs(squid_t)
Chris PeBenito 17de1b
dev_read_urand(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_all_fs(squid_t)
Chris PeBenito 17de1b
fs_search_auto_mountpoints(squid_t)
Chris PeBenito 339235
fs_list_inotifyfs(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
selinux_dontaudit_getattr_dir(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_dontaudit_getattr_pty_dirs(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# to allow running programs from /usr/lib/squid (IE unlinkd)
Chris PeBenito 17de1b
corecmd_exec_bin(squid_t)
Chris PeBenito 17de1b
corecmd_exec_shell(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(squid_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(squid_t)
Chris PeBenito 17de1b
files_read_usr_files(squid_t)
Chris PeBenito 17de1b
files_search_spool(squid_t)
Chris PeBenito 17de1b
files_dontaudit_getattr_tmp_dirs(squid_t)
Chris PeBenito 17de1b
files_getattr_home_dir(squid_t)
Chris PeBenito 17de1b
Chris PeBenito c0cf6e
auth_use_nsswitch(squid_t)
Chris PeBenito a46b60
auth_domtrans_chk_passwd(squid_t)
Chris PeBenito c0cf6e
Chris PeBenito 17de1b
# to allow running programs from /usr/lib/squid (IE unlinkd)
Chris PeBenito 17de1b
libs_exec_lib_files(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(squid_t)
Chris PeBenito 17de1b
Dominick Grift 834062
miscfiles_read_generic_certs(squid_t)
Chris PeBenito 17de1b
miscfiles_read_localization(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_use_unpriv_users_fds(squid_t)
Chris PeBenito 296273
userdom_dontaudit_search_user_home_dirs(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`squid_connect_any',`
Chris PeBenito 17de1b
	corenet_tcp_connect_all_ports(squid_t)
Chris PeBenito e87221
	corenet_tcp_bind_all_ports(squid_t)
Chris PeBenito e87221
	corenet_sendrecv_all_packets(squid_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Jeremy Solt d86c09
tunable_policy(`squid_use_tproxy',`
Jeremy Solt d86c09
	allow squid_t self:capability net_admin;
Jeremy Solt d86c09
	corenet_tcp_bind_netport_port(squid_t)
Jeremy Solt d86c09
')
Jeremy Solt d86c09
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito a46b60
	apache_content_template(squid)
Chris PeBenito a46b60
Chris PeBenito a46b60
	allow httpd_squid_script_t self:tcp_socket create_socket_perms;
Chris PeBenito a46b60
Chris PeBenito a46b60
	corenet_all_recvfrom_unlabeled(httpd_squid_script_t)
Chris PeBenito a46b60
	corenet_all_recvfrom_netlabel(httpd_squid_script_t)
Chris PeBenito a46b60
	corenet_tcp_connect_http_cache_port(httpd_squid_script_t)
Chris PeBenito a46b60
Chris PeBenito a46b60
	sysnet_dns_name_resolve(httpd_squid_script_t)
Chris PeBenito a46b60
Chris PeBenito a46b60
	squid_read_config(httpd_squid_script_t)
Chris PeBenito a46b60
')
Chris PeBenito a46b60
Chris PeBenito a46b60
optional_policy(`
Chris PeBenito a46b60
	cron_system_entry(squid_t, squid_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	samba_domtrans_winbind_helper(squid_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	seutil_sigchld_newrole(squid_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	udev_read_db(squid_t)
Chris PeBenito 17de1b
')