Here is a short example of a configuration in LDIF suitable for
use with slapadd(8) :
dn: cn=config
objectClass: olcGlobal
cn: config
olcPidFile: LOCALSTATEDIR/run/slapd.pid
olcAttributeOptions: x-hidden lang-
dn: cn=schema,cn=config
objectClass: olcSchemaConfig
cn: schema
include: file://SYSCONFDIR/schema/core.ldif
dn: olcDatabase=frontend,cn=config
objectClass: olcDatabaseConfig
objectClass: olcFrontendConfig
olcDatabase: frontend
# Subtypes of "name" (e.g. "cn" and "ou") with the
# option ";x-hidden" can be searched for/compared,
# but are not shown. See slapd.access(5).
olcAccess: to attrs=name;x-hidden by * =cs
# Protect passwords. See slapd.access(5).
olcAccess: to attrs=userPassword by * auth
# Read access to other attributes and entries.
olcAccess: to * by * read
# set a rootpw for the config database so we can bind.
# deny access to everyone else.
dn: olcDatabase=config,cn=config
objectClass: olcDatabaseConfig
olcDatabase: config
olcRootPW: {SSHA}XKYnrjvGT3wZFQrDD5040US592LxsdLy
olcAccess: to * by * none
dn: olcDatabase=mdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcMdbConfig
olcDatabase: mdb
olcSuffix: "dc=our-domain,dc=com"
# The database directory MUST exist prior to
# running slapd AND should only be accessible
# by the slapd/tools. Mode 0700 recommended.
olcDbDirectory: LOCALSTATEDIR/openldap-data
# Indices to maintain
olcDbIndex: objectClass eq
olcDbIndex: cn,sn,mail pres,eq,approx,sub
# We serve small clients that do not handle referrals,
# so handle remote lookups on their behalf.
dn: olcDatabase=ldap,cn=config
objectClass: olcDatabaseConfig
objectClass: olcLdapConfig
olcDatabase: ldap
olcSuffix: ""
olcDbUri: ldap://ldap.some-server.com/
Assuming the above data was saved in a file named "config.ldif"
and the ETCDIR/slapd.d directory has been created, this command
will initialize the configuration:
slapadd -F ETCDIR/slapd.d -n 0 -l config.ldif
"OpenLDAP Administrator's Guide" contains a longer annotated
example of a slapd configuration.
Alternatively, an existing slapd.conf file can be converted to
the new format using slapd or any of the slap tools:
slaptest -f ETCDIR/slapd.conf -F ETCDIR/slapd.d