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