Chris PeBenito 43989f
## <summary>Remote Procedure Call Daemon for managment of network based process communication</summary>
Chris PeBenito 43989f
Chris PeBenito 43989f
#######################################
Chris PeBenito 43989f
## <summary>
Chris PeBenito 43989f
##	The template to define a rpc domain.
Chris PeBenito 43989f
## </summary>
Chris PeBenito 43989f
## <desc>
Chris PeBenito 43989f
##	

Chris PeBenito 43989f
##	This template creates a domain to be used for
Chris PeBenito 43989f
##	a new rpc daemon.
Chris PeBenito 43989f
##	

Chris PeBenito 43989f
## </desc>
Chris PeBenito 43989f
## <param name="userdomain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 43989f
##	The type of daemon to be used.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 43989f
## </param>
Chris PeBenito 43989f
#
Chris PeBenito 43989f
template(`rpc_domain_template', `
Chris PeBenito 43989f
	########################################
Chris PeBenito 43989f
	#
Chris PeBenito 43989f
	# Declarations
Chris PeBenito 43989f
	#
Chris PeBenito 43989f
Chris PeBenito 43989f
	type $1_t;
Chris PeBenito 43989f
	type $1_exec_t;
Chris PeBenito 43989f
	init_daemon_domain($1_t,$1_exec_t)
Chris PeBenito 15722e
	domain_use_interactive_fds($1_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	####################################
Chris PeBenito 43989f
	#
Chris PeBenito 43989f
	# Local Policy
Chris PeBenito 43989f
	#
Chris PeBenito 43989f
Chris PeBenito 43989f
	dontaudit $1_t self:capability { net_admin sys_tty_config };
Chris PeBenito 43989f
	allow $1_t self:capability net_bind_service;
Chris PeBenito 43989f
	allow $1_t self:process signal_perms;
Chris PeBenito 43989f
	allow $1_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 43989f
	allow $1_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 43989f
	allow $1_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 43989f
	allow $1_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 43989f
	allow $1_t self:udp_socket create_socket_perms;
Chris PeBenito 43989f
Chris PeBenito 43989f
	allow $1_t var_lib_nfs_t:dir create_dir_perms;
Chris PeBenito 43989f
	allow $1_t var_lib_nfs_t:file create_file_perms;
Chris PeBenito 43989f
Chris PeBenito 43989f
	kernel_list_proc($1_t)
Chris PeBenito 43989f
	kernel_read_proc_symlinks($1_t)
Chris PeBenito 445522
	kernel_read_kernel_sysctls($1_t)
Chris PeBenito 43989f
	# bind to arbitary unused ports
Chris PeBenito 445522
	kernel_rw_rpc_sysctls($1_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	dev_read_sysfs($1_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	corenet_tcp_sendrecv_all_if($1_t)
Chris PeBenito 43989f
	corenet_udp_sendrecv_all_if($1_t)
Chris PeBenito 43989f
	corenet_raw_sendrecv_all_if($1_t)
Chris PeBenito 43989f
	corenet_tcp_sendrecv_all_nodes($1_t)
Chris PeBenito 43989f
	corenet_udp_sendrecv_all_nodes($1_t)
Chris PeBenito 43989f
	corenet_raw_sendrecv_all_nodes($1_t)
Chris PeBenito 43989f
	corenet_tcp_sendrecv_all_ports($1_t)
Chris PeBenito 43989f
	corenet_udp_sendrecv_all_ports($1_t)
Chris PeBenito bd7037
	corenet_non_ipsec_sendrecv($1_t)
Chris PeBenito 43989f
	corenet_tcp_bind_all_nodes($1_t)
Chris PeBenito 43989f
	corenet_udp_bind_all_nodes($1_t)
Chris PeBenito 43989f
	corenet_tcp_bind_reserved_port($1_t)
Chris PeBenito 43989f
	corenet_tcp_bind_reserved_port($1_t)
Chris PeBenito 43989f
	corenet_tcp_connect_all_ports($1_t)
Chris PeBenito 43989f
	# do not log when it tries to bind to a port belonging to another domain
Chris PeBenito 43989f
	corenet_dontaudit_tcp_bind_all_reserved_ports($1_t)
Chris PeBenito 43989f
	corenet_dontaudit_udp_bind_all_reserved_ports($1_t)
Chris PeBenito 43989f
	# bind to arbitary unused ports
Chris PeBenito 43989f
	corenet_tcp_bind_generic_port($1_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	fs_search_auto_mountpoints($1_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	term_dontaudit_use_console($1_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	files_read_etc_files($1_t)
Chris PeBenito 43989f
	files_read_etc_runtime_files($1_t)
Chris PeBenito 43989f
	files_search_var($1_t)
Chris PeBenito 9e04f5
	files_search_var_lib($1_t)
Chris PeBenito 43989f
Chris PeBenito 1c1ac6
	init_use_fds($1_t)
Chris PeBenito 1815ba
	init_use_script_ptys($1_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	libs_use_ld_so($1_t)
Chris PeBenito 43989f
	libs_use_shared_libs($1_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	logging_send_syslog_msg($1_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	miscfiles_read_localization($1_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	sysnet_read_config($1_t)
Chris PeBenito 43989f
Chris PeBenito 15722e
	userdom_dontaudit_use_unpriv_user_fds($1_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	ifdef(`targeted_policy',`
Chris PeBenito 1815ba
		term_dontaudit_use_unallocated_ttys($1_t)
Chris PeBenito 1815ba
		term_dontaudit_use_generic_ptys($1_t)
Chris PeBenito 9e04f5
		files_dontaudit_read_root_files($1_t)
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 132880
	optional_policy(`mount',`
Chris PeBenito 43989f
		mount_send_nfs_client_request($1_t)
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 132880
	optional_policy(`nis',`
Chris PeBenito 43989f
		nis_use_ypbind($1_t)
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 132880
	optional_policy(`selinuxutil',`
Chris PeBenito 43989f
		seutil_sigchld_newrole($1_t)
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 132880
	optional_policy(`udev',`
Chris PeBenito 43989f
		udev_read_db($1_t)
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
')
Chris PeBenito 43989f
Chris PeBenito 43989f
########################################
Chris PeBenito 43989f
## <summary>
Chris PeBenito 43989f
##      Send UDP network traffic to rpc and recieve UDP traffic from rpc.
Chris PeBenito 43989f
## </summary>
Chris PeBenito 43989f
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 43989f
##      The type of the process performing this action.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 43989f
## </param>
Chris PeBenito 43989f
#
Chris PeBenito 1815ba
interface(`rpc_udp_send',`
Chris PeBenito 43989f
	gen_require(`
Chris PeBenito 43989f
		type rpc_t;
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 43989f
	allow $1 rpc_t:udp_socket sendto;
Chris PeBenito 43989f
	allow rpc_t $1:udp_socket recvfrom;
Chris PeBenito 43989f
')
Chris PeBenito 43989f
Chris PeBenito 43989f
########################################
Chris PeBenito 43989f
## <summary>
Chris PeBenito f00434
##      Do not audit attempts to get the attributes
Chris PeBenito f00434
##	of the NFS export file.
Chris PeBenito f00434
## </summary>
Chris PeBenito f00434
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito f00434
##      The type of the process performing this action.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito f00434
## </param>
Chris PeBenito f00434
#
Chris PeBenito f00434
interface(`rpc_dontaudit_getattr_exports',`
Chris PeBenito f00434
	gen_require(`
Chris PeBenito f00434
		type exports_t;
Chris PeBenito f00434
	')
Chris PeBenito f00434
Chris PeBenito f00434
	dontaudit $1 exports_t:file getattr;
Chris PeBenito f00434
')
Chris PeBenito f00434
Chris PeBenito f00434
########################################
Chris PeBenito f00434
## <summary>
Chris PeBenito 43989f
##      Allow read access to exports.
Chris PeBenito 43989f
## </summary>
Chris PeBenito 43989f
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 43989f
##      The type of the process performing this action.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 43989f
## </param>
Chris PeBenito 43989f
#
Chris PeBenito 43989f
interface(`rpc_read_exports',`
Chris PeBenito 43989f
	gen_require(`
Chris PeBenito 43989f
		type exports_t;
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 43989f
	allow $1 exports_t:file r_file_perms;
Chris PeBenito 43989f
')
Chris PeBenito 43989f
Chris PeBenito 43989f
########################################
Chris PeBenito 43989f
## <summary>
Chris PeBenito 43989f
##      Allow write access to exports.
Chris PeBenito 43989f
## </summary>
Chris PeBenito 43989f
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 43989f
##      The type of the process performing this action.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 43989f
## </param>
Chris PeBenito 43989f
#
Chris PeBenito 43989f
interface(`rpc_write_exports',`
Chris PeBenito 43989f
	gen_require(`
Chris PeBenito 43989f
		type exports_t;
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 43989f
	allow $1 exports_t:file write;
Chris PeBenito 43989f
')
Chris PeBenito 43989f
Chris PeBenito 43989f
########################################
Chris PeBenito 43989f
## <summary>
Chris PeBenito 43989f
##      Execute domain in nfsd domain.
Chris PeBenito 43989f
## </summary>
Chris PeBenito 43989f
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 43989f
##      The type of the process performing this action.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 43989f
## </param>
Chris PeBenito 43989f
#
Chris PeBenito 43989f
interface(`rpc_domtrans_nfsd',`
Chris PeBenito 43989f
	gen_require(`
Chris PeBenito 43989f
		type nfsd_t, nfsd_exec_t;
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 43989f
	domain_auto_trans($1,nfsd_exec_t,nfsd_t)
Chris PeBenito 43989f
Chris PeBenito 43989f
	allow $1 nfsd_t:fd use;
Chris PeBenito 43989f
	allow nfsd_t $1:fd use;
Chris PeBenito 43989f
	allow nfsd_t $1:fifo_file rw_file_perms;
Chris PeBenito 43989f
	allow nfsd_t $1:process sigchld;
Chris PeBenito 43989f
')
Chris PeBenito 43989f
Chris PeBenito 43989f
########################################
Chris PeBenito 43989f
## <summary>
Chris PeBenito 43989f
##      Allow domain to create read and write NFS directories.
Chris PeBenito 43989f
## </summary>
Chris PeBenito 43989f
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 43989f
##      Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 43989f
## </param>
Chris PeBenito 43989f
#
Chris PeBenito 43989f
interface(`rpc_manage_nfs_rw_content',`
Chris PeBenito 43989f
	gen_require(`
Chris PeBenito 43989f
		type nfsd_rw_t;	
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 43989f
	allow $1 nfsd_rw_t:dir manage_dir_perms;
Chris PeBenito 43989f
	allow $1 nfsd_rw_t:file manage_file_perms;
Chris PeBenito 43989f
	allow $1 nfsd_rw_t:lnk_file create_lnk_perms;
Chris PeBenito 43989f
')
Chris PeBenito 43989f
Chris PeBenito 43989f
########################################
Chris PeBenito 43989f
## <summary>
Chris PeBenito 43989f
##      Allow domain to create read and write NFS directories.
Chris PeBenito 43989f
## </summary>
Chris PeBenito 43989f
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 43989f
##      Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 43989f
## </param>
Chris PeBenito 43989f
#
Chris PeBenito 43989f
interface(`rpc_manage_nfs_ro_content',`
Chris PeBenito 43989f
	gen_require(`
Chris PeBenito 43989f
		type nfsd_ro_t;	
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 43989f
	allow $1 nfsd_ro_t:dir manage_dir_perms;
Chris PeBenito 43989f
	allow $1 nfsd_ro_t:file manage_file_perms;
Chris PeBenito 43989f
	allow $1 nfsd_ro_t:lnk_file create_lnk_perms;
Chris PeBenito 43989f
')
Chris PeBenito 43989f
Chris PeBenito 43989f
########################################
Chris PeBenito 43989f
## <summary>
Chris PeBenito 43989f
##      Allow domain to read and write to an NFS UDP socket.
Chris PeBenito 43989f
## </summary>
Chris PeBenito 43989f
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 43989f
##      Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 43989f
## </param>
Chris PeBenito 43989f
#
Chris PeBenito 43989f
interface(`rpc_udp_rw_nfs_sockets',`
Chris PeBenito 43989f
	gen_require(`
Chris PeBenito 43989f
		type nfsd_t;	
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 43989f
	allow $1 nfsd_t:udp_socket rw_socket_perms;
Chris PeBenito 43989f
Chris PeBenito 43989f
')
Chris PeBenito 43989f
Chris PeBenito 43989f
########################################
Chris PeBenito 43989f
## <summary>
Chris PeBenito 18cc01
##	Send UDP traffic to NFSd.
Chris PeBenito 43989f
## </summary>
Chris PeBenito 43989f
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 18cc01
##      Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 43989f
## </param>
Chris PeBenito 43989f
#
Chris PeBenito 1815ba
interface(`rpc_udp_send_nfs',`
Chris PeBenito 43989f
	gen_require(`
Chris PeBenito 43989f
		type nfsd_t;
Chris PeBenito 43989f
	')
Chris PeBenito 43989f
Chris PeBenito 18cc01
	allow $1 nfsd_t:udp_socket sendto;
Chris PeBenito 18cc01
	allow nfsd_t $1:udp_socket recvfrom;
Chris PeBenito 43989f
')
Chris PeBenito 6f81e1
Chris PeBenito 6f81e1
########################################
Chris PeBenito 6f81e1
## <summary>
Chris PeBenito 6f81e1
##	Search NFS state data in /var/lib/nfs.
Chris PeBenito 6f81e1
## </summary>
Chris PeBenito 6f81e1
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 6f81e1
##      Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 6f81e1
## </param>
Chris PeBenito 6f81e1
#
Chris PeBenito 6f81e1
interface(`rpc_search_nfs_state_data',`
Chris PeBenito 6f81e1
	gen_require(`
Chris PeBenito 6f81e1
		type var_lib_nfs_t;
Chris PeBenito 6f81e1
	')
Chris PeBenito 6f81e1
Chris PeBenito 6f81e1
	files_search_var_lib($1)
Chris PeBenito 6f81e1
	allow $1 var_lib_nfs_t:dir search;
Chris PeBenito 6f81e1
')