policy_module(wdmd)

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

type wdmd_t;
type wdmd_exec_t;
init_daemon_domain(wdmd_t, wdmd_exec_t)

type wdmd_initrc_exec_t;
init_script_file(wdmd_initrc_exec_t)

type wdmd_runtime_t alias wdmd_var_run_t;
files_runtime_file(wdmd_runtime_t)

type wdmd_tmpfs_t;
files_tmpfs_file(wdmd_tmpfs_t)

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

allow wdmd_t self:capability { chown ipc_lock sys_nice };
allow wdmd_t self:process { setsched signal };
allow wdmd_t self:fifo_file rw_fifo_file_perms;
allow wdmd_t self:unix_stream_socket { accept listen };

manage_dirs_pattern(wdmd_t, wdmd_runtime_t, wdmd_runtime_t)
manage_files_pattern(wdmd_t, wdmd_runtime_t, wdmd_runtime_t)
manage_sock_files_pattern(wdmd_t, wdmd_runtime_t, wdmd_runtime_t)
files_runtime_filetrans(wdmd_t, wdmd_runtime_t, { file dir sock_file })

manage_dirs_pattern(wdmd_t, wdmd_tmpfs_t, wdmd_tmpfs_t)
manage_files_pattern(wdmd_t, wdmd_tmpfs_t, wdmd_tmpfs_t)
fs_tmpfs_filetrans(wdmd_t, wdmd_tmpfs_t, { dir file })

kernel_read_system_state(wdmd_t)

corecmd_exec_bin(wdmd_t)
corecmd_exec_shell(wdmd_t)

dev_read_watchdog(wdmd_t)
dev_write_watchdog(wdmd_t)

fs_read_anon_inodefs_files(wdmd_t)

auth_use_nsswitch(wdmd_t)

logging_send_syslog_msg(wdmd_t)

miscfiles_read_localization(wdmd_t)

optional_policy(`
	corosync_initrc_domtrans(wdmd_t)
	corosync_stream_connect(wdmd_t)
	corosync_rw_tmpfs(wdmd_t)
')
