summaryrefslogtreecommitdiff
path: root/ldap/mkldapdb
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2008-09-16 14:35:52 +0200
committerJonas Smedegaard <dr@jones.dk>2008-09-16 14:35:52 +0200
commit65fa4c6f74141e00303f8db3d7fb6a130f85033e (patch)
tree75678feb03dc4293b56d479432ec5175922d6885 /ldap/mkldapdb
parenta5a0692af0038463fdf888cc55e1967b966d4b59 (diff)
Make slapd.conf from snippets, and more...
Diffstat (limited to 'ldap/mkldapdb')
-rwxr-xr-xldap/mkldapdb27
1 files changed, 19 insertions, 8 deletions
diff --git a/ldap/mkldapdb b/ldap/mkldapdb
index 833827a..697f7cd 100755
--- a/ldap/mkldapdb
+++ b/ldap/mkldapdb
@@ -23,16 +23,19 @@ for var in basedn dnsdomain orgname backend; do
fi
done
-confskel=/usr/share/slapd/slapd.conf
masterdir=/etc/local-COMMON/ldap/db
tempdir=`mktemp -dt slapd.XXXXXX`
-sed <"$confskel" >"$tempdir/slapd.conf" \
- -e "s/@BACKEND@/$backend/g" \
- -e "s/@SUFFIX@/$basedn/g" \
- -e "s/@ADMIN@/cn=admin,$basedn/g"
+snippets="$(LANG=C find "$masterdir" -type f -name '*.conf.in' | sort)"
+# concatenate files with an additional newline in between
+# (perl could replace sed too, but multiline perl inside shell is ugly)
+perl -e 'foreach (@ARGV) {print "\n" if $n; $n++; open (FH, $_); print while(<FH>); close FH;}' $snippets \
+ | sed >>"$tempdir/slapd.conf" \
+ -e "s/@BACKEND@/$backend/g" \
+ -e "s/@SUFFIX@/$basedn/g" \
+ -e "s/@ADMIN@/cn=admin,$basedn/g"
-for section in core base horde; do
+for section in core base cipux horde; do
sed <"$masterdir/$section.ldif.in" >"$tempdir/$section.ldif" \
-e "s/@SUFFIX@/$basedn/g" \
-e "s/@DOMAIN@/$dnsdomain/g" \
@@ -48,7 +51,15 @@ done
#slapadd -l "$tempdir/core.ldif"
#invoke-rc.d slapd start
#ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -w supersecretpassword "cn=admin,$basedn"
-for section in base horde; do
+for section in base cipux horde; do
ldapadd -x -h localhost -D "cn=admin,$basedn" -f "$tempdir/$section.ldif" -W
done
-ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -W "cn=horde,ou=DSA,$basedn"
+for section in cipux horde; do
+ ldappasswd -x -h localhost -D "cn=admin,$basedn" -S -W "uid=$section,ou=System,ou=Entities,ou=SAM,$basedn"
+done
+ldapmodify -x -h localhost -D "cn=admin,$basedn" -W <<EOF
+dn: cn=DSA,ou=Administrators,ou=Groups,ou=Access Control,$basedn
+changetype: modify
+add: uniqueMember
+uniqueMember: uid=cipux,ou=System,ou=Entities,ou=SAM,$basedn
+EOF