policy_module(etcd,1.0.0)

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

type etcd_t;
type etcd_exec_t;
init_daemon_domain(etcd_t,etcd_exec_t)

permissive etcd_t;

type etcd_unit_file_t;
systemd_unit_file(etcd_unit_file_t)

type etcd_var_lib_t;
files_type(etcd_var_lib_t)

########################################
#
# ectd local policy
#

allow etcd_t self:tcp_socket create_stream_socket_perms;

manage_dirs_pattern(etcd_t, etcd_var_lib_t, etcd_var_lib_t)
manage_files_pattern(etcd_t, etcd_var_lib_t, etcd_var_lib_t)
manage_lnk_files_pattern(etcd_t, etcd_var_lib_t, etcd_var_lib_t)
files_var_lib_filetrans(etcd_t, etcd_var_lib_t, dir)

kernel_read_unix_sysctls(etcd_t)
kernel_read_net_sysctls(etcd_t)

corenet_tcp_bind_generic_node(etcd_t)

corenet_tcp_bind_kubernetes_port(etcd_t)
corenet_tcp_bind_afs3_callback_port(etcd_t)

fs_getattr_xattr_fs(etcd_t)

logging_send_syslog_msg(etcd_t)
