Ldap – Add group/user on OpenLDAP

ldapopenldap

I am setting up OpenLDAP for the first time, on RHEL6 and using Puppet to do the initial install/configuration.

I believe the configuration uses the slapd.d rather than slapd.conf method.

Basically, I believe Puppet has successfully created a Database which I want to use as the root of my configuration tree. This is the output of slapcat that shows this database created:

dn: olcDatabase={3}hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {3}hdb
olcDbDirectory: /var/lib/ldap/
olcSuffix: dc=corp.f7
olcRootDN: cn=root,dc=corp.f7
structuralObjectClass: olcHdbConfig
entryUUID: 8fce2bda-78b8-1033-80d2-f79b693c6963
creatorsName: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
createTimestamp: 20140526002936Z
olcAccess: {0}to * by * read
olcRootPW:: e1NTSEF9MGkzazlZdldwMVNpU1FNVjhnNDQ4MHJBNFUra0FUdTI=
entryCSN: 20140526010102.566286Z#000000#000#000000
modifiersName: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
modifyTimestamp: 20140526010102Z

Then following an example I found online, I am trying to feed the following ldif file into this command:

ldapadd -cxWD cn=root,dc=corp.f7 -W -f /tmp/static.ldif

# User account
dn: uid=jsmith,dc=corp.f7
cn: John Smith
givenName: John
sn: Smith
uid: jsmith
uidNumber: 10000
gidNumber: 10000
homeDirectory: /home/jsmith
mail: jsmith@dev.local
objectClass: top
objectClass: posixAccount
objectClass: shadowAccount
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
loginShell: /bin/bash
userPassword: {CRYPT}*

However, I simply get the following error output:

adding new entry "uid=jsmith,dc=corp.f7"
ldap_add: No such object (32)

I am not really sure what object it can't find…is it the dc=corp.f7?

How do I go about setting up groups and users in this database I created?

Thanks

Best Answer

First, you need a parent object for your user, second, you can't use the dot in the dcObject, dc (domain component) takes only alphanumerics and hyphen (see RFC4519)

dn: dc=corp,dc=f7
objectClass: dcObject
objectClass: organization
dc: corp
o: corp

(And you can't use dcObject as the only object class because it's defined as auxilliary, so you need a structural class to provide some scaffolding; organization will do nicely. You might want to read RFC4519 while you're at it :-))

Related Topic