policy_module(iodine)

########################################
#
# 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_runtime_t alias iodined_var_run_t;
files_runtime_file(iodined_runtime_t)

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

allow iodined_t self:capability { net_admin net_raw setgid setuid sys_chroot };
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;
allow iodined_t self:netlink_route_socket create_netlink_socket_perms;

manage_dirs_pattern(iodined_t, iodined_runtime_t, iodined_runtime_t)
manage_files_pattern(iodined_t, iodined_runtime_t, iodined_runtime_t)

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_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)

corecmd_exec_shell(iodined_t)

files_read_etc_files(iodined_t)

logging_send_syslog_msg(iodined_t)

sysnet_domtrans_ifconfig(iodined_t)
