1ec3d1a
## <summary>Name service cache daemon</summary>
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Send generic signals to NSCD.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_signal',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 nscd_t:process signal;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Send NSCD the kill signal.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_kill',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 nscd_t:process sigkill;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Send signulls to NSCD.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_signull',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 nscd_t:process signull;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Execute NSCD in the nscd domain.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed to transition.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_domtrans',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_t, nscd_exec_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	corecmd_search_bin($1)
1ec3d1a
	domtrans_pattern($1, nscd_exec_t, nscd_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Allow the specified domain to execute nscd
1ec3d1a
##	in the caller domain.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_exec',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_exec_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	can_exec($1, nscd_exec_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Use NSCD services by connecting using
1ec3d1a
##	a unix stream socket.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_socket_use',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_t, nscd_var_run_t;
1ec3d1a
		class nscd { getserv getpwd getgrp gethost shmempwd shmemgrp shmemhost shmemserv };
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 self:unix_stream_socket create_socket_perms;
1ec3d1a
1ec3d1a
	allow $1 nscd_t:nscd { getpwd getgrp gethost };
1ec3d1a
	dontaudit $1 nscd_t:fd use;
1ec3d1a
	dontaudit $1 nscd_t:nscd { getserv shmempwd shmemgrp shmemhost shmemserv };
1ec3d1a
	files_search_pids($1)
1ec3d1a
	stream_connect_pattern($1, nscd_var_run_t, nscd_var_run_t, nscd_t)
1ec3d1a
	dontaudit $1 nscd_var_run_t:file read_file_perms;
1ec3d1a
	ps_process_pattern(nscd_t, $1)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Use nscd services
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_use',`
1ec3d1a
	tunable_policy(`nscd_use_shm',`
1ec3d1a
		nscd_shm_use($1)
1ec3d1a
	',`
1ec3d1a
		nscd_socket_use($1)
1ec3d1a
	')
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
b3c7e79
##	Do not audit attempts to write nscd sock files
b3c7e79
## </summary>
b3c7e79
## <param name="domain">
b3c7e79
##	<summary>
b3c7e79
##	Domain to not audit.
b3c7e79
##	</summary>
b3c7e79
## </param>
b3c7e79
#
b3c7e79
interface(`nscd_dontaudit_write_sock_file',`
b3c7e79
	gen_require(`
209aebd
		type nscd_t, nscd_var_run_t;
b3c7e79
	')
b3c7e79
b3c7e79
	dontaudit $1 nscd_t:sock_file write;
209aebd
	dontaudit $1 nscd_var_run_t:sock_file write;
209aebd
b3c7e79
')
b3c7e79
b3c7e79
########################################
b3c7e79
## <summary>
1ec3d1a
##	Use NSCD services by mapping the database from
1ec3d1a
##	an inherited NSCD file descriptor.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_shm_use',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_t, nscd_var_run_t;
1ec3d1a
		class nscd { getpwd getgrp gethost shmempwd shmemgrp shmemhost };
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 nscd_var_run_t:dir list_dir_perms;
1ec3d1a
	allow $1 nscd_t:nscd { shmempwd shmemgrp shmemhost };
1ec3d1a
1ec3d1a
	# Receive fd from nscd and map the backing file with read access.
1ec3d1a
	allow $1 nscd_t:fd use;
1ec3d1a
1ec3d1a
	# cjp: these were originally inherited from the
1ec3d1a
	# nscd_socket_domain macro. need to investigate
1ec3d1a
	# if they are all actually required
1ec3d1a
	allow $1 self:unix_stream_socket create_stream_socket_perms;
1ec3d1a
1ec3d1a
	# dg: This may not be required.
1ec3d1a
	allow $1 nscd_var_run_t:sock_file read_sock_file_perms;
1ec3d1a
1ec3d1a
	stream_connect_pattern($1, nscd_var_run_t, nscd_var_run_t, nscd_t)
1ec3d1a
	files_search_pids($1)
1ec3d1a
	allow $1 nscd_t:nscd { getpwd getgrp gethost };
1ec3d1a
	dontaudit $1 nscd_var_run_t:file read_file_perms;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Do not audit attempts to search the NSCD pid directory.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain to not audit.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_dontaudit_search_pid',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_var_run_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	dontaudit $1 nscd_var_run_t:dir search_dir_perms;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Read NSCD pid file.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_read_pid',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_var_run_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	files_search_pids($1)
1ec3d1a
	read_files_pattern($1, nscd_var_run_t, nscd_var_run_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Unconfined access to NSCD services.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_unconfined',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_t;
1ec3d1a
		class nscd all_nscd_perms;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 nscd_t:nscd *;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Execute nscd in the nscd domain, and
1ec3d1a
##	allow the specified role the nscd domain.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed to transition.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <param name="role">
1ec3d1a
##	<summary>
1ec3d1a
##	Role allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <rolecap/>
1ec3d1a
#
1ec3d1a
interface(`nscd_run',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	nscd_domtrans($1)
1ec3d1a
	role $2 types nscd_t;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Execute the nscd server init script.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed to transition.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_initrc_domtrans',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_initrc_exec_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	init_labeled_script_domtrans($1, nscd_initrc_exec_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Execute nscd server in the nscd domain.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed to transition.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`nscd_systemctl',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_unit_file_t;
1ec3d1a
		type nscd_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	systemd_exec_systemctl($1)
1ec3d1a
	allow $1 nscd_unit_file_t:file read_file_perms;
1ec3d1a
	allow $1 nscd_unit_file_t:service manage_service_perms;
1ec3d1a
1ec3d1a
	ps_process_pattern($1, nscd_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	All of the rules required to administrate 
1ec3d1a
##	an nscd environment
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <param name="role">
1ec3d1a
##	<summary>
1ec3d1a
##	The role to be allowed to manage the nscd domain.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <rolecap/>
1ec3d1a
#
1ec3d1a
interface(`nscd_admin',`
1ec3d1a
	gen_require(`
1ec3d1a
		type nscd_t, nscd_log_t, nscd_var_run_t;
1ec3d1a
		type nscd_initrc_exec_t;
1ec3d1a
		type nscd_unit_file_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 nscd_t:process signal_perms;
1ec3d1a
	ps_process_pattern($1, nscd_t)
1ec3d1a
	tunable_policy(`deny_ptrace',`',`
1ec3d1a
		allow $1 nscd_t:process ptrace;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	init_labeled_script_domtrans($1, nscd_initrc_exec_t)
1ec3d1a
	domain_system_change_exemption($1)
1ec3d1a
	role_transition $2 nscd_initrc_exec_t system_r;
1ec3d1a
	allow $2 system_r;
1ec3d1a
1ec3d1a
	logging_list_logs($1)
1ec3d1a
	admin_pattern($1, nscd_log_t)
1ec3d1a
1ec3d1a
	files_list_pids($1)
1ec3d1a
	admin_pattern($1, nscd_var_run_t)
1ec3d1a
1ec3d1a
	nscd_systemctl($1)
ee33a80
	admin_pattern($1, nscd_unit_file_t)
ee33a80
	allow $1 nscd_unit_file_t:service all_service_perms;
1ec3d1a
')