policy_module(icecream,0.0.35) ######################################## # # Declarations # type iceccd_t; type iceccd_exec_t; init_daemon_domain(iceccd_t, iceccd_exec_t) type iceccd_var_run_t; files_pid_file(iceccd_var_run_t) type iceccd_log_t; logging_log_file(iceccd_log_t) type iceccd_cache_t; files_type(iceccd_cache_t) type iceccd_tmp_t; files_tmp_file(iceccd_tmp_t) type iceccd_helper_t; type iceccd_helper_exec_t; domain_type(iceccd_helper_t) domain_entry_file(iceccd_helper_t, iceccd_helper_exec_t) role system_r types iceccd_helper_t; # the cache contains foreign compilers and libraries # the whole point of icecream is to run them... type iceccd_untrusted_t; domain_type(iceccd_untrusted_t); domain_entry_file(iceccd_untrusted_t, iceccd_cache_t) role system_r types iceccd_untrusted_t; # XXX: something like this: # network_port(iceccd, tcp,10245,s0) #type iceccd_client_packet_t; #type iceccd_server_packet_t; # XXX: portcon only works in base policy module #portcon tcp 10245 gen_context(system_u:object_r:iceccd_port_t, s0) type iceccd_port_t; type icecc_scheduler_port_t; corenet_port(iceccd_port_t); corenet_port(icecc_scheduler_port_t); ######################################## # # Icecream local policy # allow iceccd_t self:process { signal_perms setsched setrlimit }; allow iceccd_t self:netlink_route_socket r_netlink_socket_perms; allow iceccd_t self:tcp_socket create_stream_socket_perms; allow iceccd_t self:udp_socket create_socket_perms; allow iceccd_t iceccd_port_t:tcp_socket name_bind; allow iceccd_t icecc_scheduler_port_t:tcp_socket { send_msg recv_msg name_connect }; allow iceccd_t icecc_scheduler_port_t:udp_socket { send_msg recv_msg }; allow iceccd_t self:fifo_file { read write ioctl getattr }; # why exactly?: allow iceccd_t self:capability { chown dac_override fsetid kill }; allow iceccd_t self:capability { setgid setuid }; allow iceccd_t self:capability { sys_chroot }; allow iceccd_t iceccd_untrusted_t:process { siginh rlimitinh noatsecure }; allow iceccd_helper_t iceccd_t:process { sigchld }; allow iceccd_helper_t iceccd_log_t:file { append }; allow iceccd_helper_t self:fifo_file { read write ioctl getattr }; # needs investigating: allow iceccd_helper_t iceccd_tmp_t:file { execute }; allow iceccd_untrusted_t iceccd_t:process { sigchld }; allow iceccd_untrusted_t iceccd_t:fifo_file { write }; allow iceccd_untrusted_t iceccd_t:unix_stream_socket { read write getattr }; allow iceccd_untrusted_t self:fifo_file { read write getattr }; allow iceccd_untrusted_t iceccd_cache_t:dir { search getattr write add_name remove_name }; allow iceccd_untrusted_t iceccd_cache_t:file { execute_no_trans write unlink create }; corenet_all_recvfrom_unlabeled(iceccd_t) corenet_all_recvfrom_netlabel(iceccd_t) corenet_tcp_sendrecv_all_if(iceccd_t) corenet_udp_sendrecv_all_if(iceccd_t) corenet_tcp_sendrecv_all_nodes(iceccd_t) corenet_udp_sendrecv_all_nodes(iceccd_t) # corenet_tcp_sendrecv_all_ports(iceccd_t) # corenet_udp_sendrecv_all_ports(iceccd_t) corenet_tcp_bind_all_nodes(iceccd_t) manage_files_pattern(iceccd_t,iceccd_log_t,iceccd_log_t) logging_log_filetrans(iceccd_t, iceccd_log_t, file) manage_files_pattern(iceccd_t,iceccd_var_run_t,iceccd_var_run_t) files_pid_filetrans(iceccd_t, iceccd_var_run_t, file) # iceccd attempt to rmdir & mkdir /var/cache/icecream # XXX: I should fix it instead. files_dontaudit_write_var_dirs(iceccd_t) manage_dirs_pattern(iceccd_t, iceccd_cache_t, iceccd_cache_t) manage_files_pattern(iceccd_t, iceccd_cache_t, iceccd_cache_t) manage_dirs_pattern(iceccd_helper_t, iceccd_cache_t, iceccd_cache_t) manage_files_pattern(iceccd_helper_t, iceccd_cache_t, iceccd_cache_t) libs_use_ld_so(iceccd_t) libs_use_shared_libs(iceccd_t) # for ldd libs_exec_ld_so(iceccd_t) files_read_etc_files(iceccd_t) miscfiles_read_localization(iceccd_t) kernel_read_system_state(iceccd_t) sysnet_read_config(iceccd_t) #files_read_usr_files(iceccd_t) files_read_etc_files(iceccd_helper_t) libs_use_ld_so(iceccd_helper_t) libs_use_shared_libs(iceccd_helper_t) miscfiles_read_localization(iceccd_helper_t) corecmd_exec_bin(iceccd_helper_t) corecmd_exec_shell(iceccd_helper_t) dev_read_urand(iceccd_helper_t) kernel_read_system_state(iceccd_helper_t) files_read_usr_files(iceccd_helper_t) libs_exec_ld_so(iceccd_helper_t) libs_exec_lib_files(iceccd_helper_t) nscd_socket_use(iceccd_helper_t) # XXX: iceccd wants this every second. why? fs_getattr_all_fs(iceccd_t) corecmd_exec_bin(iceccd_t) corecmd_read_bin_symlinks(iceccd_t) # XXX: could iceccd be modified to not need this? corecmd_exec_shell(iceccd_t) # for mktemp #dev_read_urand(iceccd_t) files_getattr_tmp_dirs(iceccd_t) files_search_tmp(iceccd_t) manage_dirs_pattern(iceccd_t, iceccd_tmp_t, iceccd_tmp_t) manage_files_pattern(iceccd_t, iceccd_tmp_t, iceccd_tmp_t) files_tmp_filetrans(iceccd_t, iceccd_tmp_t, file) manage_dirs_pattern(iceccd_helper_t, iceccd_tmp_t, iceccd_tmp_t) manage_files_pattern(iceccd_helper_t, iceccd_tmp_t, iceccd_tmp_t) files_tmp_filetrans(iceccd_helper_t, iceccd_tmp_t, file) files_tmp_filetrans(iceccd_helper_t, iceccd_tmp_t, dir) domain_auto_transition_pattern(iceccd_t, iceccd_helper_exec_t, iceccd_helper_t) domain_auto_transition_pattern(iceccd_t, iceccd_cache_t, iceccd_untrusted_t) userdom_dontaudit_getattr_sysadm_home_dirs(iceccd_t) #userdom_dontaudit_getattr_sysadm_home_dirs(iceccd_helper_t) userdom_dontaudit_search_sysadm_home_dirs(iceccd_helper_t) #userdom_getattr_sysadm_home_dirs(iceccd_t) #allow myapp_t myapp_log_t:file ra_file_perms; #allow myapp_t myapp_tmp_t:file manage_file_perms;