Chris PeBenito 0fbfa5
#DESC NSCD - Name service cache daemon cache lookup of user-name
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Author:  Russell Coker <russell@coker.com.au>
Chris PeBenito 0fbfa5
# X-Debian-Packages: nscd
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
define(`nscd_socket_domain', `
Chris PeBenito 0fbfa5
can_unix_connect($1, nscd_t)
Chris PeBenito 0fbfa5
allow $1 nscd_var_run_t:sock_file rw_file_perms;
Chris PeBenito 0fbfa5
allow $1 { var_run_t var_t }:dir search;
Chris PeBenito 0fbfa5
allow $1 nscd_t:nscd { getpwd getgrp gethost };
Chris PeBenito 0fbfa5
dontaudit $1 nscd_t:fd use;
Chris PeBenito 0fbfa5
dontaudit $1 nscd_var_run_t:dir { search getattr };
Chris PeBenito 0fbfa5
dontaudit $1 nscd_var_run_t:file { getattr read };
Chris PeBenito 0fbfa5
dontaudit $1 nscd_t:nscd { shmempwd shmemgrp shmemhost };
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
#################################
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Rules for the nscd_t domain.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# nscd is both the client program and the daemon.
Chris PeBenito 0fbfa5
daemon_domain(nscd, `, userspace_objmgr')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow nscd_t etc_t:file r_file_perms;
Chris PeBenito 0fbfa5
allow nscd_t etc_t:lnk_file read;
Chris PeBenito 0fbfa5
can_network_client(nscd_t)
Chris PeBenito 0fbfa5
can_ypbind(nscd_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
file_type_auto_trans(nscd_t, var_run_t, nscd_var_run_t, sock_file)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow nscd_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
nscd_socket_domain(nscd_client_domain)
Chris PeBenito 0fbfa5
nscd_socket_domain(daemon)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Clients that are allowed to map the database via a fd obtained from nscd.
Chris PeBenito 0fbfa5
nscd_socket_domain(nscd_shmem_domain)
Chris PeBenito 0fbfa5
allow nscd_shmem_domain nscd_var_run_t:dir r_dir_perms;
Chris PeBenito 0fbfa5
allow nscd_shmem_domain nscd_t:nscd { shmempwd shmemgrp shmemhost };
Chris PeBenito 0fbfa5
# Receive fd from nscd and map the backing file with read access.
Chris PeBenito 0fbfa5
allow nscd_shmem_domain nscd_t:fd use;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# For client program operation, invoked from sysadm_t.
Chris PeBenito 0fbfa5
# Transition occurs to nscd_t due to direct_sysadm_daemon. 
Chris PeBenito 0fbfa5
allow nscd_t self:nscd { admin getstat };
Chris PeBenito 0fbfa5
allow nscd_t admin_tty_type:chr_file rw_file_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
read_sysctl(nscd_t)
Chris PeBenito 0fbfa5
allow nscd_t self:process { getattr setsched };
Chris PeBenito 0fbfa5
allow nscd_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 0fbfa5
allow nscd_t self:fifo_file { read write };
Chris PeBenito 0fbfa5
allow nscd_t self:capability { kill setgid setuid net_bind_service };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# for when /etc/passwd has just been updated and has the wrong type
Chris PeBenito 0fbfa5
allow nscd_t shadow_t:file getattr;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
dontaudit nscd_t sysadm_home_dir_t:dir search;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
ifdef(`winbind.te', `
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Handle winbind for samba, Might only be needed for targeted policy
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
allow nscd_t winbind_var_run_t:sock_file { read write getattr };
Chris PeBenito 0fbfa5
can_unix_connect(nscd_t, winbind_t)
Chris PeBenito 0fbfa5
allow nscd_t samba_var_t:dir search;
Chris PeBenito 0fbfa5
allow nscd_t winbind_var_run_t:dir { getattr search };
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
r_dir_file(nscd_t, selinux_config_t)
Chris PeBenito 0fbfa5
can_getsecurity(nscd_t)
Chris PeBenito 0fbfa5
allow nscd_t self:netlink_selinux_socket create_socket_perms;
Chris PeBenito 0fbfa5
allow nscd_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 0fbfa5
allow nscd_t tmp_t:dir { search getattr };
Chris PeBenito 0fbfa5
allow nscd_t tmp_t:lnk_file read;
Chris PeBenito 0fbfa5
allow nscd_t { urandom_device_t random_device_t }:chr_file { getattr read };