Chris PeBenito 493d6c
Chris PeBenito 493d6c
policy_module(nscd,1.0)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
########################################
Chris PeBenito 493d6c
#
Chris PeBenito 493d6c
# Declarations
Chris PeBenito 493d6c
#
Chris PeBenito 493d6c
Chris PeBenito 493d6c
# nscd is both the client program and the daemon.
Chris PeBenito 763a5e
type nscd_t;
Chris PeBenito 493d6c
type nscd_exec_t;
Chris PeBenito 493d6c
init_daemon_domain(nscd_t,nscd_exec_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
type nscd_var_run_t;
Chris PeBenito 493d6c
files_pid_file(nscd_var_run_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
########################################
Chris PeBenito 493d6c
#
Chris PeBenito 493d6c
# Local policy
Chris PeBenito 493d6c
#
Chris PeBenito 493d6c
Chris PeBenito 493d6c
allow nscd_t self:capability { kill setgid setuid };
Chris PeBenito 493d6c
dontaudit nscd_t self:capability sys_tty_config;
Chris PeBenito 493d6c
allow nscd_t self:process { getattr setsched };
Chris PeBenito 763a5e
allow nscd_t self:fifo_file { read write };
Chris PeBenito 493d6c
allow nscd_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 493d6c
allow nscd_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 493d6c
allow nscd_t self:netlink_selinux_socket create_socket_perms;
Chris PeBenito 493d6c
allow nscd_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 493d6c
allow nscd_t self:tcp_socket create_socket_perms;
Chris PeBenito 763a5e
allow nscd_t self:udp_socket create_socket_perms;
Chris PeBenito 493d6c
Chris PeBenito 493d6c
# For client program operation, invoked from sysadm_t.
Chris PeBenito 493d6c
# Transition occurs to nscd_t due to direct_sysadm_daemon. 
Chris PeBenito 493d6c
# cjp: this should probably be in a direct_sysadm_daemon tunable
Chris PeBenito 493d6c
allow nscd_t self:nscd { admin getstat };
Chris PeBenito 493d6c
Chris PeBenito 493d6c
allow nscd_t nscd_var_run_t:file create_file_perms;
Chris PeBenito 493d6c
allow nscd_t nscd_var_run_t:sock_file create_file_perms;
Chris PeBenito 689f6d
files_create_pid(nscd_t,nscd_var_run_t,{ file sock_file })
Chris PeBenito 493d6c
Chris PeBenito 493d6c
kernel_read_kernel_sysctl(nscd_t)
Chris PeBenito 493d6c
kernel_list_proc(nscd_t)
Chris PeBenito 493d6c
kernel_read_proc_symlinks(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
dev_read_sysfs(nscd_t)
Chris PeBenito 493d6c
dev_read_rand(nscd_t)
Chris PeBenito 493d6c
dev_read_urand(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
fs_getattr_all_fs(nscd_t)
Chris PeBenito 493d6c
fs_search_auto_mountpoints(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
term_dontaudit_use_console(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
# for when /etc/passwd has just been updated and has the wrong type
Chris PeBenito 493d6c
auth_getattr_shadow(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
corenet_tcp_sendrecv_all_if(nscd_t)
Chris PeBenito 493d6c
corenet_udp_sendrecv_all_if(nscd_t)
Chris PeBenito 493d6c
corenet_raw_sendrecv_all_if(nscd_t)
Chris PeBenito 493d6c
corenet_tcp_sendrecv_all_nodes(nscd_t)
Chris PeBenito 493d6c
corenet_udp_sendrecv_all_nodes(nscd_t)
Chris PeBenito 493d6c
corenet_raw_sendrecv_all_nodes(nscd_t)
Chris PeBenito 493d6c
corenet_tcp_sendrecv_all_ports(nscd_t)
Chris PeBenito 493d6c
corenet_udp_sendrecv_all_ports(nscd_t)
Chris PeBenito 493d6c
corenet_tcp_bind_all_nodes(nscd_t)
Chris PeBenito 493d6c
corenet_udp_bind_all_nodes(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 763a5e
selinux_get_fs_mount(nscd_t)
Chris PeBenito 763a5e
selinux_validate_context(nscd_t)
Chris PeBenito 763a5e
selinux_compute_access_vector(nscd_t)
Chris PeBenito 763a5e
selinux_compute_create_context(nscd_t)
Chris PeBenito 763a5e
selinux_compute_relabel_context(nscd_t)
Chris PeBenito 763a5e
selinux_compute_user_contexts(nscd_t)
Chris PeBenito 493d6c
domain_use_wide_inherit_fd(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
files_read_etc_files(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
init_use_fd(nscd_t)
Chris PeBenito 493d6c
init_use_script_pty(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
libs_use_ld_so(nscd_t)
Chris PeBenito 493d6c
libs_use_shared_libs(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
logging_send_syslog_msg(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
miscfiles_read_localization(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 763a5e
seutil_read_config(nscd_t)
Chris PeBenito 763a5e
seutil_read_default_contexts(nscd_t)
Chris PeBenito 763a5e
seutil_sigchld_newrole(nscd_t)
Chris PeBenito 763a5e
Chris PeBenito 493d6c
sysnet_read_config(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
userdom_dontaudit_use_unpriv_user_fd(nscd_t)
Chris PeBenito 493d6c
userdom_dontaudit_search_sysadm_home_dir(nscd_t)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
ifdef(`targeted_policy', `
Chris PeBenito 493d6c
	term_dontaudit_use_unallocated_tty(nscd_t)
Chris PeBenito 493d6c
	term_dontaudit_use_generic_pty(nscd_t)
Chris PeBenito 493d6c
	files_dontaudit_read_root_file(nscd_t)
Chris PeBenito 493d6c
')
Chris PeBenito 493d6c
Chris PeBenito 493d6c
optional_policy(`nis.te',`
Chris PeBenito 493d6c
	nis_use_ypbind(nscd_t)
Chris PeBenito 493d6c
')
Chris PeBenito 493d6c
Chris PeBenito 493d6c
optional_policy(`udev.te', `
Chris PeBenito 493d6c
	udev_read_db(nscd_t)
Chris PeBenito 493d6c
')
Chris PeBenito 493d6c
Chris PeBenito 493d6c
ifdef(`TODO',`
Chris PeBenito 493d6c
nscd_socket_domain(daemon)
Chris PeBenito 493d6c
Chris PeBenito 493d6c
optional_policy(`winbind.te', `
Chris PeBenito 493d6c
	# Handle winbind for samba, Might only be needed for targeted policy
Chris PeBenito 493d6c
Chris PeBenito 493d6c
	allow nscd_t winbind_var_run_t:sock_file { read write getattr };
Chris PeBenito 493d6c
	can_unix_connect(nscd_t, winbind_t)
Chris PeBenito 493d6c
	allow nscd_t samba_var_t:dir search;
Chris PeBenito 493d6c
	allow nscd_t winbind_var_run_t:dir { getattr search };
Chris PeBenito 493d6c
')
Chris PeBenito c0d156
optional_policy(`rhgb.te',`
Chris PeBenito c0d156
	rhgb_domain(nscd_t)
Chris PeBenito c0d156
')
Chris PeBenito 493d6c
allow nscd_t tmp_t:dir { search getattr };
Chris PeBenito 493d6c
allow nscd_t tmp_t:lnk_file read;
Chris PeBenito 493d6c
') dnl end TODO