policy_module(bacula, 1.2.0) ######################################## # # Declarations # attribute_role bacula_admin_roles; type bacula_t; type bacula_exec_t; init_daemon_domain(bacula_t, bacula_exec_t) type bacula_initrc_exec_t; init_script_file(bacula_initrc_exec_t) type bacula_etc_t; files_type(bacula_etc_t) type bacula_log_t; logging_log_file(bacula_log_t) type bacula_spool_t; files_type(bacula_spool_t) type bacula_store_t; files_type(bacula_store_t) files_mountpoint(bacula_store_t) type bacula_tmp_t; files_tmp_file(bacula_tmp_t) type bacula_var_lib_t; files_type(bacula_var_lib_t) type bacula_var_run_t; files_pid_file(bacula_var_run_t) type bacula_admin_t; type bacula_admin_exec_t; application_domain(bacula_admin_t, bacula_admin_exec_t) role bacula_admin_roles types bacula_admin_t; type bacula_unconfined_script_exec_t; application_executable_file(bacula_unconfined_script_exec_t) ######################################## # # Local policy # allow bacula_t self:capability { dac_read_search dac_override chown fowner fsetid setgid setuid}; allow bacula_t self:process signal; allow bacula_t self:fifo_file rw_fifo_file_perms; allow bacula_t self:tcp_socket { accept listen }; read_files_pattern(bacula_t, bacula_etc_t, bacula_etc_t) manage_files_pattern(bacula_t, bacula_tmp_t, bacula_tmp_t) manage_dirs_pattern(bacula_t, bacula_tmp_t, bacula_tmp_t) files_tmp_filetrans(bacula_t, bacula_tmp_t, { dir file }) manage_dirs_pattern(bacula_t,bacula_log_t, bacula_log_t) append_files_pattern(bacula_t, bacula_log_t, bacula_log_t) create_files_pattern(bacula_t, bacula_log_t, bacula_log_t) setattr_files_pattern(bacula_t, bacula_log_t, bacula_log_t) logging_log_filetrans(bacula_t, bacula_log_t, { file dir }) manage_dirs_pattern(bacula_t, bacula_spool_t, bacula_spool_t) manage_files_pattern(bacula_t, bacula_spool_t, bacula_spool_t) manage_files_pattern(bacula_t, bacula_store_t, bacula_store_t) manage_lnk_files_pattern(bacula_t, bacula_store_t, bacula_store_t) manage_dirs_pattern(bacula_t, bacula_store_t, bacula_store_t) manage_dirs_pattern(bacula_t, bacula_var_lib_t, bacula_var_lib_t) manage_files_pattern(bacula_t, bacula_var_lib_t, bacula_var_lib_t) files_var_lib_filetrans(bacula_t, bacula_var_lib_t, dir) allow bacula_t bacula_var_run_t:file manage_file_perms; files_pid_filetrans(bacula_t, bacula_var_run_t, file) kernel_read_kernel_sysctls(bacula_t) kernel_read_system_state(bacula_t) corecmd_exec_bin(bacula_t) corecmd_exec_shell(bacula_t) corenet_all_recvfrom_unlabeled(bacula_t) corenet_all_recvfrom_netlabel(bacula_t) corenet_tcp_sendrecv_generic_if(bacula_t) corenet_udp_sendrecv_generic_if(bacula_t) corenet_tcp_sendrecv_generic_node(bacula_t) corenet_udp_sendrecv_generic_node(bacula_t) corenet_tcp_sendrecv_all_ports(bacula_t) corenet_udp_sendrecv_all_ports(bacula_t) corenet_tcp_bind_generic_node(bacula_t) corenet_udp_bind_generic_node(bacula_t) corenet_sendrecv_generic_server_packets(bacula_t) corenet_udp_bind_generic_port(bacula_t) #TODO: check port labels for hplip a bacula corenet_tcp_bind_bacula_port(bacula_t) corenet_sendrecv_hplip_server_packets(bacula_t) corenet_tcp_bind_hplip_port(bacula_t) corenet_udp_bind_hplip_port(bacula_t) corenet_sendrecv_all_client_packets(bacula_t) corenet_tcp_connect_all_ports(bacula_t) dev_getattr_all_blk_files(bacula_t) dev_getattr_all_chr_files(bacula_t) files_getattr_all_pipes(bacula_t) files_getattr_all_sockets(bacula_t) files_dontaudit_getattr_all_sockets(bacula_t) files_dontaudit_getattr_all_pipes(bacula_t) files_read_all_files(bacula_t) files_read_all_symlinks(bacula_t) fs_getattr_cgroup(bacula_t) fs_getattr_xattr_fs(bacula_t) fs_list_all(bacula_t) storage_raw_read_fixed_disk(bacula_t) storage_read_tape(bacula_t) storage_write_tape(bacula_t) auth_use_nsswitch(bacula_t) auth_read_shadow(bacula_t) logging_send_syslog_msg(bacula_t) sysnet_dns_name_resolve(bacula_t) userdom_home_manager(bacula_t) optional_policy(` mysql_stream_connect(bacula_t) mysql_tcp_connect(bacula_t) ') optional_policy(` nis_use_ypbind(bacula_t) ') optional_policy(` sysnet_use_ldap(bacula_t) ldap_stream_connect(bacula_t) ') optional_policy(` postgresql_tcp_connect(bacula_t) postgresql_stream_connect(bacula_t) ') ######################################## # # Client local policy # allow bacula_admin_t self:process signal; allow bacula_admin_t self:tcp_socket { accept listen }; allow bacula_admin_t self:dgram_socket_class_set create_socket_perms; read_files_pattern(bacula_admin_t, bacula_etc_t, bacula_etc_t) corenet_all_recvfrom_unlabeled(bacula_admin_t) corenet_all_recvfrom_netlabel(bacula_admin_t) corenet_tcp_sendrecv_generic_if(bacula_admin_t) corenet_tcp_sendrecv_generic_node(bacula_admin_t) corenet_tcp_sendrecv_all_ports(bacula_admin_t) corenet_tcp_bind_generic_node(bacula_admin_t) corenet_sendrecv_hplip_client_packets(bacula_admin_t) corenet_tcp_connect_hplip_port(bacula_admin_t) domain_use_interactive_fds(bacula_admin_t) sysnet_dns_name_resolve(bacula_admin_t) userdom_dontaudit_search_user_home_dirs(bacula_admin_t) userdom_use_user_ptys(bacula_admin_t) ######################################## # # Unconfined script local policy # optional_policy(` type bacula_unconfined_script_t; domain_type(bacula_unconfined_script_t) domain_entry_file(bacula_unconfined_script_t, bacula_unconfined_script_exec_t) role system_r types bacula_unconfined_script_t; allow bacula_t bacula_unconfined_script_t:process signal_perms; domtrans_pattern(bacula_t, bacula_unconfined_script_exec_t, bacula_unconfined_script_t) allow bacula_unconfined_script_t bacula_unconfined_script_exec_t:dir search_dir_perms; allow bacula_unconfined_script_t bacula_unconfined_script_exec_t:dir read_file_perms; allow bacula_unconfined_script_t bacula_unconfined_script_exec_t:file ioctl; optional_policy(` unconfined_domain(bacula_unconfined_script_t) ') ')