policy_module(nslcd)

########################################
#
# Declarations
#

type nslcd_t;
type nslcd_exec_t;
init_daemon_domain(nslcd_t, nslcd_exec_t)

type nslcd_conf_t;
files_config_file(nslcd_conf_t)

type nslcd_initrc_exec_t;
init_script_file(nslcd_initrc_exec_t)

type nslcd_runtime_t alias nslcd_var_run_t;
files_runtime_file(nslcd_runtime_t)

########################################
#
# Local policy
#

allow nslcd_t self:capability { dac_override setgid setuid };
allow nslcd_t self:process signal;
allow nslcd_t self:unix_stream_socket { accept listen };

allow nslcd_t nslcd_conf_t:file read_file_perms;

manage_dirs_pattern(nslcd_t, nslcd_runtime_t, nslcd_runtime_t)
manage_files_pattern(nslcd_t, nslcd_runtime_t, nslcd_runtime_t)
manage_sock_files_pattern(nslcd_t, nslcd_runtime_t, nslcd_runtime_t)
files_runtime_filetrans(nslcd_t, nslcd_runtime_t, { file dir })

kernel_read_system_state(nslcd_t)

corenet_all_recvfrom_netlabel(nslcd_t)
corenet_tcp_sendrecv_generic_if(nslcd_t)
corenet_tcp_sendrecv_generic_node(nslcd_t)

corenet_sendrecv_ldap_client_packets(nslcd_t)
corenet_tcp_connect_ldap_port(nslcd_t)

dev_read_sysfs(nslcd_t)

files_read_usr_symlinks(nslcd_t)
files_list_tmp(nslcd_t)

auth_use_nsswitch(nslcd_t)

logging_send_syslog_msg(nslcd_t)

miscfiles_read_localization(nslcd_t)

userdom_read_user_tmp_files(nslcd_t)

optional_policy(`
	ldap_stream_connect(nslcd_t)
')
