policy_module(pyzor, 2.3.0) ######################################## # # Declarations # ifdef(`distro_redhat',` gen_require(` type spamc_t, spamc_exec_t, spamd_t; type spamd_initrc_exec_t, spamd_exec_t, spamc_tmp_t; type spamd_log_t, spamd_var_lib_t, spamd_etc_t; type spamc_tmp_t, spamc_home_t; ') typealias spamc_t alias pyzor_t; typealias spamc_exec_t alias pyzor_exec_t; typealias spamd_t alias pyzord_t; typealias spamd_initrc_exec_t alias pyzord_initrc_exec_t; typealias spamd_exec_t alias pyzord_exec_t; typealias spamc_tmp_t alias pyzor_tmp_t; typealias spamd_log_t alias pyzor_log_t; typealias spamd_log_t alias pyzord_log_t; typealias spamd_var_lib_t alias pyzor_var_lib_t; typealias spamd_etc_t alias pyzor_etc_t; typealias spamc_home_t alias pyzor_home_t; typealias spamc_home_t alias user_pyzor_home_t; ',` type pyzor_t; type pyzor_exec_t; typealias pyzor_t alias { user_pyzor_t staff_pyzor_t sysadm_pyzor_t }; typealias pyzor_t alias { auditadm_pyzor_t secadm_pyzor_t }; application_domain(pyzor_t, pyzor_exec_t) ubac_constrained(pyzor_t) role system_r types pyzor_t; type pyzor_etc_t; files_config_file(pyzor_etc_t) type pyzor_home_t; typealias pyzor_home_t alias { user_pyzor_home_t staff_pyzor_home_t sysadm_pyzor_home_t }; typealias pyzor_home_t alias { auditadm_pyzor_home_t secadm_pyzor_home_t }; userdom_user_home_content(pyzor_home_t) type pyzor_tmp_t; typealias pyzor_tmp_t alias { user_pyzor_tmp_t staff_pyzor_tmp_t sysadm_pyzor_tmp_t }; typealias pyzor_tmp_t alias { auditadm_pyzor_tmp_t secadm_pyzor_tmp_t }; files_tmp_file(pyzor_tmp_t) ubac_constrained(pyzor_tmp_t) type pyzor_var_lib_t; typealias pyzor_var_lib_t alias { user_pyzor_var_lib_t staff_pyzor_var_lib_t sysadm_pyzor_var_lib_t }; typealias pyzor_var_lib_t alias { auditadm_pyzor_var_lib_t secadm_pyzor_var_lib_t }; files_type(pyzor_var_lib_t) ubac_constrained(pyzor_var_lib_t) type pyzord_t; type pyzord_exec_t; init_daemon_domain(pyzord_t, pyzord_exec_t) type pyzord_log_t; logging_log_file(pyzord_log_t) ') ######################################## # # Pyzor client local policy # allow pyzor_t self:udp_socket create_socket_perms; manage_dirs_pattern(pyzor_t, pyzor_home_t, pyzor_home_t) manage_files_pattern(pyzor_t, pyzor_home_t, pyzor_home_t) manage_lnk_files_pattern(pyzor_t, pyzor_home_t, pyzor_home_t) userdom_user_home_dir_filetrans(pyzor_t, pyzor_home_t, { dir file lnk_file }) allow pyzor_t pyzor_var_lib_t:dir list_dir_perms; read_files_pattern(pyzor_t, pyzor_var_lib_t, pyzor_var_lib_t) files_search_var_lib(pyzor_t) manage_files_pattern(pyzor_t, pyzor_tmp_t, pyzor_tmp_t) manage_dirs_pattern(pyzor_t, pyzor_tmp_t, pyzor_tmp_t) files_tmp_filetrans(pyzor_t, pyzor_tmp_t, { file dir }) kernel_read_kernel_sysctls(pyzor_t) kernel_read_system_state(pyzor_t) corecmd_list_bin(pyzor_t) corecmd_getattr_bin_files(pyzor_t) corenet_tcp_sendrecv_generic_if(pyzor_t) corenet_udp_sendrecv_generic_if(pyzor_t) corenet_tcp_sendrecv_generic_node(pyzor_t) corenet_udp_sendrecv_generic_node(pyzor_t) corenet_tcp_sendrecv_all_ports(pyzor_t) corenet_udp_sendrecv_all_ports(pyzor_t) corenet_tcp_connect_http_port(pyzor_t) dev_read_urand(pyzor_t) fs_getattr_xattr_fs(pyzor_t) auth_use_nsswitch(pyzor_t) mta_read_queue(pyzor_t) userdom_dontaudit_search_user_home_dirs(pyzor_t) optional_policy(` antivirus_manage_db(pyzor_t) ') optional_policy(` spamassassin_signal_spamd(pyzor_t) spamassassin_read_spamd_tmp_files(pyzor_t) ') ######################################## # # Pyzor server local policy # allow pyzord_t self:udp_socket create_socket_perms; manage_files_pattern(pyzord_t, pyzor_var_lib_t, pyzor_var_lib_t) allow pyzord_t pyzor_var_lib_t:dir setattr; files_var_lib_filetrans(pyzord_t, pyzor_var_lib_t, { file dir }) read_files_pattern(pyzord_t, pyzor_etc_t, pyzor_etc_t) allow pyzord_t pyzor_etc_t:dir list_dir_perms; can_exec(pyzord_t, pyzor_exec_t) manage_files_pattern(pyzord_t, pyzord_log_t, pyzord_log_t) allow pyzord_t pyzord_log_t:dir setattr_dir_perms; logging_log_filetrans(pyzord_t, pyzord_log_t, { file dir }) kernel_read_kernel_sysctls(pyzord_t) kernel_read_system_state(pyzord_t) dev_read_urand(pyzord_t) corecmd_exec_bin(pyzord_t) corenet_all_recvfrom_netlabel(pyzord_t) corenet_udp_sendrecv_generic_if(pyzord_t) corenet_udp_sendrecv_generic_node(pyzord_t) corenet_udp_sendrecv_all_ports(pyzord_t) corenet_udp_bind_generic_node(pyzord_t) corenet_udp_bind_pyzor_port(pyzord_t) corenet_sendrecv_pyzor_server_packets(pyzord_t) auth_use_nsswitch(pyzord_t) locallogin_dontaudit_use_fds(pyzord_t) # Do not audit attempts to access /root. userdom_dontaudit_search_user_home_dirs(pyzord_t) mta_manage_spool(pyzord_t) optional_policy(` logging_send_syslog_msg(pyzord_t) ')