policy_module(iodine, 1.1.0)

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

type iodined_t;
type iodined_exec_t;
init_daemon_domain(iodined_t, iodined_exec_t)

type iodined_initrc_exec_t;
init_script_file(iodined_initrc_exec_t)

type iodined_unit_file_t;
systemd_unit_file(iodined_unit_file_t)

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

allow iodined_t self:capability { net_admin net_raw sys_chroot setgid setuid };
allow iodined_t self:rawip_socket create_socket_perms;
allow iodined_t self:tun_socket create_socket_perms;
allow iodined_t self:udp_socket connected_socket_perms;

kernel_read_net_sysctls(iodined_t)
kernel_read_network_state(iodined_t)
kernel_read_system_state(iodined_t)
kernel_request_load_module(iodined_t)

corenet_all_recvfrom_netlabel(iodined_t)
corenet_all_recvfrom_unlabeled(iodined_t)
corenet_raw_sendrecv_generic_if(iodined_t)
corenet_udp_sendrecv_generic_if(iodined_t)
corenet_raw_sendrecv_generic_node(iodined_t)
corenet_udp_sendrecv_generic_node(iodined_t)
corenet_udp_bind_generic_node(iodined_t)

corenet_rw_tun_tap_dev(iodined_t)

corenet_sendrecv_dns_server_packets(iodined_t)
corenet_udp_bind_dns_port(iodined_t)
corenet_udp_sendrecv_dns_port(iodined_t)

corecmd_exec_shell(iodined_t)

auth_use_nsswitch(iodined_t)

logging_send_syslog_msg(iodined_t)

sysnet_domtrans_ifconfig(iodined_t)
