policy_module(boinc, 1.5.1) ######################################## # # Declarations # ## ##

## Determine whether boinc can execmem/execstack. ##

##
gen_tunable(boinc_execmem, true) type boinc_t; type boinc_exec_t; init_daemon_domain(boinc_t, boinc_exec_t) type boinc_initrc_exec_t; init_script_file(boinc_initrc_exec_t) type boinc_tmp_t; files_tmp_file(boinc_tmp_t) type boinc_tmpfs_t; files_tmpfs_file(boinc_tmpfs_t) type boinc_var_lib_t; files_type(boinc_var_lib_t) type boinc_project_var_lib_t; files_type(boinc_project_var_lib_t) type boinc_log_t; logging_log_file(boinc_log_t) type boinc_project_t; domain_type(boinc_project_t) domain_entry_file(boinc_project_t, boinc_project_var_lib_t) role system_r types boinc_project_t; type boinc_project_tmp_t; files_tmp_file(boinc_project_tmp_t) ######################################## # # Local policy # allow boinc_t self:process { setsched setpgid signull sigkill signal }; allow boinc_t self:unix_stream_socket { accept listen }; allow boinc_t self:tcp_socket { accept listen }; allow boinc_t self:shm create_shm_perms; allow boinc_t self:fifo_file rw_fifo_file_perms; allow boinc_t self:sem create_sem_perms; can_exec(boinc_t, boinc_exec_t) manage_dirs_pattern(boinc_t, boinc_tmp_t, boinc_tmp_t) manage_files_pattern(boinc_t, boinc_tmp_t, boinc_tmp_t) files_tmp_filetrans(boinc_t, boinc_tmp_t, { dir file }) manage_files_pattern(boinc_t, boinc_tmpfs_t, boinc_tmpfs_t) fs_tmpfs_filetrans(boinc_t, boinc_tmpfs_t, file) manage_dirs_pattern(boinc_t, boinc_var_lib_t, boinc_var_lib_t) manage_files_pattern(boinc_t, boinc_var_lib_t, boinc_var_lib_t) manage_lnk_files_pattern(boinc_t, boinc_var_lib_t, boinc_var_lib_t) # entry files to the boinc_project_t domain manage_dirs_pattern(boinc_t, boinc_project_var_lib_t, boinc_project_var_lib_t) manage_files_pattern(boinc_t, boinc_project_var_lib_t, boinc_project_var_lib_t) filetrans_pattern(boinc_t, boinc_var_lib_t, boinc_project_var_lib_t, dir, "slots") filetrans_pattern(boinc_t, boinc_var_lib_t, boinc_project_var_lib_t, dir, "projects") manage_files_pattern(boinc_t, boinc_log_t, boinc_log_t) create_files_pattern(boinc_t, boinc_log_t, boinc_log_t) setattr_files_pattern(boinc_t, boinc_log_t, boinc_log_t) logging_log_filetrans(boinc_t, boinc_log_t, file) can_exec(boinc_t, boinc_var_lib_t) libs_exec_lib_files(boinc_t) # for mmap of ld.so.cache libs_legacy_use_ld_so(boinc_t) domtrans_pattern(boinc_t, boinc_project_var_lib_t, boinc_project_t) kernel_read_system_state(boinc_t) kernel_search_vm_sysctl(boinc_t) kernel_read_crypto_sysctls(boinc_t) kernel_read_kernel_sysctls(boinc_t) corenet_all_recvfrom_unlabeled(boinc_t) corenet_all_recvfrom_netlabel(boinc_t) corenet_tcp_sendrecv_generic_if(boinc_t) corenet_tcp_sendrecv_generic_node(boinc_t) corenet_tcp_bind_generic_node(boinc_t) corenet_sendrecv_boinc_client_packets(boinc_t) corenet_sendrecv_boinc_server_packets(boinc_t) corenet_tcp_bind_boinc_port(boinc_t) corenet_tcp_connect_boinc_port(boinc_t) corenet_tcp_sendrecv_boinc_port(boinc_t) corenet_sendrecv_boinc_client_server_packets(boinc_t) corenet_tcp_bind_boinc_client_port(boinc_t) corenet_tcp_sendrecv_boinc_client_port(boinc_t) corenet_sendrecv_http_client_packets(boinc_t) corenet_tcp_connect_http_port(boinc_t) corenet_tcp_sendrecv_http_port(boinc_t) corenet_sendrecv_http_cache_client_packets(boinc_t) corenet_tcp_connect_http_cache_port(boinc_t) corenet_tcp_sendrecv_http_cache_port(boinc_t) corenet_sendrecv_squid_client_packets(boinc_t) corenet_tcp_connect_squid_port(boinc_t) corenet_tcp_sendrecv_squid_port(boinc_t) corecmd_exec_bin(boinc_t) corecmd_exec_shell(boinc_t) dev_read_rand(boinc_t) dev_read_urand(boinc_t) dev_read_sysfs(boinc_t) dev_rw_xserver_misc(boinc_t) domain_read_all_domains_state(boinc_t) files_dontaudit_getattr_boot_dirs(boinc_t) files_getattr_all_dirs(boinc_t) files_getattr_all_files(boinc_t) files_read_etc_files(boinc_t) files_read_etc_runtime_files(boinc_t) files_read_usr_files(boinc_t) fs_getattr_all_fs(boinc_t) term_getattr_all_ptys(boinc_t) term_getattr_unallocated_ttys(boinc_t) init_read_utmp(boinc_t) logging_send_syslog_msg(boinc_t) miscfiles_read_fonts(boinc_t) miscfiles_read_generic_certs(boinc_t) miscfiles_read_localization(boinc_t) tunable_policy(`boinc_execmem',` allow boinc_t self:process { execstack execmem }; ') optional_policy(` mta_send_mail(boinc_t) ') optional_policy(` sysnet_dns_name_resolve(boinc_t) ') optional_policy(` corenet_tcp_connect_xserver_port(boinc_t) xserver_list_xdm_tmp(boinc_t) xserver_non_drawing_client(boinc_t) ') ######################################## # # Project local policy # allow boinc_project_t self:capability { setgid setuid }; allow boinc_project_t self:process { execmem execstack noatsecure ptrace setcap getcap setpgid setsched signal_perms }; manage_dirs_pattern(boinc_project_t, boinc_project_tmp_t, boinc_project_tmp_t) manage_files_pattern(boinc_project_t, boinc_project_tmp_t, boinc_project_tmp_t) manage_sock_files_pattern(boinc_project_t, boinc_project_tmp_t, boinc_project_tmp_t) files_tmp_filetrans(boinc_project_t, boinc_project_tmp_t, { dir file sock_file}) manage_dirs_pattern(boinc_project_t, boinc_project_var_lib_t, boinc_project_var_lib_t) manage_files_pattern(boinc_project_t, boinc_project_var_lib_t, boinc_project_var_lib_t) allow boinc_project_t boinc_project_var_lib_t:file execmod; can_exec(boinc_project_t, boinc_project_var_lib_t) allow boinc_project_t boinc_t:shm rw_shm_perms; allow boinc_project_t boinc_tmpfs_t:file { read write }; kernel_read_kernel_sysctls(boinc_project_t) kernel_read_network_state(boinc_project_t) kernel_search_vm_sysctl(boinc_project_t) corenet_all_recvfrom_unlabeled(boinc_project_t) corenet_all_recvfrom_netlabel(boinc_project_t) corenet_tcp_sendrecv_generic_if(boinc_project_t) corenet_tcp_sendrecv_generic_node(boinc_project_t) corenet_tcp_bind_generic_node(boinc_project_t) corenet_sendrecv_boinc_client_packets(boinc_project_t) corenet_tcp_connect_boinc_port(boinc_project_t) corenet_tcp_sendrecv_boinc_port(boinc_project_t) dev_getattr_input_dev(boinc_t) dev_getattr_mouse_dev(boinc_t) files_dontaudit_search_home(boinc_project_t) term_getattr_ptmx(boinc_t) term_getattr_generic_ptys(boinc_t) userdom_getattr_user_ttys(boinc_t) optional_policy(` # for lsb_release -a apt_read_cache(boinc_t) apt_read_db(boinc_t) dpkg_exec(boinc_t) dpkg_read_db(boinc_t) apt_read_cache(boinc_project_t) apt_read_db(boinc_project_t) dpkg_exec(boinc_project_t) dpkg_read_db(boinc_project_t) ') optional_policy(` java_exec(boinc_project_t) ')