#!/bin/sh -e # Source functions library . /etc/chroot.d/functions cd /var/lib/ldap force= if [ "$1" = "force" ]; then force=-f shift rm -f etc/schema/* fi # Usual configs for f in `cd /etc/openldap; ls *slapd*.conf` rootdse.ldif ldap.keytab; do Copy -m640 -oldap -gldap $force "/etc/openldap/$f" "etc/$f" || continue done # for GSS-API support Copy -gldap -m640 $force /etc/krb5.conf etc/krb5.conf [ -d /var/lib/ldap/var/tmp ] || install -gldap -oldap -d /var/lib/ldap/var/tmp #for f in `ls /etc/openldap/schema/`; do # Copy -m644 $force "/etc/openldap/schema/$f" "etc/schema/$f" #done #This is temp! Only for temp cd /etc/openldap tar -pPc schema | tar -xp -C /var/lib/ldap/etc/ cd /var/lib/ldap # Wee need to think about this! for f in `ls /etc/openldap/ssl/`; do Copy -m644 $force "/etc/openldap/ssl/$f" "etc/ssl/$f" done # Now copy ssl certs in The Right Way(tm) for f in /var/lib/ssl/cert.pem /var/lib/ssl/certs/* /var/lib/ssl/private/slapd.*; do [ -f "$f" ] || continue d="${f%/*}" install -d -m755 -oroot -groot ".$d" Copy -m644 $force "$f" ".$f" rf="$(readlink -ne "$f")" [ "$f" != "$rf" ] || continue d="${rf%/*}" install -d -m755 -oroot -groot ".$d" Copy -m644 $force "$rf" ".$rf" done grep ldap /etc/group > etc/group grep ldap /etc/passwd > etc/passwd # create direcrory for each configured LDAP database awk '/^directory/ {sub(/\//,"",$2);print $2}' /etc/openldap/*slapd*.conf \ | xargs install -d -o ldap -g ldap -m 0700 # install and adjust default BDB config file for d in `awk '/^directory/ {sub(/\//,"",$2);print $2}' /etc/openldap/*slapd*.conf`; do if [ ! -f $d/DB_CONFIG ]; then install -o root -g ldap -m 0644 bases/DB_CONFIG $d/DB_CONFIG LG_DIR=`basename $d` subst "s|#set_lg_dir /var/lib/ldap/dblogs|set_lg_dir /var/lib/ldap/dblogs/$LG_DIR|" $d/DB_CONFIG fi done # create transactions log directory for each configured LDAP database awk '/^directory/ {sub(/\//,"",$2);print $2}' /etc/openldap/*slapd*.conf | sed 's|ldap/bases|ldap/dblogs|' \ | xargs install -d -o ldap -g ldap -m 0700 copy_resolv_conf