Chris PeBenito 0fbfa5
#DESC Squid - Web cache
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Author:  Russell Coker <russell@coker.com.au>
Chris PeBenito 0fbfa5
# X-Debian-Packages: squid
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#################################
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Rules for the squid_t domain.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# squid_t is the domain the squid process runs in
Chris PeBenito 0fbfa5
ifdef(`apache.te',`
Chris PeBenito 0fbfa5
can_tcp_connect(squid_t, httpd_t)
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
daemon_domain(squid, `, web_client_domain, nscd_client_domain')
Chris PeBenito 0fbfa5
type squid_conf_t, file_type, sysadmfile;
Chris PeBenito 0fbfa5
general_domain_access(squid_t)
Chris PeBenito 0fbfa5
allow { squid_t initrc_t } squid_conf_t:file r_file_perms;
Chris PeBenito 0fbfa5
allow squid_t squid_conf_t:dir r_dir_perms;
Chris PeBenito 0fbfa5
allow squid_t squid_conf_t:lnk_file read;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
logdir_domain(squid)
Chris PeBenito 0fbfa5
rw_dir_create_file(initrc_t, squid_log_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow squid_t usr_t:file { getattr read };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# type for /var/cache/squid
Chris PeBenito 0fbfa5
type squid_cache_t, file_type, sysadmfile;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow squid_t self:capability { setgid setuid net_bind_service };
Chris PeBenito 0fbfa5
allow squid_t { etc_t etc_runtime_t }:file r_file_perms;
Chris PeBenito 0fbfa5
allow squid_t etc_t:lnk_file read;
Chris PeBenito 0fbfa5
allow squid_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 0fbfa5
allow squid_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 0fbfa5
allow squid_t self:fifo_file rw_file_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
read_sysctl(squid_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow squid_t devtty_t:chr_file rw_file_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow squid_t { self proc_t }:file { read getattr };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# for when we use /var/spool/cache
Chris PeBenito 0fbfa5
allow squid_t var_spool_t:dir search;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Grant permissions to create, access, and delete cache files.
Chris PeBenito 0fbfa5
# No type transitions required, as the files inherit the parent directory type.
Chris PeBenito 0fbfa5
create_dir_file(squid_t, squid_cache_t)
Chris PeBenito 0fbfa5
ifdef(`logrotate.te',
Chris PeBenito 0fbfa5
`domain_auto_trans(logrotate_t, squid_exec_t, squid_t)')
Chris PeBenito 0fbfa5
ifdef(`crond.te', `domain_auto_trans(system_crond_t, squid_exec_t, squid_t)')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Use the network
Chris PeBenito 0fbfa5
can_network(squid_t)
Chris PeBenito 0fbfa5
can_ypbind(squid_t)
Chris PeBenito 0fbfa5
can_tcp_connect(web_client_domain, squid_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# tcp port 8080 and udp port 3130 is http_cache_port_t (see net_contexts)
Chris PeBenito 0fbfa5
allow squid_t http_cache_port_t:tcp_socket name_bind;
Chris PeBenito 0fbfa5
allow squid_t http_cache_port_t:udp_socket name_bind;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# to allow running programs from /usr/lib/squid (IE unlinkd)
Chris PeBenito 0fbfa5
# also allow exec()ing itself
Chris PeBenito 0fbfa5
can_exec(squid_t, { lib_t squid_exec_t bin_t sbin_t shell_exec_t } )
Chris PeBenito 0fbfa5
allow squid_t { bin_t sbin_t }:dir search;
Chris PeBenito 0fbfa5
allow squid_t { bin_t sbin_t }:lnk_file read;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
dontaudit squid_t { boot_t tmp_t home_root_t security_t devpts_t }:dir getattr;
Chris PeBenito 0fbfa5
ifdef(`targeted_policy', `
Chris PeBenito 0fbfa5
dontaudit squid_t tty_device_t:chr_file { read write };
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
allow squid_t urandom_device_t:chr_file { getattr read };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#squid requires the following when run in diskd mode, the recommended setting
Chris PeBenito 0fbfa5
allow squid_t tmpfs_t:file { read write };