policy_module(ktalk, 1.9.2)

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

type ktalkd_t;
type ktalkd_exec_t;
init_daemon_domain(ktalkd_t, ktalkd_exec_t)
inetd_udp_service_domain(ktalkd_t, ktalkd_exec_t)

type ktalkd_log_t;
logging_log_file(ktalkd_log_t)

type ktalkd_unit_file_t;
systemd_unit_file(ktalkd_unit_file_t)

type ktalkd_tmp_t;
files_tmp_file(ktalkd_tmp_t)

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

allow ktalkd_t self:process signal_perms;
allow ktalkd_t self:fifo_file rw_fifo_file_perms;
allow ktalkd_t self:tcp_socket { accept listen };

allow ktalkd_t ktalkd_log_t:file { append_file_perms create_file_perms setattr_file_perms };
logging_log_filetrans(ktalkd_t, ktalkd_log_t, file)

manage_dirs_pattern(ktalkd_t, ktalkd_tmp_t, ktalkd_tmp_t)
manage_files_pattern(ktalkd_t, ktalkd_tmp_t, ktalkd_tmp_t)
files_tmp_filetrans(ktalkd_t, ktalkd_tmp_t, { file dir })

kernel_read_kernel_sysctls(ktalkd_t)
kernel_read_system_state(ktalkd_t)
kernel_read_network_state(ktalkd_t)

corenet_all_recvfrom_unlabeled(ktalkd_t)
corenet_all_recvfrom_netlabel(ktalkd_t)
corenet_udp_sendrecv_generic_if(ktalkd_t)
corenet_udp_sendrecv_generic_node(ktalkd_t)
corenet_udp_bind_generic_node(ktalkd_t)

corenet_sendrecv_ktalkd_server_packets(ktalkd_t)
corenet_udp_bind_ktalkd_port(ktalkd_t)
corenet_udp_sendrecv_ktalkd_port(ktalkd_t)

dev_read_urand(ktalkd_t)

fs_getattr_xattr_fs(ktalkd_t)

term_search_ptys(ktalkd_t)
term_use_all_inherited_terms(ktalkd_t)

auth_use_nsswitch(ktalkd_t)

init_read_utmp(ktalkd_t)

logging_send_syslog_msg(ktalkd_t)

userdom_use_user_ptys(ktalkd_t)
userdom_use_user_ttys(ktalkd_t)
