Chris PeBenito 0f707d
Chris PeBenito 5ea24b
policy_module(squid,1.1.0)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
########################################
Chris PeBenito 0f707d
#
Chris PeBenito 0f707d
# Declarations
Chris PeBenito 0f707d
#
Chris PeBenito 0f707d
Chris PeBenito 0f707d
type squid_t;
Chris PeBenito 0f707d
type squid_exec_t;
Chris PeBenito 0f707d
init_daemon_domain(squid_t,squid_exec_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
# type for /var/cache/squid
Chris PeBenito 0f707d
type squid_cache_t;
Chris PeBenito 0f707d
files_type(squid_cache_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
type squid_conf_t;
Chris PeBenito 0f707d
files_type(squid_conf_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
type squid_log_t;
Chris PeBenito 0f707d
logging_log_file(squid_log_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
type squid_var_run_t;
Chris PeBenito 0f707d
files_pid_file(squid_var_run_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
########################################
Chris PeBenito 0f707d
#
Chris PeBenito 0f707d
# Local policy
Chris PeBenito 0f707d
#
Chris PeBenito 0f707d
Chris PeBenito 2705f9
allow squid_t self:capability { setgid setuid dac_override };
Chris PeBenito 0f707d
dontaudit squid_t self:capability sys_tty_config;
Chris PeBenito 0f707d
allow squid_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
Chris PeBenito 0f707d
allow squid_t self:fifo_file rw_file_perms;
Chris PeBenito d1b9d9
allow squid_t self:sock_file r_file_perms;
Chris PeBenito 0f707d
allow squid_t self:fd use;
Chris PeBenito 0f707d
allow squid_t self:shm create_shm_perms;
Chris PeBenito 0f707d
allow squid_t self:sem create_sem_perms;
Chris PeBenito 0f707d
allow squid_t self:msgq create_msgq_perms;
Chris PeBenito 0f707d
allow squid_t self:msg { send receive };
Chris PeBenito d1b9d9
allow squid_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito d1b9d9
allow squid_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito d1b9d9
allow squid_t self:unix_dgram_socket sendto;
Chris PeBenito d1b9d9
allow squid_t self:unix_stream_socket connectto;
Chris PeBenito d1b9d9
allow squid_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito d1b9d9
allow squid_t self:udp_socket create_socket_perms;
Chris PeBenito 0f707d
Chris PeBenito 0f707d
# Grant permissions to create, access, and delete cache files.
Chris PeBenito 0f707d
allow squid_t squid_cache_t:dir create_dir_perms;
Chris PeBenito 0f707d
allow squid_t squid_cache_t:file create_file_perms;
Chris PeBenito 0f707d
allow squid_t squid_cache_t:lnk_file create_lnk_perms;
Chris PeBenito 0f707d
Chris PeBenito 0f707d
allow squid_t squid_conf_t:file r_file_perms;
Chris PeBenito 0f707d
allow squid_t squid_conf_t:dir r_dir_perms;
Chris PeBenito 0f707d
allow squid_t squid_conf_t:lnk_file read;
Chris PeBenito 0f707d
Chris PeBenito 0f707d
can_exec(squid_t,squid_exec_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
allow squid_t squid_log_t:file create_file_perms;
Chris PeBenito 0f707d
allow squid_t squid_log_t:dir rw_dir_perms;
Chris PeBenito 103fe2
logging_log_filetrans(squid_t,squid_log_t,{ file dir })
Chris PeBenito 0f707d
Chris PeBenito 0f707d
allow squid_t squid_var_run_t:file create_file_perms;
Chris PeBenito d1b9d9
allow squid_t squid_var_run_t:dir rw_dir_perms;
Chris PeBenito 103fe2
files_pid_filetrans(squid_t,squid_var_run_t)
Chris PeBenito 0f707d
Chris PeBenito 445522
kernel_read_kernel_sysctls(squid_t)
Chris PeBenito 0f707d
kernel_read_system_state(squid_t)
Chris PeBenito 0f707d
kernel_tcp_recvfrom(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 1815ba
bootloader_dontaudit_getattr_boot_dirs(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
corenet_tcp_sendrecv_all_if(squid_t)
Chris PeBenito 0f707d
corenet_raw_sendrecv_all_if(squid_t)
Chris PeBenito 0f707d
corenet_udp_sendrecv_all_if(squid_t)
Chris PeBenito 0f707d
corenet_tcp_sendrecv_all_nodes(squid_t)
Chris PeBenito 0f707d
corenet_udp_sendrecv_all_nodes(squid_t)
Chris PeBenito 0f707d
corenet_raw_sendrecv_all_nodes(squid_t)
Chris PeBenito 0f707d
corenet_tcp_sendrecv_all_ports(squid_t)
Chris PeBenito 0f707d
corenet_udp_sendrecv_all_ports(squid_t)
Chris PeBenito bd7037
corenet_non_ipsec_sendrecv(squid_t)
Chris PeBenito 0f707d
corenet_tcp_bind_all_nodes(squid_t)
Chris PeBenito 0f707d
corenet_udp_bind_all_nodes(squid_t)
Chris PeBenito 0f707d
corenet_tcp_bind_http_cache_port(squid_t)
Chris PeBenito 0f707d
corenet_udp_bind_http_cache_port(squid_t)
Chris PeBenito 77f6e2
corenet_tcp_bind_ftp_port(squid_t)
Chris PeBenito 77f6e2
corenet_udp_bind_ftp_port(squid_t)
Chris PeBenito 77f6e2
corenet_tcp_bind_gopher_port(squid_t)
Chris PeBenito 77f6e2
corenet_udp_bind_gopher_port(squid_t)
Chris PeBenito 0907bd
corenet_tcp_connect_ftp_port(squid_t)
Chris PeBenito 0907bd
corenet_tcp_connect_gopher_port(squid_t)
Chris PeBenito 0907bd
corenet_tcp_connect_http_port(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
dev_read_sysfs(squid_t)
Chris PeBenito 0f707d
dev_read_urand(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
fs_getattr_all_fs(squid_t)
Chris PeBenito 0f707d
fs_search_auto_mountpoints(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
selinux_dontaudit_getattr_dir(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
term_dontaudit_use_console(squid_t)
Chris PeBenito 1815ba
term_dontaudit_getattr_pty_dirs(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
# to allow running programs from /usr/lib/squid (IE unlinkd)
Chris PeBenito 0f707d
corecmd_exec_bin(squid_t)
Chris PeBenito 0f707d
corecmd_exec_sbin(squid_t)
Chris PeBenito 0f707d
corecmd_exec_shell(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 15722e
domain_use_interactive_fds(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
files_read_etc_files(squid_t)
Chris PeBenito 0f707d
files_read_etc_runtime_files(squid_t)
Chris PeBenito 0f707d
files_read_usr_files(squid_t)
Chris PeBenito 0f707d
files_search_spool(squid_t)
Chris PeBenito 9e04f5
files_dontaudit_getattr_tmp_dirs(squid_t)
Chris PeBenito 0f707d
files_getattr_home_dir(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
init_use_fd(squid_t)
Chris PeBenito 1815ba
init_use_script_ptys(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
libs_use_ld_so(squid_t)
Chris PeBenito 0f707d
libs_use_shared_libs(squid_t)
Chris PeBenito 0f707d
# to allow running programs from /usr/lib/squid (IE unlinkd)
Chris PeBenito 0f707d
libs_exec_lib_files(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
logging_send_syslog_msg(squid_t)
Chris PeBenito 0f707d
Chris PeBenito e6a2ea
miscfiles_read_certs(squid_t)
Chris PeBenito 0f707d
miscfiles_read_localization(squid_t)
Chris PeBenito 0f707d
Chris PeBenito d1b9d9
sysnet_read_config(squid_t)
Chris PeBenito d1b9d9
Chris PeBenito 103fe2
userdom_use_unpriv_users_fds(squid_t)
Chris PeBenito 15722e
userdom_dontaudit_use_unpriv_user_fds(squid_t)
Chris PeBenito 103fe2
userdom_dontaudit_search_sysadm_home_dirs(squid_t)
Chris PeBenito 0f707d
Chris PeBenito 0f707d
ifdef(`targeted_policy', `
Chris PeBenito 1815ba
	term_dontaudit_use_unallocated_ttys(squid_t)
Chris PeBenito 1815ba
	term_dontaudit_use_generic_ptys(squid_t)
Chris PeBenito 9e04f5
	files_dontaudit_read_root_files(squid_t)
Chris PeBenito 0f707d
')
Chris PeBenito 0f707d
Chris PeBenito 0907bd
tunable_policy(`squid_connect_any',`
Chris PeBenito 0907bd
	corenet_tcp_connect_all_ports(squid_t)
Chris PeBenito 0907bd
')
Chris PeBenito 0907bd
Chris PeBenito 132880
optional_policy(`logrotate',`
Chris PeBenito 0f707d
	allow squid_t self:capability kill;
Chris PeBenito 0f707d
	cron_use_fd(squid_t)
Chris PeBenito 15722e
	cron_use_system_job_fds(squid_t)
Chris PeBenito 1815ba
	cron_rw_pipes(squid_t)
Chris PeBenito 1815ba
	cron_write_system_job_pipes(squid_t)
Chris PeBenito 0f707d
')
Chris PeBenito 0f707d
Chris PeBenito 132880
optional_policy(`mount',`
Chris PeBenito 0f707d
	mount_send_nfs_client_request(squid_t)
Chris PeBenito 0f707d
')
Chris PeBenito 0f707d
Chris PeBenito 132880
optional_policy(`nis',`
Chris PeBenito 0f707d
	nis_use_ypbind(squid_t)
Chris PeBenito 0f707d
')
Chris PeBenito 0f707d
Chris PeBenito 132880
optional_policy(`nscd',`
Chris PeBenito 1815ba
	nscd_socket_use(squid_t)
Chris PeBenito 0f707d
')
Chris PeBenito 0f707d
Chris PeBenito 132880
optional_policy(`samba',`
Chris PeBenito d1b9d9
	samba_domtrans_winbind_helper(squid_t)
Chris PeBenito d1b9d9
')
Chris PeBenito d1b9d9
Chris PeBenito 132880
optional_policy(`selinuxutil',`
Chris PeBenito 0f707d
	seutil_sigchld_newrole(squid_t)
Chris PeBenito 0f707d
')
Chris PeBenito 0f707d
Chris PeBenito 132880
optional_policy(`udev',`
Chris PeBenito 0f707d
	udev_read_db(squid_t)
Chris PeBenito 0f707d
')
Chris PeBenito 0f707d
Chris PeBenito 0f707d
ifdef(`TODO',`
Chris PeBenito 0f707d
ifdef(`apache.te',`
Chris PeBenito 0f707d
can_tcp_connect(squid_t, httpd_t)
Chris PeBenito 0f707d
')
Chris PeBenito e6a2ea
Chris PeBenito 0907bd
ifdef(`winbind.te', `
Chris PeBenito 0907bd
domain_auto_trans(squid_t, winbind_helper_exec_t, winbind_helper_t)
Chris PeBenito 0907bd
allow winbind_helper_t squid_t:tcp_socket rw_socket_perms;
Chris PeBenito 0907bd
')
Chris PeBenito 0f707d
#squid requires the following when run in diskd mode, the recommended setting
Chris PeBenito 0f707d
allow squid_t tmpfs_t:file { read write };
Chris PeBenito 0f707d
') dnl end TODO