Chris PeBenito 31b7c0
#DESC Slapd - OpenLDAP server
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Author:  Russell Coker <russell@coker.com.au>
Chris PeBenito 31b7c0
# X-Debian-Packages: slapd
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#################################
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Rules for the slapd_t domain.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# slapd_exec_t is the type of the slapd executable.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
daemon_domain(slapd)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow slapd_t ldap_port_t:tcp_socket name_bind;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
etc_domain(slapd)
Chris PeBenito 31b7c0
type slapd_db_t, file_type, sysadmfile;
Chris PeBenito 31b7c0
type slapd_replog_t, file_type, sysadmfile;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
tmp_domain(slapd)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Use the network.
Chris PeBenito 31b7c0
can_network(slapd_t)
Chris PeBenito 31b7c0
allow slapd_t port_type:tcp_socket name_connect;
Chris PeBenito 31b7c0
can_ypbind(slapd_t)
Chris PeBenito 31b7c0
allow slapd_t self:fifo_file rw_file_perms;
Chris PeBenito 31b7c0
allow slapd_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 31b7c0
file_type_auto_trans(slapd_t,var_run_t,slapd_var_run_t,sock_file)
Chris PeBenito 31b7c0
allow slapd_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 31b7c0
# allow any domain to connect to the LDAP server
Chris PeBenito 31b7c0
can_tcp_connect(domain, slapd_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Use capabilities  should not need kill...
Chris PeBenito 31b7c0
allow slapd_t self:capability { kill setgid setuid net_bind_service net_raw dac_override dac_read_search };
Chris PeBenito 31b7c0
allow slapd_t self:process setsched;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow slapd_t proc_t:file r_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Allow access to the slapd databases
Chris PeBenito 31b7c0
create_dir_file(slapd_t, slapd_db_t)
Chris PeBenito 31b7c0
allow initrc_t slapd_db_t:dir r_dir_perms;
Chris PeBenito 31b7c0
allow slapd_t var_lib_t:dir r_dir_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Allow access to write the replication log (should tighten this)
Chris PeBenito 31b7c0
create_dir_file(slapd_t, slapd_replog_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# read config files
Chris PeBenito 31b7c0
allow slapd_t etc_t:{ file lnk_file } { getattr read };
Chris PeBenito 31b7c0
allow slapd_t etc_runtime_t:file { getattr read };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# for startup script
Chris PeBenito 31b7c0
allow initrc_t slapd_etc_t:file { getattr read };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow slapd_t etc_t:dir r_dir_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
read_sysctl(slapd_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow slapd_t usr_t:{ lnk_file file } { read getattr };
Chris PeBenito 31b7c0
allow slapd_t urandom_device_t:chr_file { getattr read ioctl };
Chris PeBenito 31b7c0
allow slapd_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 31b7c0
r_dir_file(slapd_t, cert_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
type slapd_cert_t, file_type, sysadmfile;
Chris PeBenito 31b7c0
allow slapd_t bin_t:dir search;
Chris PeBenito 31b7c0
can_exec(slapd_t, bin_t)
Chris PeBenito 31b7c0
r_dir_file(slapd_t, proc_net_t)
Chris PeBenito 31b7c0
allow slapd_t self:capability { chown sys_nice };
Chris PeBenito 31b7c0
allow slapd_t self:file { getattr read };
Chris PeBenito 31b7c0
allow slapd_t self:process { execstack getsched };
Chris PeBenito 31b7c0
allow slapd_t sysctl_net_t:dir r_dir_perms;
Chris PeBenito 31b7c0
lock_domain(slapd)
Chris PeBenito 31b7c0
create_dir_file(slapd_t, slapd_lock_t)
Chris PeBenito 31b7c0
dontaudit slapd_t devpts_t:dir search;
Chris PeBenito 31b7c0
rw_dir_create_file(slapd_t, slapd_cert_t)
Chris PeBenito 31b7c0
allow slapd_t usr_t:dir { add_name write };
Chris PeBenito 31b7c0
allow slapd_t usr_t:file { create write };