policy_module(vdagent)

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

type vdagent_t;
type vdagent_exec_t;
init_daemon_domain(vdagent_t, vdagent_exec_t)

type vdagentd_initrc_exec_t;
init_script_file(vdagentd_initrc_exec_t)

type vdagent_log_t;
logging_log_file(vdagent_log_t)

type vdagent_runtime_t alias vdagent_var_run_t;
files_runtime_file(vdagent_runtime_t)

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

dontaudit vdagent_t self:capability sys_admin;
allow vdagent_t self:process signal;
allow vdagent_t self:fifo_file rw_fifo_file_perms;
allow vdagent_t self:unix_stream_socket { accept listen };

manage_dirs_pattern(vdagent_t, vdagent_runtime_t, vdagent_runtime_t)
manage_files_pattern(vdagent_t, vdagent_runtime_t, vdagent_runtime_t)
manage_sock_files_pattern(vdagent_t, vdagent_runtime_t, vdagent_runtime_t)
files_runtime_filetrans(vdagent_t, vdagent_runtime_t, { dir file sock_file })

manage_dirs_pattern(vdagent_t, vdagent_log_t, vdagent_log_t)
append_files_pattern(vdagent_t, vdagent_log_t, vdagent_log_t)
create_files_pattern(vdagent_t, vdagent_log_t, vdagent_log_t)
setattr_files_pattern(vdagent_t, vdagent_log_t, vdagent_log_t)
logging_log_filetrans(vdagent_t, vdagent_log_t, file)

dev_rw_input_dev(vdagent_t)
dev_rw_mtrr(vdagent_t)
dev_read_sysfs(vdagent_t)
dev_dontaudit_write_mtrr(vdagent_t)

files_read_etc_files(vdagent_t)

term_use_virtio_console(vdagent_t)

init_read_state(vdagent_t)

logging_send_syslog_msg(vdagent_t)

miscfiles_read_localization(vdagent_t)

userdom_read_all_users_state(vdagent_t)

optional_policy(`
	dbus_system_bus_client(vdagent_t)
')
