ldifs/30.root.ldif.sh

38 lines
788 B
Bash
Executable file

#!/bin/sh -e
basedn=$(cat basedn)
_x=${basedn%%,*}
dc=${_x#*=}
pw=`pwgen 8 1`
echo "# Password for cn=root,$basedn: $pw" >&2
cat <<EOF
dn: $basedn
objectClass: top
objectClass: dcObject
objectClass: organization
dc: $dc
o: $dc
structuralObjectClass: organization
dn: cn=root,$basedn
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: root
description: LDAP administrator
userPassword:: `/usr/sbin/slappasswd -h '{CRYPT}' -c '$5$rounds=8000$%.16s' -s "$pw" | base64 -w0`
structuralObjectClass: organizationalRole
dn: ou=People,$basedn
objectClass: top
objectClass: organizationalUnit
structuralObjectClass: organizationalUnit
ou: People
dn: ou=Groups,$basedn
objectClass: top
objectClass: organizationalUnit
structuralObjectClass: organizationalUnit
ou: Groups
EOF