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

192 lines
5.0 KiB
Plaintext
Raw Normal View History

2005-09-02 19:11:07 +00:00
2005-12-09 16:38:39 +00:00
policy_module(squid,1.1.0)
2005-09-02 19:11:07 +00:00
########################################
#
# Declarations
#
type squid_t;
type squid_exec_t;
init_daemon_domain(squid_t,squid_exec_t)
# 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_log_t;
logging_log_file(squid_log_t)
type squid_var_run_t;
files_pid_file(squid_var_run_t)
########################################
#
# Local policy
#
allow squid_t self:capability { setgid setuid dac_override };
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 setrlimit execmem execstack execheap };
allow squid_t self:fifo_file rw_file_perms;
2005-10-26 18:07:20 +00:00
allow squid_t self:sock_file r_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.
allow squid_t squid_cache_t:dir create_dir_perms;
allow squid_t squid_cache_t:file create_file_perms;
allow squid_t squid_cache_t:lnk_file create_lnk_perms;
allow squid_t squid_conf_t:file r_file_perms;
allow squid_t squid_conf_t:dir r_dir_perms;
allow squid_t squid_conf_t:lnk_file read;
can_exec(squid_t,squid_exec_t)
allow squid_t squid_log_t:file create_file_perms;
allow squid_t squid_log_t:dir rw_dir_perms;
logging_filetrans_log(squid_t,squid_log_t,{ file dir })
2005-09-02 19:11:07 +00:00
allow squid_t squid_var_run_t:file create_file_perms;
2005-10-26 18:07:20 +00:00
allow squid_t squid_var_run_t:dir rw_dir_perms;
files_filetrans_pid(squid_t,squid_var_run_t)
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)
kernel_tcp_recvfrom(squid_t)
bootloader_dontaudit_getattr_boot_dir(squid_t)
corenet_tcp_sendrecv_all_if(squid_t)
corenet_raw_sendrecv_all_if(squid_t)
corenet_udp_sendrecv_all_if(squid_t)
corenet_tcp_sendrecv_all_nodes(squid_t)
corenet_udp_sendrecv_all_nodes(squid_t)
corenet_raw_sendrecv_all_nodes(squid_t)
corenet_tcp_sendrecv_all_ports(squid_t)
corenet_udp_sendrecv_all_ports(squid_t)
2005-12-06 19:59:50 +00:00
corenet_non_ipsec_sendrecv(squid_t)
2005-09-02 19:11:07 +00:00
corenet_tcp_bind_all_nodes(squid_t)
corenet_udp_bind_all_nodes(squid_t)
corenet_tcp_bind_http_cache_port(squid_t)
corenet_udp_bind_http_cache_port(squid_t)
corenet_tcp_bind_ftp_port(squid_t)
corenet_udp_bind_ftp_port(squid_t)
corenet_tcp_bind_gopher_port(squid_t)
corenet_udp_bind_gopher_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)
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)
selinux_dontaudit_getattr_dir(squid_t)
term_dontaudit_use_console(squid_t)
term_dontaudit_getattr_pty_dir(squid_t)
# to allow running programs from /usr/lib/squid (IE unlinkd)
corecmd_exec_bin(squid_t)
corecmd_exec_sbin(squid_t)
corecmd_exec_shell(squid_t)
domain_use_wide_inherit_fd(squid_t)
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)
init_use_fd(squid_t)
init_use_script_pty(squid_t)
libs_use_ld_so(squid_t)
libs_use_shared_libs(squid_t)
# to allow running programs from /usr/lib/squid (IE unlinkd)
libs_exec_lib_files(squid_t)
logging_send_syslog_msg(squid_t)
2005-10-21 21:35:25 +00:00
miscfiles_read_certs(squid_t)
2005-09-02 19:11:07 +00:00
miscfiles_read_localization(squid_t)
2005-10-26 18:07:20 +00:00
sysnet_read_config(squid_t)
2005-09-02 19:11:07 +00:00
userdom_use_unpriv_users_fd(squid_t)
userdom_dontaudit_use_unpriv_user_fd(squid_t)
userdom_dontaudit_search_sysadm_home_dir(squid_t)
ifdef(`targeted_policy', `
term_dontaudit_use_unallocated_tty(squid_t)
term_dontaudit_use_generic_pty(squid_t)
files_dontaudit_read_root_files(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)
')
optional_policy(`logrotate',`
2005-09-02 19:11:07 +00:00
allow squid_t self:capability kill;
cron_use_fd(squid_t)
cron_use_system_job_fd(squid_t)
cron_rw_pipe(squid_t)
cron_write_system_job_pipe(squid_t)
')
optional_policy(`mount',`
2005-09-02 19:11:07 +00:00
mount_send_nfs_client_request(squid_t)
')
optional_policy(`nis',`
2005-09-02 19:11:07 +00:00
nis_use_ypbind(squid_t)
')
optional_policy(`nscd',`
2005-09-02 19:11:07 +00:00
nscd_use_socket(squid_t)
')
optional_policy(`samba',`
2005-10-26 18:07:20 +00:00
samba_domtrans_winbind_helper(squid_t)
')
optional_policy(`selinuxutil',`
2005-09-02 19:11:07 +00:00
seutil_sigchld_newrole(squid_t)
')
optional_policy(`udev',`
2005-09-02 19:11:07 +00:00
udev_read_db(squid_t)
')
ifdef(`TODO',`
ifdef(`apache.te',`
can_tcp_connect(squid_t, httpd_t)
')
2005-10-21 21:35:25 +00:00
2005-09-13 13:06:07 +00:00
ifdef(`winbind.te', `
domain_auto_trans(squid_t, winbind_helper_exec_t, winbind_helper_t)
allow winbind_helper_t squid_t:tcp_socket rw_socket_perms;
')
2005-09-02 19:11:07 +00:00
#squid requires the following when run in diskd mode, the recommended setting
allow squid_t tmpfs_t:file { read write };
') dnl end TODO