sudo vim /etc/openldap/slapd.conf
include /private/etc/openldap/schema/core.schema
include /private/etc/openldap/schema/cosine.schema
include /private/etc/openldap/schema/inetorgperson.schema

pidfile /private/var/db/openldap/run/slapd.pid
argsfile /private/var/db/openldap/run/slapd.args

database bdb
suffix “dc=hensler,dc=local”
rootdn “cn=manager,dc=hensler,dc=local”
rootpw {SSHA}DXreBCiCpU1sH728ubClNXpHblzw80Wo
directory /private/var/db/openldap/openldap-data
index objectClass eq
cachesize 2000

sudo vim /etc/openldap/sample.ldif
version: 1
dn: dc=hensler,dc=local
objectClass: top
objectClass: dcObject
objectClass: organization
dc: hensler
o: Some Org
description: A sample domain

dn: ou=people,dc=hensler,dc=local
objectClass: top
objectClass: organizationalUnit
ou: people

dn: cn=WebSphere Admin,ou=people,dc=hensler,dc=local
objectClass: inetOrgPerson
cn: WebSphere Admin
sn: Admin
givenname: WebSphere
uid: wasadmin.local
# the userpassword is set to the SHA1 of ‘root’
userPassword: Passw0rd
mail: wasadmin.local@hensler.local
description: WebSphere Admin

Start LDAP
sudo /usr/libexec/slapd -d 127

Add sample.ldif
ldapadd -x -D cn=manager,dc=hensler,dc=net -w secret -f hensler.net.ldif

ldapsearch
ldapsearch -LLL -x -h 10.0.29.150 -b “cn=CNX Admin,ou=people,dc=hensler,dc=local”

 

Autostart openldap
download org.openldap.slapd.plist:
https://opensource.apple.com/source/OpenLDAP/OpenLDAP-499.32/AppleExtras/Resources/org.openldap.slapd.plist.auto.html
cp /Library/Preferences/org.openldap.slapd.plist

 

db_recover
sudo launchctl unload /System/Library/LaunchDaemons/org.openldap.slapd.plist
sudo /usr/libexec/slapd -Tt
sudo db_recover -cv -h /var/db/openldap/openldap-data/
sudo launchctl load /System/Library/LaunchDaemons/org.openldap.slapd.plist

Leave a Reply

Your email address will not be published. Required fields are marked *