Skip to content

Instantly share code, notes, and snippets.

@thsutton
Created February 3, 2015 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thsutton/3fd0328df68084e8d4c8 to your computer and use it in GitHub Desktop.
Save thsutton/3fd0328df68084e8d4c8 to your computer and use it in GitHub Desktop.
Running a testing slapd instance

Running a test slapd instance

I use this to run a slapd instance for testing schemata, searched, etc. during development.

Usage

mkdir -p schema
cp /etc/ldap/schema/{core,cosine,inetorgperson}.schema schema/

If you're working on a schema possibly add it to slapd.conf and link it into place:

ln -s ../../dev.schema schema/dev.schema

Then you can run server.sh to run a LDAP server on ldap://127.0.0.1:10389.

#!/bin/bash
SLAPD="/usr/sbin/slapd"
LDAP_DIR=$(dirname $(realpath $0))
cd $LDAP_DIR
mkdir -p data
$SLAPD -d 255 -h ldap://localhost:10389 -f slapd.conf
include schema/core.schema
include schema/cosine.schema
include schema/inetorgperson.schema
# include schema/dev.schema
pidfile slapd.pid
argsfile slapd.args
logfile /dev/null
# Protocol
require LDAPv3
sasl-secprops noanonymous
# Authentication
access to dn.base="" by * read
access to dn.base="cn=Subschema" by * read
access to *
by self write
by users read
by anonymous auth
# LDIF database definitions
database ldif
directory data
suffix "dc=anchor,dc=net,dc=au"
rootdn "cn=admin,dc=anchor,dc=net,dc=au"
rootpw "{MD5}Xr4ilOzQ4PCOq3aQ0qbuaQ=="
# password is "secret"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment