Chris PeBenito 73fbc7
## <summary>Policy for NIS (YP) servers and clients</summary>
Chris PeBenito 73fbc7
Chris PeBenito 73fbc7
########################################
Chris PeBenito 73fbc7
## <summary>
Chris PeBenito a996bd
##	Use the ypbind service to access NIS services
Chris PeBenito a996bd
##	unconditionally.
Chris PeBenito a996bd
## </summary>
Chris PeBenito a996bd
## <desc>
Chris PeBenito a996bd
##	

Chris PeBenito a996bd
##	Use the ypbind service to access NIS services
Chris PeBenito a996bd
##	unconditionally.
Chris PeBenito a996bd
##	

Chris PeBenito a996bd
##	

Chris PeBenito a996bd
##	This interface was added because of apache and
Chris PeBenito a996bd
##	spamassassin, to fix a nested conditionals problem.
Chris PeBenito a996bd
##	When that support is added, this should be removed,
Chris PeBenito a996bd
##	and the regular	interface should be used.
Chris PeBenito a996bd
##	

Chris PeBenito a996bd
## </desc>
Chris PeBenito a996bd
## <param name="domain">
Chris PeBenito a996bd
##	The type of the process performing this action.
Chris PeBenito a996bd
## </param>
Chris PeBenito a996bd
#
Chris PeBenito a996bd
interface(`nis_use_ypbind_uncond',`
Chris PeBenito a996bd
	gen_require(`
Chris PeBenito a996bd
		type var_yp_t;
Chris PeBenito a996bd
	')
Chris PeBenito a996bd
Chris PeBenito a996bd
	dontaudit $1 self:capability net_bind_service;
Chris PeBenito a996bd
Chris PeBenito a996bd
	allow $1 self:tcp_socket create_stream_socket_perms;
Chris PeBenito a996bd
	allow $1 self:udp_socket create_socket_perms;
Chris PeBenito a996bd
Chris PeBenito a996bd
	allow $1 var_yp_t:dir r_dir_perms;
Chris PeBenito a996bd
	allow $1 var_yp_t:lnk_file { getattr read };
Chris PeBenito a996bd
	allow $1 var_yp_t:file r_file_perms;
Chris PeBenito a996bd
Chris PeBenito a996bd
	corenet_tcp_sendrecv_all_if($1)
Chris PeBenito a996bd
	corenet_udp_sendrecv_all_if($1)
Chris PeBenito a996bd
	corenet_raw_sendrecv_all_if($1)
Chris PeBenito a996bd
	corenet_tcp_sendrecv_all_nodes($1)
Chris PeBenito a996bd
	corenet_udp_sendrecv_all_nodes($1)
Chris PeBenito a996bd
	corenet_raw_sendrecv_all_nodes($1)
Chris PeBenito a996bd
	corenet_tcp_sendrecv_all_ports($1)
Chris PeBenito a996bd
	corenet_udp_sendrecv_all_ports($1)
Chris PeBenito bd7037
	corenet_non_ipsec_sendrecv($1)
Chris PeBenito a996bd
	corenet_tcp_bind_all_nodes($1)
Chris PeBenito a996bd
	corenet_udp_bind_all_nodes($1)
Chris PeBenito a996bd
	corenet_tcp_bind_generic_port($1)
Chris PeBenito a996bd
	corenet_udp_bind_generic_port($1)
Chris PeBenito a996bd
	corenet_tcp_bind_reserved_port($1)
Chris PeBenito a996bd
	corenet_udp_bind_reserved_port($1)
Chris PeBenito a996bd
	corenet_dontaudit_tcp_bind_all_reserved_ports($1)
Chris PeBenito a996bd
	corenet_dontaudit_udp_bind_all_reserved_ports($1)
Chris PeBenito a996bd
	corenet_tcp_connect_portmap_port($1)
Chris PeBenito a996bd
	corenet_tcp_connect_reserved_port($1)
Chris PeBenito a996bd
	corenet_tcp_connect_generic_port($1)
Chris PeBenito a996bd
	corenet_dontaudit_tcp_connect_all_reserved_ports($1)
Chris PeBenito a996bd
Chris PeBenito a996bd
	sysnet_read_config($1)
Chris PeBenito a996bd
')
Chris PeBenito a996bd
Chris PeBenito a996bd
########################################
Chris PeBenito a996bd
## <summary>
Chris PeBenito 73fbc7
##	Use the ypbind service to access NIS services.
Chris PeBenito 73fbc7
## </summary>
Chris PeBenito 73fbc7
## <param name="domain">
Chris PeBenito 73fbc7
##	The type of the process performing this action.
Chris PeBenito 73fbc7
## </param>
Chris PeBenito 73fbc7
#
Chris PeBenito 73fbc7
interface(`nis_use_ypbind',`
Chris PeBenito 73fbc7
	gen_require(`
Chris PeBenito 73fbc7
		type var_yp_t;
Chris PeBenito 73fbc7
	')
Chris PeBenito 73fbc7
Chris PeBenito 73fbc7
	tunable_policy(`allow_ypbind',`
Chris PeBenito 73fbc7
		dontaudit $1 self:capability net_bind_service;
Chris PeBenito 73fbc7
Chris PeBenito 6e6156
		allow $1 self:tcp_socket create_stream_socket_perms;
Chris PeBenito 6e6156
		allow $1 self:udp_socket create_socket_perms;
Chris PeBenito 73fbc7
Chris PeBenito 73fbc7
		allow $1 var_yp_t:dir r_dir_perms;
Chris PeBenito 1f91e1
		allow $1 var_yp_t:lnk_file { getattr read };
Chris PeBenito 73fbc7
		allow $1 var_yp_t:file r_file_perms;
Chris PeBenito 73fbc7
Chris PeBenito 73fbc7
		corenet_tcp_sendrecv_all_if($1)
Chris PeBenito 73fbc7
		corenet_udp_sendrecv_all_if($1)
Chris PeBenito 73fbc7
		corenet_raw_sendrecv_all_if($1)
Chris PeBenito 73fbc7
		corenet_tcp_sendrecv_all_nodes($1)
Chris PeBenito 73fbc7
		corenet_udp_sendrecv_all_nodes($1)
Chris PeBenito 73fbc7
		corenet_raw_sendrecv_all_nodes($1)
Chris PeBenito 73fbc7
		corenet_tcp_sendrecv_all_ports($1)
Chris PeBenito 73fbc7
		corenet_udp_sendrecv_all_ports($1)
Chris PeBenito bd7037
		corenet_non_ipsec_sendrecv($1)
Chris PeBenito 98a8ea
		corenet_tcp_bind_all_nodes($1)
Chris PeBenito 98a8ea
		corenet_udp_bind_all_nodes($1)
Chris PeBenito 73fbc7
		corenet_tcp_bind_generic_port($1)
Chris PeBenito 73fbc7
		corenet_udp_bind_generic_port($1)
Chris PeBenito 73fbc7
		corenet_tcp_bind_reserved_port($1)
Chris PeBenito 73fbc7
		corenet_udp_bind_reserved_port($1)
Chris PeBenito 73fbc7
		corenet_dontaudit_tcp_bind_all_reserved_ports($1)
Chris PeBenito 73fbc7
		corenet_dontaudit_udp_bind_all_reserved_ports($1)
Chris PeBenito 98a8ea
		corenet_tcp_connect_portmap_port($1)
Chris PeBenito 98a8ea
		corenet_tcp_connect_reserved_port($1)
Chris PeBenito 98a8ea
		corenet_tcp_connect_generic_port($1)
Chris PeBenito 98a8ea
		corenet_dontaudit_tcp_connect_all_reserved_ports($1)
Chris PeBenito fa6757
Chris PeBenito fa6757
		sysnet_read_config($1)
Chris PeBenito b9ae3a
	',`
Chris PeBenito b9ae3a
		dontaudit $1 var_yp_t:dir search;
Chris PeBenito b9ae3a
	')
Chris PeBenito fa6757
Chris PeBenito 132880
	optional_policy(`mount',`
Chris PeBenito b9ae3a
		tunable_policy(`allow_ypbind',`
Chris PeBenito fa6757
			mount_send_nfs_client_request($1)
Chris PeBenito fa6757
		')
Chris PeBenito 73fbc7
	')
Chris PeBenito 73fbc7
')
Chris PeBenito 73fbc7
Chris PeBenito 73fbc7
########################################
Chris PeBenito 73fbc7
## <summary>
Chris PeBenito 9bbc75
##	Execute ypbind in the ypbind domain.
Chris PeBenito 9bbc75
## </summary>
Chris PeBenito 9bbc75
## <param name="domain">
Chris PeBenito 9bbc75
##	Domain allowed access.
Chris PeBenito 9bbc75
## </param>
Chris PeBenito 9bbc75
#
Chris PeBenito 9bbc75
interface(`nis_domtrans_ypbind',`
Chris PeBenito 9bbc75
	gen_require(`
Chris PeBenito 9bbc75
		type ypbind_t, ypbind_exec_t;
Chris PeBenito 9bbc75
	')
Chris PeBenito 9bbc75
Chris PeBenito 9bbc75
	corecmd_search_bin($1)
Chris PeBenito 9bbc75
	domain_auto_trans($1,ypbind_exec_t,ypbind_t)
Chris PeBenito 9bbc75
Chris PeBenito 9bbc75
	allow $1 ypbind_t:fd use;
Chris PeBenito 9bbc75
	allow ypbind_t $1:fd use;
Chris PeBenito 9bbc75
	allow ypbind_t $1:fifo_file rw_file_perms;
Chris PeBenito 9bbc75
	allow ypbind_t $1:process sigchld;
Chris PeBenito 9bbc75
')
Chris PeBenito 9bbc75
Chris PeBenito 9bbc75
########################################
Chris PeBenito 9bbc75
## <summary>
Chris PeBenito d8636f
##	Send generic signals to ypbind.
Chris PeBenito d8636f
## </summary>
Chris PeBenito d8636f
## <param name="domain">
Chris PeBenito d8636f
##	The type of the process performing this action.
Chris PeBenito d8636f
## </param>
Chris PeBenito d8636f
#
Chris PeBenito d8636f
interface(`nis_signal_ypbind',`
Chris PeBenito d8636f
	gen_require(`
Chris PeBenito d8636f
		type ypbind_t;
Chris PeBenito d8636f
	')
Chris PeBenito d8636f
Chris PeBenito d8636f
	allow $1 ypbind_t:process signal;
Chris PeBenito d8636f
')
Chris PeBenito d8636f
Chris PeBenito d8636f
########################################
Chris PeBenito d8636f
## <summary>
Chris PeBenito ad3b9d
##	List the contents of the NIS data directory.
Chris PeBenito 73fbc7
## </summary>
Chris PeBenito 73fbc7
## <param name="domain">
Chris PeBenito 73fbc7
##	The type of the process performing this action.
Chris PeBenito 73fbc7
## </param>
Chris PeBenito 73fbc7
#
Chris PeBenito 73fbc7
interface(`nis_list_var_yp',`
Chris PeBenito 73fbc7
	gen_require(`
Chris PeBenito d8636f
		type var_yp_t;
Chris PeBenito 73fbc7
	')
Chris PeBenito 73fbc7
Chris PeBenito 73fbc7
	files_search_var($1)
Chris PeBenito 73fbc7
	allow $1 var_yp_t:dir r_dir_perms;
Chris PeBenito 73fbc7
')
Chris PeBenito 73fbc7
Chris PeBenito 73fbc7
########################################
Chris PeBenito 73fbc7
## <summary>
Chris PeBenito 73fbc7
##	Send UDP network traffic to NIS clients.
Chris PeBenito 73fbc7
## </summary>
Chris PeBenito 73fbc7
## <param name="domain">
Chris PeBenito 73fbc7
##	The type of the process performing this action.
Chris PeBenito 73fbc7
## </param>
Chris PeBenito 73fbc7
#
Chris PeBenito 73fbc7
interface(`nis_udp_sendto_ypbind',`
Chris PeBenito 73fbc7
	gen_require(`
Chris PeBenito 73fbc7
		type ypbind_t;
Chris PeBenito 73fbc7
	')
Chris PeBenito 73fbc7
Chris PeBenito 73fbc7
	allow $1 ypbind_t:udp_socket sendto;
Chris PeBenito 73fbc7
	allow ypbind_t $1:udp_socket recvfrom;
Chris PeBenito 73fbc7
')
Chris PeBenito ad3b9d
Chris PeBenito ad3b9d
########################################
Chris PeBenito ad3b9d
## <summary>
Chris PeBenito ad3b9d
##	Connect to ypbind over TCP.
Chris PeBenito ad3b9d
## </summary>
Chris PeBenito ad3b9d
## <param name="domain">
Chris PeBenito ad3b9d
##	Domain allowed access.
Chris PeBenito ad3b9d
## </param>
Chris PeBenito ad3b9d
#
Chris PeBenito ad3b9d
interface(`nis_tcp_connect_ypbind',`
Chris PeBenito ad3b9d
	gen_require(`
Chris PeBenito ad3b9d
		type ypbind_t;
Chris PeBenito ad3b9d
	')
Chris PeBenito ad3b9d
Chris PeBenito ad3b9d
	allow $1 ypbind_t:tcp_socket { connectto recvfrom };
Chris PeBenito ad3b9d
	allow ypbind_t $1:tcp_socket { acceptfrom recvfrom };
Chris PeBenito 439aaa
	kernel_tcp_recvfrom($1)
Chris PeBenito ad3b9d
')
Chris PeBenito 725926
Chris PeBenito 725926
########################################
Chris PeBenito 725926
## <summary>
Chris PeBenito 725926
##	Read ypbind pid files.
Chris PeBenito 725926
## </summary>
Chris PeBenito 725926
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito 725926
## </param>
Chris PeBenito 725926
#
Chris PeBenito 725926
interface(`nis_read_ypbind_pid',`
Chris PeBenito 725926
	gen_require(`
Chris PeBenito cd6676
		type ypbind_var_run_t;
Chris PeBenito 725926
	')
Chris PeBenito 725926
Chris PeBenito 725926
	files_search_pids($1)
Chris PeBenito cd6676
	allow $1 ypbind_var_run_t:file r_file_perms;
Chris PeBenito 725926
')
Chris PeBenito 725926
Chris PeBenito 725926
########################################
Chris PeBenito 725926
## <summary>
Chris PeBenito 725926
##	Delete ypbind pid files.
Chris PeBenito 725926
## </summary>
Chris PeBenito 725926
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito 725926
## </param>
Chris PeBenito 725926
#
Chris PeBenito 725926
interface(`nis_delete_ypbind_pid',`
Chris PeBenito 725926
	gen_require(`
Chris PeBenito 725926
		type ypbind_t;
Chris PeBenito 725926
	')
Chris PeBenito 725926
Chris PeBenito 725926
	# TODO: add delete pid from dir call to files
Chris PeBenito 725926
	allow $1 ypbind_t:file unlink;
Chris PeBenito 725926
')
Chris PeBenito 725926
Chris PeBenito 725926
########################################
Chris PeBenito 725926
## <summary>
Chris PeBenito 725926
##	Read ypserv configuration files.
Chris PeBenito 725926
## </summary>
Chris PeBenito 725926
## <param name="domain">
Chris PeBenito 725926
##	Domain allowed access.
Chris PeBenito 725926
## </param>
Chris PeBenito 725926
#
Chris PeBenito 725926
interface(`nis_read_ypserv_config',`
Chris PeBenito 725926
	gen_require(`
Chris PeBenito 131e57
		type ypserv_conf_t;
Chris PeBenito 725926
	')
Chris PeBenito 725926
Chris PeBenito 725926
	files_search_etc($1)
Chris PeBenito 131e57
	allow $1 ypserv_conf_t:file { getattr read };
Chris PeBenito 725926
')