policy_module(ifplugd)

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

type ifplugd_t;
type ifplugd_exec_t;
init_daemon_domain(ifplugd_t, ifplugd_exec_t)

type ifplugd_etc_t;
files_type(ifplugd_etc_t)

type ifplugd_initrc_exec_t;
init_script_file(ifplugd_initrc_exec_t)

type ifplugd_runtime_t alias ifplugd_var_run_t;
files_runtime_file(ifplugd_runtime_t)

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

allow ifplugd_t self:capability { net_admin net_bind_service sys_nice };
dontaudit ifplugd_t self:capability sys_tty_config;
allow ifplugd_t self:process { signal signull };
allow ifplugd_t self:fifo_file rw_fifo_file_perms;
allow ifplugd_t self:tcp_socket { accept listen };
allow ifplugd_t self:packet_socket create_socket_perms;
allow ifplugd_t self:netlink_route_socket nlmsg_write;

read_files_pattern(ifplugd_t, ifplugd_etc_t, ifplugd_etc_t)
exec_files_pattern(ifplugd_t, ifplugd_etc_t, ifplugd_etc_t)

manage_files_pattern(ifplugd_t, ifplugd_runtime_t, ifplugd_runtime_t)
manage_sock_files_pattern(ifplugd_t, ifplugd_runtime_t, ifplugd_runtime_t)
files_runtime_filetrans(ifplugd_t, ifplugd_runtime_t, { file sock_file })

kernel_read_kernel_sysctls(ifplugd_t)
kernel_read_network_state(ifplugd_t)
kernel_read_system_state(ifplugd_t)
kernel_rw_net_sysctls(ifplugd_t)

corecmd_exec_bin(ifplugd_t)
corecmd_exec_shell(ifplugd_t)

dev_read_sysfs(ifplugd_t)

domain_read_confined_domains_state(ifplugd_t)
domain_dontaudit_read_all_domains_state(ifplugd_t)

auth_use_nsswitch(ifplugd_t)

init_domtrans_script(ifplugd_t)

logging_send_syslog_msg(ifplugd_t)

miscfiles_read_localization(ifplugd_t)

sysnet_domtrans_ifconfig(ifplugd_t)
sysnet_domtrans_dhcpc(ifplugd_t)
sysnet_delete_dhcpc_runtime_files(ifplugd_t)
sysnet_read_dhcpc_runtime_files(ifplugd_t)
sysnet_signal_dhcpc(ifplugd_t)

optional_policy(`
	consoletype_exec(ifplugd_t)
')

optional_policy(`
	netutils_domtrans(ifplugd_t)
')
