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