policy_module(rkt, 1.0.0)

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

type rkt_t;
type rkt_exec_t;
init_daemon_domain(rkt_t, rkt_exec_t)

type rkt_var_lib_t;
files_type(rkt_var_lib_t)

type rkt_unit_file_t;
systemd_unit_file(rkt_unit_file_t)

########################################
#
# rkt local policy
#
allow rkt_t self:capability net_admin;
allow rkt_t self:fifo_file rw_fifo_file_perms;
allow rkt_t self:unix_stream_socket create_stream_socket_perms;
allow rkt_t self:tcp_socket create_stream_socket_perms;

manage_dirs_pattern(rkt_t, rkt_var_lib_t, rkt_var_lib_t)
manage_files_pattern(rkt_t, rkt_var_lib_t, rkt_var_lib_t)
manage_lnk_files_pattern(rkt_t, rkt_var_lib_t, rkt_var_lib_t)
files_var_lib_filetrans(rkt_t, rkt_var_lib_t, { dir file lnk_file })

kernel_read_net_sysctls(rkt_t)

corenet_tcp_bind_generic_node(rkt_t)
corenet_tcp_bind_rkt_port(rkt_t)

dev_read_sysfs(rkt_t)

domain_use_interactive_fds(rkt_t)

sysnet_dns_name_resolve(rkt_t)
