Chris PeBenito 24bf11
Chris PeBenito 24bf11
policy_module(inetd,1.0)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
########################################
Chris PeBenito 24bf11
#
Chris PeBenito 24bf11
# Declarations
Chris PeBenito 24bf11
#
Chris PeBenito 24bf11
Chris PeBenito 24bf11
type inetd_t; # ifdef(`unlimitedInetd', `,admin, etc_writer, fs_domain, auth_write, privmem')
Chris PeBenito 24bf11
type inetd_exec_t;
Chris PeBenito 24bf11
init_daemon_domain(inetd_t,inetd_exec_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
type inetd_log_t;
Chris PeBenito 24bf11
logging_log_file(inetd_log_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
type inetd_tmp_t;
Chris PeBenito 24bf11
files_tmp_file(inetd_tmp_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
type inetd_var_run_t;
Chris PeBenito 24bf11
files_pid_file(inetd_var_run_t)
Chris PeBenito 24bf11
Chris PeBenito 493d6c
type inetd_child_t;
Chris PeBenito 24bf11
type inetd_child_exec_t;
Chris PeBenito 24bf11
inetd_service_domain(inetd_child_t,inetd_child_exec_t)
Chris PeBenito 24bf11
role system_r types inetd_child_t;
Chris PeBenito 24bf11
Chris PeBenito 24bf11
type inetd_child_tmp_t;
Chris PeBenito 24bf11
files_tmp_file(inetd_child_tmp_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
type inetd_child_var_run_t;
Chris PeBenito 24bf11
files_pid_file(inetd_child_var_run_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
########################################
Chris PeBenito 24bf11
#
Chris PeBenito 24bf11
# Local policy
Chris PeBenito 24bf11
#
Chris PeBenito 24bf11
Chris PeBenito 24bf11
allow inetd_t self:capability { setuid setgid };
Chris PeBenito 24bf11
dontaudit inetd_t self:capability sys_tty_config;
Chris PeBenito 24bf11
allow inetd_t self:process setsched;
Chris PeBenito 24bf11
allow inetd_t self:fifo_file rw_file_perms;
Chris PeBenito 24bf11
allow inetd_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 24bf11
allow inetd_t self:udp_socket { connect connected_socket_perms };
Chris PeBenito 24bf11
Chris PeBenito 24bf11
allow inetd_t inetd_log_t:file create_file_perms;
Chris PeBenito 24bf11
logging_create_log(inetd_t,inetd_log_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
allow inetd_t inetd_tmp_t:dir create_dir_perms;
Chris PeBenito 24bf11
allow inetd_t inetd_tmp_t:file create_file_perms;
Chris PeBenito 24bf11
files_create_tmp_files(inetd_t, inetd_tmp_t, { file dir })
Chris PeBenito 24bf11
Chris PeBenito 24bf11
allow inetd_t inetd_var_run_t:file create_file_perms;
Chris PeBenito 24bf11
files_create_pid(inetd_t,inetd_var_run_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
kernel_read_kernel_sysctl(inetd_t)
Chris PeBenito b24f35
kernel_list_proc(inetd_t)
Chris PeBenito b24f35
kernel_read_proc_symlinks(inetd_t)
Chris PeBenito eb3cb6
kernel_tcp_recvfrom(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
# networking:
Chris PeBenito 24bf11
corenet_tcp_sendrecv_all_if(inetd_t)
Chris PeBenito 24bf11
corenet_udp_sendrecv_all_if(inetd_t)
Chris PeBenito 24bf11
corenet_raw_sendrecv_all_if(inetd_t)
Chris PeBenito 24bf11
corenet_tcp_sendrecv_all_nodes(inetd_t)
Chris PeBenito 24bf11
corenet_udp_sendrecv_all_nodes(inetd_t)
Chris PeBenito 24bf11
corenet_raw_sendrecv_all_nodes(inetd_t)
Chris PeBenito 24bf11
corenet_tcp_sendrecv_all_ports(inetd_t)
Chris PeBenito 24bf11
corenet_udp_sendrecv_all_ports(inetd_t)
Chris PeBenito 24bf11
corenet_tcp_bind_all_nodes(inetd_t)
Chris PeBenito 24bf11
corenet_udp_bind_all_nodes(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
# listen on service ports:
Chris PeBenito 24bf11
#corenet_udp_bind_comsat_port(inetd_t)
Chris PeBenito 24bf11
corenet_tcp_bind_dbskkd_port(inetd_t)
Chris PeBenito 24bf11
corenet_udp_bind_dbskkd_port(inetd_t)
Chris PeBenito 24bf11
corenet_udp_bind_ftp_port(inetd_t)
Chris PeBenito 24bf11
corenet_tcp_bind_inetd_child_port(inetd_t)
Chris PeBenito 24bf11
corenet_tcp_bind_inetd_child_port(inetd_t)
Chris PeBenito 24bf11
corenet_udp_bind_ktalkd_port(inetd_t)
Chris PeBenito 24bf11
corenet_udp_bind_rsh_port(inetd_t)
Chris PeBenito 24bf11
corenet_tcp_bind_rsync_port(inetd_t)
Chris PeBenito 24bf11
corenet_udp_bind_rsync_port(inetd_t)
Chris PeBenito 24bf11
#corenet_tcp_bind_stunnel_port(inetd_t)
Chris PeBenito 24bf11
corenet_tcp_bind_swat_port(inetd_t)
Chris PeBenito 24bf11
corenet_udp_bind_swat_port(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
dev_read_sysfs(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
fs_getattr_all_fs(inetd_t)
Chris PeBenito 24bf11
fs_search_auto_mountpoints(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
term_dontaudit_use_console(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 58c3da
# Run other daemons in the inetd_child_t domain.
Chris PeBenito 58c3da
corecmd_search_bin(inetd_t)
Chris PeBenito 58c3da
corecmd_read_sbin_symlink(inetd_t)
Chris PeBenito 58c3da
Chris PeBenito 24bf11
domain_use_wide_inherit_fd(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 8fd367
files_read_etc_files(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
init_use_fd(inetd_t)
Chris PeBenito 24bf11
init_use_script_pty(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
libs_use_ld_so(inetd_t)
Chris PeBenito 24bf11
libs_use_shared_libs(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
logging_send_syslog_msg(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
miscfiles_read_localization(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
sysnet_read_config(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
userdom_dontaudit_use_unpriv_user_fd(inetd_t)
Chris PeBenito b24f35
userdom_dontaudit_search_sysadm_home_dir(inetd_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
ifdef(`targeted_policy', `
Chris PeBenito 24bf11
	term_dontaudit_use_unallocated_tty(inetd_t)
Chris PeBenito 24bf11
	term_dontaudit_use_generic_pty(inetd_t)
Chris PeBenito 24bf11
	files_dontaudit_read_root_file(inetd_t)
Chris PeBenito 24bf11
')
Chris PeBenito 24bf11
Chris PeBenito 58c3da
optional_policy(`mount.te',`
Chris PeBenito 58c3da
	mount_send_nfs_client_request(inetd_t)
Chris PeBenito 24bf11
')
Chris PeBenito 24bf11
Chris PeBenito ae9e27
optional_policy(`selinuxutil.te',`
Chris PeBenito 8fd367
	seutil_sigchld_newrole(inetd_t)
Chris PeBenito 24bf11
')
Chris PeBenito 24bf11
Chris PeBenito 24bf11
optional_policy(`udev.te', `
Chris PeBenito 24bf11
	udev_read_db(inetd_t)
Chris PeBenito 24bf11
')
Chris PeBenito 24bf11
Chris PeBenito b24f35
optional_policy(`unconfined.te', `
Chris PeBenito b24f35
	unconfined_domtrans(inetd_t)
Chris PeBenito b24f35
')
Chris PeBenito b24f35
Chris PeBenito b24f35
# This should be tunable_policy, but leaving
Chris PeBenito b24f35
# ifdef until typeattribute works in conditionals
Chris PeBenito b24f35
ifdef(`unlimitedInetd', `
Chris PeBenito b24f35
	unconfined_domain_template(inetd_t) 
Chris PeBenito b24f35
')
Chris PeBenito b24f35
Chris PeBenito 24bf11
ifdef(`TODO',`
Chris PeBenito 24bf11
Chris PeBenito 58c3da
optional_policy(`rhgb.te',`
Chris PeBenito 58c3da
	rhgb_domain(inetd_t)
Chris PeBenito 24bf11
')
Chris PeBenito 24bf11
Chris PeBenito 24bf11
# Communicate with the portmapper.
Chris PeBenito 24bf11
ifdef(`portmap.te', `can_udp_send(inetd_t, portmap_t)')
Chris PeBenito 24bf11
') dnl TODO
Chris PeBenito 24bf11
Chris PeBenito 24bf11
########################################
Chris PeBenito 24bf11
#
Chris PeBenito 24bf11
# inetd child local_policy
Chris PeBenito 24bf11
#
Chris PeBenito 24bf11
Chris PeBenito 24bf11
allow inetd_child_t self:process signal_perms;
Chris PeBenito 24bf11
allow inetd_child_t self:fifo_file rw_file_perms;
Chris PeBenito 24bf11
allow inetd_child_t self:tcp_socket { listen accept connected_socket_perms };
Chris PeBenito 24bf11
Chris PeBenito 24bf11
# for identd
Chris PeBenito 24bf11
allow inetd_child_t self:netlink_tcpdiag_socket r_netlink_socket_perms;
Chris PeBenito 24bf11
allow inetd_child_t self:capability { setuid setgid };
Chris PeBenito 24bf11
allow inetd_child_t self:dir search;
Chris PeBenito 24bf11
allow inetd_child_t self:{ lnk_file file } { getattr read };
Chris PeBenito b24f35
files_search_home(inetd_child_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
allow inetd_child_t inetd_child_tmp_t:dir create_dir_perms;
Chris PeBenito 24bf11
allow inetd_child_t inetd_child_tmp_t:file create_file_perms;
Chris PeBenito 24bf11
files_create_tmp_files(inetd_child_t, inetd_child_tmp_t, { file dir })
Chris PeBenito 24bf11
Chris PeBenito 24bf11
allow inetd_child_t inetd_child_var_run_t:file create_file_perms;
Chris PeBenito 24bf11
files_create_pid(inetd_child_t,inetd_child_var_run_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
kernel_read_kernel_sysctl(inetd_child_t)
Chris PeBenito 24bf11
kernel_read_system_state(inetd_child_t)
Chris PeBenito 24bf11
kernel_read_network_state(inetd_child_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
corenet_tcp_sendrecv_all_if(inetd_child_t)
Chris PeBenito 24bf11
corenet_raw_sendrecv_all_if(inetd_child_t)
Chris PeBenito 24bf11
corenet_tcp_sendrecv_all_nodes(inetd_child_t)
Chris PeBenito 24bf11
corenet_raw_sendrecv_all_nodes(inetd_child_t)
Chris PeBenito 24bf11
corenet_tcp_bind_all_nodes(inetd_child_t)
Chris PeBenito 24bf11
corenet_tcp_sendrecv_all_ports(inetd_child_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
dev_read_urand(inetd_child_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
fs_getattr_xattr_fs(inetd_child_t)
Chris PeBenito 24bf11
Chris PeBenito 8fd367
files_read_etc_files(inetd_child_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
libs_use_ld_so(inetd_child_t)
Chris PeBenito 24bf11
libs_use_shared_libs(inetd_child_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
logging_send_syslog_msg(inetd_child_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
miscfiles_read_localization(inetd_child_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
sysnet_read_config(inetd_child_t)
Chris PeBenito 24bf11
Chris PeBenito 24bf11
tunable_policy(`run_ssh_inetd',`
Chris PeBenito 24bf11
	corenet_tcp_bind_ssh_port(inetd_t)
Chris PeBenito 24bf11
')
Chris PeBenito 24bf11
Chris PeBenito a7a979
optional_policy(`kerberos.te',`
Chris PeBenito a7a979
	kerberos_use(inetd_child_t)
Chris PeBenito a7a979
')
Chris PeBenito a7a979
Chris PeBenito 24bf11
optional_policy(`nis.te',`
Chris PeBenito 24bf11
	nis_use_ypbind(inetd_child_t)
Chris PeBenito 24bf11
')
Chris PeBenito 493d6c
Chris PeBenito 493d6c
optional_policy(`nscd.te',`
Chris PeBenito 493d6c
	nscd_use_socket(inetd_child_t)
Chris PeBenito 493d6c
')