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