policy_module(drbd, 1.4.0)

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

type drbd_t;
type drbd_exec_t;
init_daemon_domain(drbd_t, drbd_exec_t)

type drbd_initrc_exec_t;
init_script_file(drbd_initrc_exec_t)

type drbd_var_lib_t;
files_type(drbd_var_lib_t)

type drbd_lock_t;
files_lock_file(drbd_lock_t)

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

allow drbd_t self:capability { kill net_admin };
dontaudit drbd_t self:capability sys_tty_config;
allow drbd_t self:fifo_file rw_fifo_file_perms;
allow drbd_t self:unix_stream_socket create_stream_socket_perms;
allow drbd_t self:netlink_socket create_socket_perms;
allow drbd_t self:netlink_route_socket nlmsg_write;

manage_dirs_pattern(drbd_t, drbd_var_lib_t, drbd_var_lib_t)
manage_files_pattern(drbd_t, drbd_var_lib_t, drbd_var_lib_t)
manage_lnk_files_pattern(drbd_t, drbd_var_lib_t, drbd_var_lib_t)
files_var_lib_filetrans(drbd_t, drbd_var_lib_t, dir)

manage_files_pattern(drbd_t, drbd_lock_t, drbd_lock_t)
files_lock_filetrans(drbd_t, drbd_lock_t, file)

can_exec(drbd_t, drbd_exec_t)

kernel_read_system_state(drbd_t)

dev_read_rand(drbd_t)
dev_read_sysfs(drbd_t)
dev_read_urand(drbd_t)

files_read_etc_files(drbd_t)

storage_raw_read_fixed_disk(drbd_t)

miscfiles_read_localization(drbd_t)

sysnet_dns_name_resolve(drbd_t)
