Openldap Basic Config common
Zur Navigation springen
Zur Suche springen
#!/bin/bash
PWD=$(slappasswd -s $3)
BASE="dc=$1,dc=$2"
ADM="cn=admin,$BASE"
systemctl stop slapd
rm -r /var/lib/ldap/*
systemctl start slapd
echo base config
ldapmodify -Y EXTERNAL -H ldapi:/// <<HERE
dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: $BASE
-
replace: olcRootDN
olcRootDN: $ADM
-
replace: olcRootPW
olcRootPW: $PWD
HERE
echo base config database
ldapadd -x -D $ADM -w $3 <<HERE
dn: $BASE
objectClass: top
objectClass: dcObject
objectclass: organization
o: $1
dc: $1
dn: cn=admin,$BASE
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userpassword: $PWD
HERE