Chris PeBenito 17de1b
Chris PeBenito b129e2
policy_module(squid,1.3.1)
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 56e1b3
gen_tunable(squid_connect_any,false)
Chris PeBenito 56e1b3
Chris PeBenito 17de1b
type squid_t;
Chris PeBenito 17de1b
type squid_exec_t;
Chris PeBenito 17de1b
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 17de1b
type squid_log_t;
Chris PeBenito 17de1b
logging_log_file(squid_log_t)
Chris PeBenito 17de1b
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 a5e213
allow squid_t self:capability { setgid 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 c0868a
manage_dirs_pattern(squid_t,squid_cache_t,squid_cache_t)
Chris PeBenito c0868a
manage_files_pattern(squid_t,squid_cache_t,squid_cache_t)
Chris PeBenito c0868a
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 c0868a
read_files_pattern(squid_t,squid_conf_t,squid_conf_t)
Chris PeBenito c0868a
read_lnk_files_pattern(squid_t,squid_conf_t,squid_conf_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
can_exec(squid_t,squid_exec_t)
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_files_pattern(squid_t,squid_log_t,squid_log_t)
Chris PeBenito 17de1b
logging_log_filetrans(squid_t,squid_log_t,{ file dir })
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_files_pattern(squid_t,squid_var_run_t,squid_var_run_t)
Chris PeBenito 17de1b
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 17de1b
corenet_non_ipsec_sendrecv(squid_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_if(squid_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_if(squid_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_nodes(squid_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_nodes(squid_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(squid_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(squid_t)
Chris PeBenito 17de1b
corenet_tcp_bind_all_nodes(squid_t)
Chris PeBenito 17de1b
corenet_udp_bind_all_nodes(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 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 17de1b
corenet_sendrecv_http_client_packets(squid_t)
Chris PeBenito 17de1b
corenet_sendrecv_ftp_client_packets(squid_t)
Chris PeBenito 17de1b
corenet_sendrecv_gopher_client_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 b129e2
corenet_sendrecv_squid_client_packets(squid_t)
Chris PeBenito b129e2
corenet_sendrecv_squid_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 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 17de1b
libs_use_ld_so(squid_t)
Chris PeBenito 17de1b
libs_use_shared_libs(squid_t)
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
Chris PeBenito 17de1b
miscfiles_read_certs(squid_t)
Chris PeBenito 17de1b
miscfiles_read_localization(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
sysnet_dns_name_resolve(squid_t)
Chris PeBenito 17de1b
sysnet_read_config(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_use_unpriv_users_fds(squid_t)
Chris PeBenito 17de1b
userdom_dontaudit_use_unpriv_user_fds(squid_t)
Chris PeBenito 17de1b
userdom_dontaudit_search_sysadm_home_dirs(squid_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy', `
Chris PeBenito 17de1b
	term_dontaudit_use_unallocated_ttys(squid_t)
Chris PeBenito 17de1b
	term_dontaudit_use_generic_ptys(squid_t)
Chris PeBenito 17de1b
	files_dontaudit_read_root_files(squid_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`squid_connect_any',`
Chris PeBenito 17de1b
	corenet_tcp_connect_all_ports(squid_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	allow squid_t self:capability kill;
Chris PeBenito 17de1b
	cron_use_fds(squid_t)
Chris PeBenito 17de1b
	cron_use_system_job_fds(squid_t)
Chris PeBenito 17de1b
	cron_rw_pipes(squid_t)
Chris PeBenito 17de1b
	cron_write_system_job_pipes(squid_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nis_use_ypbind(squid_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nscd_socket_use(squid_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
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`TODO',`
Chris PeBenito 17de1b
#squid requires the following when run in diskd mode, the recommended setting
Chris PeBenito 17de1b
allow squid_t tmpfs_t:file { read write };
Chris PeBenito 17de1b
') dnl end TODO