Chris PeBenito 17de1b
## <summary>Internet services daemon.</summary>
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Define the specified domain as a inetd service.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <desc>
Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
##	Define the specified domain as a inetd service.  The
Chris PeBenito 17de1b
##	inetd_service_domain(), inetd_tcp_service_domain(),
Chris PeBenito 17de1b
##	or inetd_udp_service_domain() interfaces should be used
Chris PeBenito 17de1b
##	instead of this interface, as this interface only provides
Chris PeBenito 17de1b
##	the common rules to these three interfaces.
Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
## </desc>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type associated with the inetd service process.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="entrypoint">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type associated with the process program.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`inetd_core_service_domain',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type inetd_t;
Chris PeBenito 17de1b
		role system_r;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	domain_type($1)
Chris PeBenito 17de1b
	domain_entry_file($1,$2)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	role system_r types $1;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	ifdef(`targeted_policy',`
Chris PeBenito 17de1b
		# this regex is a hack, since it assumes there is a
Chris PeBenito 17de1b
		# _t at the end of the domain type.  If there is no _t
Chris PeBenito 17de1b
		# at the end of the type, it returns empty!
Chris PeBenito 17de1b
		ifdef(`__define_'regexp($1, `\(\w+\)_t', `\1_disable_trans'),`',`
Chris PeBenito 17de1b
			bool regexp($1, `\(\w+\)_t', `\1_disable_trans') false;
Chris PeBenito 17de1b
			define(`__define_'regexp($1, `\(\w+\)_t', `\1_disable_trans'))
Chris PeBenito 17de1b
		')
Chris PeBenito 17de1b
		if(regexp($1, `\(\w+\)_t', `\1_disable_trans') ) {
Chris PeBenito 17de1b
#			can_exec(inetd_t,$2)
Chris PeBenito 17de1b
			# cjp: this must be wrong
Chris PeBenito 17de1b
			gen_require(`
Chris PeBenito 17de1b
				type initrc_t, unconfined_t;
Chris PeBenito 17de1b
			')
Chris PeBenito 17de1b
			can_exec({ unconfined_t initrc_t },$2)
Chris PeBenito 17de1b
		} else {
Chris PeBenito 17de1b
			domain_auto_trans(inetd_t,$2,$1)
Chris PeBenito 17de1b
			allow inetd_t $1:fd use;
Chris PeBenito 17de1b
			allow $1 inetd_t:fd use;
Chris PeBenito 17de1b
			allow $1 inetd_t:fifo_file rw_file_perms;
Chris PeBenito 17de1b
			allow $1 inetd_t:process sigchld;
Chris PeBenito 17de1b
			dontaudit inetd_t $1:process { noatsecure siginh rlimitinh };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
			allow inetd_t $1:process sigkill;
Chris PeBenito 17de1b
		}
Chris PeBenito 17de1b
	',`
Chris PeBenito 17de1b
		domain_auto_trans(inetd_t,$2,$1)
Chris PeBenito 17de1b
		allow inetd_t $1:fd use;
Chris PeBenito 17de1b
		allow $1 inetd_t:fd use;
Chris PeBenito 17de1b
		allow $1 inetd_t:fifo_file rw_file_perms;
Chris PeBenito 17de1b
		allow $1 inetd_t:process sigchld;
Chris PeBenito 17de1b
		dontaudit inetd_t $1:process { noatsecure siginh rlimitinh };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
		allow inetd_t $1:process sigkill;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Define the specified domain as a TCP inetd service.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type associated with the inetd service process.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="entrypoint">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type associated with the process program.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`inetd_tcp_service_domain',`
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type inetd_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	inetd_core_service_domain($1,$2)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 inetd_t:tcp_socket rw_stream_socket_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Define the specified domain as a UDP inetd service.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type associated with the inetd service process.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="entrypoint">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type associated with the process program.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`inetd_udp_service_domain',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type inetd_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	inetd_core_service_domain($1,$2)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 inetd_t:udp_socket rw_socket_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Define the specified domain as a TCP and UDP inetd service.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type associated with the inetd service process.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="entrypoint">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type associated with the process program.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`inetd_service_domain',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type inetd_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	inetd_core_service_domain($1,$2)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 inetd_t:tcp_socket rw_stream_socket_perms;
Chris PeBenito 17de1b
	allow $1 inetd_t:udp_socket rw_socket_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Inherit and use file descriptors from inetd.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`inetd_use_fds',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type inetd_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 inetd_t:fd use;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 33c7e6
##	Connect to the inetd service using a TCP connection.  (Deprecated)
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`inetd_tcp_connect',`
Chris PeBenito 33c7e6
	refpolicywarn(`$0($*) has been deprecated.')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Run inetd child process in the inet child domain
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`inetd_domtrans_child',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type inetd_child_t, inetd_child_exec_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	corecmd_search_sbin($1)
Chris PeBenito 17de1b
	domain_auto_trans($1,inetd_child_exec_t,inetd_child_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 inetd_child_t:fd use;
Chris PeBenito 17de1b
	allow inetd_child_t $1:fd use;
Chris PeBenito 17de1b
	allow inetd_child_t $1:fifo_file rw_file_perms;
Chris PeBenito 17de1b
	allow inetd_child_t $1:process sigchld;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 33c7e6
##	Send UDP network traffic to inetd.  (Deprecated)
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type of the process performing this action.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`inetd_udp_send',`
Chris PeBenito 33c7e6
	refpolicywarn(`$0($*) has been deprecated.')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Read and write inetd TCP sockets.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type of the process performing this action.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`inetd_rw_tcp_sockets',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type inetd_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 inetd_t:tcp_socket rw_stream_socket_perms;
Chris PeBenito 17de1b
')