policy_module(sxid, 1.8.0)

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

type sxid_t;
type sxid_exec_t;
application_domain(sxid_t, sxid_exec_t)

type sxid_log_t;
logging_log_file(sxid_log_t)

type sxid_tmp_t;
files_tmp_file(sxid_tmp_t)

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

allow sxid_t self:capability {  dac_read_search fsetid };
dontaudit sxid_t self:capability { setuid setgid sys_tty_config };
allow sxid_t self:process signal_perms;
allow sxid_t self:fifo_file rw_fifo_file_perms;
allow sxid_t self:tcp_socket create_stream_socket_perms;
allow sxid_t self:udp_socket create_socket_perms;

allow sxid_t sxid_log_t:file { append_file_perms create_file_perms setattr_file_perms };
logging_log_filetrans(sxid_t, sxid_log_t, file)

manage_dirs_pattern(sxid_t, sxid_tmp_t, sxid_tmp_t)
manage_files_pattern(sxid_t, sxid_tmp_t, sxid_tmp_t)
files_tmp_filetrans(sxid_t, sxid_tmp_t, { file dir })

kernel_read_system_state(sxid_t)
kernel_read_kernel_sysctls(sxid_t)

corecmd_exec_bin(sxid_t)
corecmd_exec_shell(sxid_t)

corenet_all_recvfrom_netlabel(sxid_t)
corenet_tcp_sendrecv_generic_if(sxid_t)
corenet_udp_sendrecv_generic_if(sxid_t)
corenet_tcp_sendrecv_generic_node(sxid_t)
corenet_udp_sendrecv_generic_node(sxid_t)
corenet_tcp_sendrecv_all_ports(sxid_t)
corenet_udp_sendrecv_all_ports(sxid_t)

dev_read_sysfs(sxid_t)
dev_getattr_all_blk_files(sxid_t)
dev_getattr_all_chr_files(sxid_t)

domain_use_interactive_fds(sxid_t)

files_list_all(sxid_t)
files_getattr_all_symlinks(sxid_t)
files_getattr_all_pipes(sxid_t)
files_getattr_all_sockets(sxid_t)

fs_getattr_xattr_fs(sxid_t)
fs_search_auto_mountpoints(sxid_t)
fs_list_all(sxid_t)

term_dontaudit_use_console(sxid_t)

files_read_non_security_files(sxid_t)
auth_dontaudit_getattr_shadow(sxid_t)

init_use_fds(sxid_t)
init_use_script_ptys(sxid_t)

logging_send_syslog_msg(sxid_t)

sysnet_read_config(sxid_t)

userdom_dontaudit_use_unpriv_user_fds(sxid_t)

optional_policy(`
	cron_system_entry(sxid_t, sxid_exec_t)
')

optional_policy(`
	mount_exec(sxid_t)
')

optional_policy(`
	mta_send_mail(sxid_t)
')

optional_policy(`
	seutil_sigchld_newrole(sxid_t)
')

optional_policy(`
	udev_read_db(sxid_t)
')
