Skip to content

Instantly share code, notes, and snippets.

@heiglandreas
Last active August 29, 2015 14:24
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 heiglandreas/10e1c7dd80d6e058faae to your computer and use it in GitHub Desktop.
Save heiglandreas/10e1c7dd80d6e058faae to your computer and use it in GitHub Desktop.
Provision test-ldap for ext-ldap-tests
#!/bin/bash
#
# Provision a Vagrant Box containing an OpenLDAP-Server to execute
# tests for PHPs ext-ldap against
apt-get update
DEBIAN_FRONTEND=noninteractive aptitude install -q -y slapd ldap-utils
export SLAPPASS=`slappasswd -s password`
echo "dn: olcDatabase={1}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=nodomain
-
replace: olcRootDN
olcRootDN: dc=admin,dc=nodomain
-
replace: olcRootPW
olcRootPW: ${SLAPPASS}" | ldapmodify -Y EXTERNAL -H ldapi:///
echo "dn: dc=nodomain
objectClass: dcObject
objectClass: organization
o: Example
dc: example
dn: ou=extldap,dc=nodomain
objectClass: organizationalUnit
ou: extldap" | ldapadd -c -x -H ldap://localhost:389 -D "dc=admin,dc=nodomain" -w password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment