1
|
#!/bin/sh
|
2
|
# Do initial configuration of slapd
|
3
|
|
4
|
set -e
|
5
|
|
6
|
BASEDIR=`dirname $0`
|
7
|
|
8
|
service slapd stop || true
|
9
|
BACKUPDIR="/var/backup/reset-ldap-`date +%Y%m%dT%H:%M:%S`"
|
10
|
mkdir -p "$BACKUPDIR"
|
11
|
echo Old configuration saved in $BACKUPDIR
|
12
|
cp -R /var/lib/ldap /etc/ldap/slapd.d/ "$BACKUPDIR"
|
13
|
rm -rf /var/lib/ldap/* /etc/ldap/slapd.d/*
|
14
|
mkdir /var/lib/ldap/config-accesslog/
|
15
|
|
16
|
echo Load overlay modules, configure auditlog for cn=config, create cn=monitor db
|
17
|
slapadd -n0 -F/etc/ldap/slapd.d -l"$BASEDIR/config.ldif"
|
18
|
slapadd -n0 -F/etc/ldap/slapd.d -l"/etc/ldap/schema/core.ldif"
|
19
|
slapadd -n0 -F/etc/ldap/slapd.d -l"/etc/ldap/schema/cosine.ldif"
|
20
|
slapadd -n0 -F/etc/ldap/slapd.d -l"/etc/ldap/schema/inetorgperson.ldif"
|
21
|
slapadd -n0 -F/etc/ldap/slapd.d -l"$BASEDIR/radius.ldif"
|
22
|
|
23
|
chown -R openldap.openldap /etc/ldap/slapd.d /var/lib/ldap
|
24
|
|
25
|
service slapd start
|