policy_module(mongodb, 1.5.0)

########################################
#
# Declarations
#

type mongod_t;
type mongod_exec_t;
init_daemon_domain(mongod_t, mongod_exec_t)

type mongod_initrc_exec_t;
init_script_file(mongod_initrc_exec_t)

type mongod_log_t;
logging_log_file(mongod_log_t)

type mongod_runtime_t alias mongod_var_run_t;
files_runtime_file(mongod_runtime_t)

type mongod_var_lib_t;
files_type(mongod_var_lib_t)

########################################
#
# Local policy
#

allow mongod_t self:process signal;
allow mongod_t self:fifo_file rw_fifo_file_perms;

manage_dirs_pattern(mongod_t, mongod_log_t, mongod_log_t)
append_files_pattern(mongod_t, mongod_log_t, mongod_log_t)
create_files_pattern(mongod_t, mongod_log_t, mongod_log_t)
setattr_files_pattern(mongod_t, mongod_log_t, mongod_log_t)
logging_log_filetrans(mongod_t, mongod_log_t, dir)

manage_dirs_pattern(mongod_t, mongod_var_lib_t, mongod_var_lib_t)
manage_files_pattern(mongod_t, mongod_var_lib_t, mongod_var_lib_t)
files_var_lib_filetrans(mongod_t, mongod_var_lib_t, dir)

manage_dirs_pattern(mongod_t, mongod_runtime_t, mongod_runtime_t)
manage_files_pattern(mongod_t, mongod_runtime_t, mongod_runtime_t)
files_runtime_filetrans(mongod_t, mongod_runtime_t, dir)

kernel_read_system_state(mongod_t)

corenet_all_recvfrom_netlabel(mongod_t)
corenet_tcp_sendrecv_generic_if(mongod_t)
corenet_tcp_sendrecv_generic_node(mongod_t)
corenet_tcp_bind_generic_node(mongod_t)

dev_read_sysfs(mongod_t)
dev_read_urand(mongod_t)

files_read_etc_files(mongod_t)

fs_getattr_all_fs(mongod_t)

miscfiles_read_localization(mongod_t)
