|
Chris PeBenito |
24bf11 |
## <summary>Internet services daemon.</summary>
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
b24f35 |
########################################
|
|
Chris PeBenito |
24bf11 |
## <summary>
|
|
Chris PeBenito |
24bf11 |
## Define the specified domain as a inetd service.
|
|
Chris PeBenito |
24bf11 |
## </summary>
|
|
Chris PeBenito |
24bf11 |
## <desc>
|
|
Chris PeBenito |
24bf11 |
## Define the specified domain as a inetd service. The
|
|
Chris PeBenito |
24bf11 |
## inetd_service_domain(), inetd_tcp_service_domain(),
|
|
Chris PeBenito |
24bf11 |
## or inetd_udp_service_domain() interfaces should be used
|
|
Chris PeBenito |
24bf11 |
## instead of this interface, as this interface only provides
|
|
Chris PeBenito |
24bf11 |
## the common rules to these three interfaces.
|
|
Chris PeBenito |
24bf11 |
## </desc>
|
|
Chris PeBenito |
24bf11 |
## <param name="domain">
|
|
Chris PeBenito |
24bf11 |
## The type associated with the inetd service process.
|
|
Chris PeBenito |
24bf11 |
## </param>
|
|
Chris PeBenito |
24bf11 |
## <param name="entrypoint">
|
|
Chris PeBenito |
24bf11 |
## The type associated with the process program.
|
|
Chris PeBenito |
24bf11 |
## </param>
|
|
Chris PeBenito |
b24f35 |
#
|
|
Chris PeBenito |
24bf11 |
interface(`inetd_core_service_domain',`
|
|
Chris PeBenito |
24bf11 |
gen_require(`
|
|
Chris PeBenito |
24bf11 |
type inetd_t;
|
|
Chris PeBenito |
24bf11 |
role system_r;
|
|
Chris PeBenito |
24bf11 |
class fd use;
|
|
Chris PeBenito |
24bf11 |
class fifo_file rw_file_perms;
|
|
Chris PeBenito |
24bf11 |
class process { sigchld sigkill };
|
|
Chris PeBenito |
24bf11 |
')
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
24bf11 |
domain_type($1)
|
|
Chris PeBenito |
24bf11 |
domain_entry_file($1,$2)
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
24bf11 |
role system_r types $1;
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
69dcd6 |
ifdef(`targeted_policy',`
|
|
Chris PeBenito |
69dcd6 |
# this regex is a hack, since it assumes there is a
|
|
Chris PeBenito |
69dcd6 |
# _t at the end of the domain type. If there is no _t
|
|
Chris PeBenito |
69dcd6 |
# at the end of the type, it returns empty!
|
|
Chris PeBenito |
0500e0 |
ifdef(`__define_'regexp($1, `\(\w+\)_t', `\1_disable_trans'),`',`
|
|
Chris PeBenito |
0500e0 |
bool regexp($1, `\(\w+\)_t', `\1_disable_trans') false;
|
|
Chris PeBenito |
0500e0 |
define(`__define_'regexp($1, `\(\w+\)_t', `\1_disable_trans'))
|
|
Chris PeBenito |
0500e0 |
')
|
|
Chris PeBenito |
69dcd6 |
if(regexp($1, `\(\w+\)_t', `\1_disable_trans') ) {
|
|
Chris PeBenito |
4614e8 |
# can_exec(inetd_t,$2)
|
|
Chris PeBenito |
4614e8 |
# cjp: this must be wrong
|
|
Chris PeBenito |
4614e8 |
gen_require(`
|
|
Chris PeBenito |
4614e8 |
type initrc_t, unconfined_t;
|
|
Chris PeBenito |
4614e8 |
')
|
|
Chris PeBenito |
4614e8 |
can_exec({ unconfined_t initrc_t },$2)
|
|
Chris PeBenito |
69dcd6 |
} else {
|
|
Chris PeBenito |
69dcd6 |
domain_auto_trans(inetd_t,$2,$1)
|
|
Chris PeBenito |
69dcd6 |
allow inetd_t $1:fd use;
|
|
Chris PeBenito |
69dcd6 |
allow $1 inetd_t:fd use;
|
|
Chris PeBenito |
69dcd6 |
allow $1 inetd_t:fifo_file rw_file_perms;
|
|
Chris PeBenito |
69dcd6 |
allow $1 inetd_t:process sigchld;
|
|
Chris PeBenito |
69dcd6 |
dontaudit inetd_t $1:process { noatsecure siginh rlimitinh };
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
4614e8 |
allow inetd_t $1:process sigkill;
|
|
Chris PeBenito |
4614e8 |
|
|
Chris PeBenito |
69dcd6 |
# make sediff happy
|
|
Chris PeBenito |
69dcd6 |
allow $1 $2:file { rx_file_perms entrypoint };
|
|
Chris PeBenito |
69dcd6 |
}
|
|
Chris PeBenito |
69dcd6 |
',`
|
|
Chris PeBenito |
69dcd6 |
domain_auto_trans(inetd_t,$2,$1)
|
|
Chris PeBenito |
69dcd6 |
allow inetd_t $1:fd use;
|
|
Chris PeBenito |
69dcd6 |
allow $1 inetd_t:fd use;
|
|
Chris PeBenito |
69dcd6 |
allow $1 inetd_t:fifo_file rw_file_perms;
|
|
Chris PeBenito |
69dcd6 |
allow $1 inetd_t:process sigchld;
|
|
Chris PeBenito |
69dcd6 |
dontaudit inetd_t $1:process { noatsecure siginh rlimitinh };
|
|
Chris PeBenito |
69dcd6 |
|
|
Chris PeBenito |
4614e8 |
allow inetd_t $1:process sigkill;
|
|
Chris PeBenito |
4614e8 |
|
|
Chris PeBenito |
69dcd6 |
# make sediff happy
|
|
Chris PeBenito |
69dcd6 |
allow $1 $2:file { rx_file_perms entrypoint };
|
|
Chris PeBenito |
69dcd6 |
')
|
|
Chris PeBenito |
24bf11 |
')
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
b24f35 |
########################################
|
|
Chris PeBenito |
24bf11 |
## <summary>
|
|
Chris PeBenito |
24bf11 |
## Define the specified domain as a TCP inetd service.
|
|
Chris PeBenito |
24bf11 |
## </summary>
|
|
Chris PeBenito |
24bf11 |
## <param name="domain">
|
|
Chris PeBenito |
24bf11 |
## The type associated with the inetd service process.
|
|
Chris PeBenito |
24bf11 |
## </param>
|
|
Chris PeBenito |
24bf11 |
## <param name="entrypoint">
|
|
Chris PeBenito |
24bf11 |
## The type associated with the process program.
|
|
Chris PeBenito |
24bf11 |
## </param>
|
|
Chris PeBenito |
b24f35 |
#
|
|
Chris PeBenito |
24bf11 |
interface(`inetd_tcp_service_domain',`
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
24bf11 |
gen_require(`
|
|
Chris PeBenito |
24bf11 |
type inetd_t;
|
|
Chris PeBenito |
24bf11 |
class tcp_socket rw_stream_socket_perms;
|
|
Chris PeBenito |
24bf11 |
')
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
24bf11 |
inetd_core_service_domain($1,$2)
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
24bf11 |
allow $1 inetd_t:tcp_socket rw_stream_socket_perms;
|
|
Chris PeBenito |
24bf11 |
')
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
b24f35 |
########################################
|
|
Chris PeBenito |
24bf11 |
## <summary>
|
|
Chris PeBenito |
24bf11 |
## Define the specified domain as a UDP inetd service.
|
|
Chris PeBenito |
24bf11 |
## </summary>
|
|
Chris PeBenito |
24bf11 |
## <param name="domain">
|
|
Chris PeBenito |
24bf11 |
## The type associated with the inetd service process.
|
|
Chris PeBenito |
24bf11 |
## </param>
|
|
Chris PeBenito |
24bf11 |
## <param name="entrypoint">
|
|
Chris PeBenito |
24bf11 |
## The type associated with the process program.
|
|
Chris PeBenito |
24bf11 |
## </param>
|
|
Chris PeBenito |
b24f35 |
#
|
|
Chris PeBenito |
24bf11 |
interface(`inetd_udp_service_domain',`
|
|
Chris PeBenito |
24bf11 |
gen_require(`
|
|
Chris PeBenito |
24bf11 |
type inetd_t;
|
|
Chris PeBenito |
24bf11 |
class udp_socket rw_socket_perms;
|
|
Chris PeBenito |
24bf11 |
')
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
24bf11 |
inetd_core_service_domain($1,$2)
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
24bf11 |
allow $1 inetd_t:udp_socket rw_socket_perms;
|
|
Chris PeBenito |
24bf11 |
')
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
b24f35 |
########################################
|
|
Chris PeBenito |
24bf11 |
## <summary>
|
|
Chris PeBenito |
24bf11 |
## Define the specified domain as a TCP and UDP inetd service.
|
|
Chris PeBenito |
24bf11 |
## </summary>
|
|
Chris PeBenito |
24bf11 |
## <param name="domain">
|
|
Chris PeBenito |
24bf11 |
## The type associated with the inetd service process.
|
|
Chris PeBenito |
24bf11 |
## </param>
|
|
Chris PeBenito |
24bf11 |
## <param name="entrypoint">
|
|
Chris PeBenito |
24bf11 |
## The type associated with the process program.
|
|
Chris PeBenito |
24bf11 |
## </param>
|
|
Chris PeBenito |
b24f35 |
#
|
|
Chris PeBenito |
24bf11 |
interface(`inetd_service_domain',`
|
|
Chris PeBenito |
24bf11 |
gen_require(`
|
|
Chris PeBenito |
24bf11 |
type inetd_t;
|
|
Chris PeBenito |
24bf11 |
class tcp_socket rw_stream_socket_perms;
|
|
Chris PeBenito |
24bf11 |
class udp_socket rw_socket_perms;
|
|
Chris PeBenito |
24bf11 |
')
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
24bf11 |
inetd_core_service_domain($1,$2)
|
|
Chris PeBenito |
24bf11 |
|
|
Chris PeBenito |
24bf11 |
allow $1 inetd_t:tcp_socket rw_stream_socket_perms;
|
|
Chris PeBenito |
24bf11 |
allow $1 inetd_t:udp_socket rw_socket_perms;
|
|
Chris PeBenito |
24bf11 |
')
|
|
Chris PeBenito |
b24f35 |
|
|
Chris PeBenito |
b24f35 |
########################################
|
|
Chris PeBenito |
b24f35 |
## <summary>
|
|
Chris PeBenito |
23ca91 |
## Inherit and use file descriptors from inetd.
|
|
Chris PeBenito |
23ca91 |
## </summary>
|
|
Chris PeBenito |
23ca91 |
## <param name="domain">
|
|
Chris PeBenito |
23ca91 |
## Domain allowed access.
|
|
Chris PeBenito |
23ca91 |
## </param>
|
|
Chris PeBenito |
23ca91 |
#
|
|
Chris PeBenito |
23ca91 |
interface(`inetd_use_fd',`
|
|
Chris PeBenito |
23ca91 |
gen_require(`
|
|
Chris PeBenito |
23ca91 |
type inetd_t;
|
|
Chris PeBenito |
23ca91 |
class fd use;
|
|
Chris PeBenito |
23ca91 |
')
|
|
Chris PeBenito |
23ca91 |
|
|
Chris PeBenito |
23ca91 |
allow $1 inetd_t:fd use;
|
|
Chris PeBenito |
23ca91 |
')
|
|
Chris PeBenito |
23ca91 |
|
|
Chris PeBenito |
23ca91 |
########################################
|
|
Chris PeBenito |
23ca91 |
## <summary>
|
|
Chris PeBenito |
b24f35 |
## Connect to the inetd service using a TCP connection.
|
|
Chris PeBenito |
b24f35 |
## </summary>
|
|
Chris PeBenito |
b24f35 |
## <param name="domain">
|
|
Chris PeBenito |
b24f35 |
## Domain allowed access.
|
|
Chris PeBenito |
b24f35 |
## </param>
|
|
Chris PeBenito |
b24f35 |
#
|
|
Chris PeBenito |
81343a |
interface(`inetd_tcp_connect',`
|
|
Chris PeBenito |
b24f35 |
gen_require(`
|
|
Chris PeBenito |
b24f35 |
type inetd_t;
|
|
Chris PeBenito |
b24f35 |
class tcp_socket { connectto acceptfrom recvfrom };
|
|
Chris PeBenito |
b24f35 |
')
|
|
Chris PeBenito |
b24f35 |
|
|
Chris PeBenito |
b24f35 |
allow $1 inetd_t:tcp_socket { connectto recvfrom };
|
|
Chris PeBenito |
b24f35 |
allow inetd_t $1:tcp_socket { acceptfrom recvfrom };
|
|
Chris PeBenito |
eb3cb6 |
kernel_tcp_recvfrom($1)
|
|
Chris PeBenito |
b24f35 |
')
|
|
Chris PeBenito |
4aa0dc |
|
|
Chris PeBenito |
4aa0dc |
########################################
|
|
Chris PeBenito |
4aa0dc |
## <summary>
|
|
Chris PeBenito |
4aa0dc |
## Run inetd child process in the inet child domain
|
|
Chris PeBenito |
4aa0dc |
## </summary>
|
|
Chris PeBenito |
4aa0dc |
## <param name="domain">
|
|
Chris PeBenito |
4aa0dc |
## Domain allowed access.
|
|
Chris PeBenito |
4aa0dc |
## </param>
|
|
Chris PeBenito |
4aa0dc |
#
|
|
Chris PeBenito |
4aa0dc |
interface(`inetd_domtrans_child',`
|
|
Chris PeBenito |
4aa0dc |
gen_require(`
|
|
Chris PeBenito |
4aa0dc |
type inetd_child_t, inetd_child_exec_t;
|
|
Chris PeBenito |
4aa0dc |
class process sigchld;
|
|
Chris PeBenito |
4aa0dc |
class fd use;
|
|
Chris PeBenito |
4aa0dc |
class fifo_file rw_file_perms;
|
|
Chris PeBenito |
4aa0dc |
')
|
|
Chris PeBenito |
4aa0dc |
|
|
Chris PeBenito |
4aa0dc |
corecmd_search_sbin($1)
|
|
Chris PeBenito |
4aa0dc |
domain_auto_trans($1,inetd_child_exec_t,inetd_child_t)
|
|
Chris PeBenito |
4aa0dc |
|
|
Chris PeBenito |
4aa0dc |
allow $1 inetd_child_t:fd use;
|
|
Chris PeBenito |
4aa0dc |
allow inetd_child_t $1:fd use;
|
|
Chris PeBenito |
4aa0dc |
allow inetd_child_t $1:fifo_file rw_file_perms;
|
|
Chris PeBenito |
4aa0dc |
allow inetd_child_t $1:process sigchld;
|
|
Chris PeBenito |
4aa0dc |
')
|
|
Chris PeBenito |
eb3cb6 |
|
|
Chris PeBenito |
eb3cb6 |
########################################
|
|
Chris PeBenito |
eb3cb6 |
## <summary>
|
|
Chris PeBenito |
eb3cb6 |
## Send UDP network traffic to inetd.
|
|
Chris PeBenito |
eb3cb6 |
## </summary>
|
|
Chris PeBenito |
eb3cb6 |
## <param name="domain">
|
|
Chris PeBenito |
eb3cb6 |
## The type of the process performing this action.
|
|
Chris PeBenito |
eb3cb6 |
## </param>
|
|
Chris PeBenito |
eb3cb6 |
#
|
|
Chris PeBenito |
eb3cb6 |
interface(`inetd_udp_sendto',`
|
|
Chris PeBenito |
eb3cb6 |
gen_require(`
|
|
Chris PeBenito |
eb3cb6 |
type inetd_t;
|
|
Chris PeBenito |
eb3cb6 |
class udp_socket { sendto recvfrom };
|
|
Chris PeBenito |
eb3cb6 |
')
|
|
Chris PeBenito |
eb3cb6 |
|
|
Chris PeBenito |
eb3cb6 |
allow $1 inetd_t:udp_socket sendto;
|
|
Chris PeBenito |
eb3cb6 |
allow inetd_t $1:udp_socket recvfrom;
|
|
Chris PeBenito |
eb3cb6 |
')
|