I'm having problems getting puppet to install a working openldap server using the following:

* Vagrant 1.2.2
* Ubuntu 12 ([Puppetlabs Ubuntu 12.04.2 x86\_64](http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210.box))
* [torian/ldap 0.2.4](http://forge.puppetlabs.com/torian/ldap)

I have the torian/ldap module in my vagrant folder and the following in the base puppet file:

```
class { 'ldap::server::master':
  suffix      => 'dc=example,dc=co,dc=uk',
  rootpw      => 'adminadmin';
}

```

`vagrant up` starts the VM without any errors and openldap is running on port 389. As I understand it the root user should default to:

```
cn=admin,dc=example,dc=co,dc=uk

```

but if I try to connect with the above user/password either remotely or using:

```
ldapadd -x -D "cn=admin,dc=example,dc=co,dc=uk" -W

```

I get an `Invalid Credentials` error. I've also tried with the same password SHA encoded:

```
rootpw      => '{SHA}3ZRwlSi7HIPQjzCI1AQ/R0KJH08=';

```

but no luck. Can anyone see what I've done wrong?

**Update**

Running `slapcat -f /usr/share/slapd/slapd.conf` shows these two entries:

```
creatorsName: cn=admin,dc=nodomain
userPassword:: e1NTSEF9R2lES2JuRERqYU1rNGROSG5rN1hTa3dteEdOVjBlYmU=

```

Those are clearly different to the ones passed to the puppet module.

**Almost there...**

Thanks to emsworth for pointing me in the right direction it's nearly working. It's copying an LDIF update file over and trying to run ldapmodify on it to modify the root DN and password, but this seems to corrupt things. Before the ldapmodify the slapd service starts ok, afterwards trying to restart slapd fails. The update file is:

```
dn: olcDatabase={1}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=example,dc=com
-
replace: olcRootDN
olcRootDN: cn=admin,dc=example,dc=com
-
replace: olcRootPW
olcRootPW: {SHA}3ZRwlSi7HIPQjzCI1AQ/R0KJH08=
-

```

and it's being run with the following command:

```
/usr/bin/ldapmodify -Y EXTERNAL -H ldapi:/// -f
  /etc/ldap/slapd.conf/cn=config/olcDatabase={1}hdb-update.ldif

```

Trying to run the update manually as root with the above command gives the error:

```
ldap_modify: Other (e.g., implementation specific) error (80)

```

and in syslog:

```
Jan  6 15:31:15 ubuntu-server-12042-x64-vbox4210 slapd[19166]: ldif_write_entry:
cannot create file for "olcDatabase={1}hdb,cn=config": Permission denied

```