How to Create Empty groupOfNames in LDAP Without Mandatory Member Attribute


7 views

When working with LDAP directory structures, many developers encounter this common hurdle: the groupOfNames object class requires at least one member attribute during creation. This becomes particularly problematic when you need to:

  • Separate infrastructure provisioning from user management
  • Maintain different environments (DEV/TEST/PROD)
  • Follow infrastructure-as-code principles

Here are three proven approaches to handle this requirement:

1. Temporary Dummy Member

dn: cn=USER_ROLE, ou=groups, dc=company, dc=com
objectClass: groupOfNames
objectClass: top
cn: USER_ROLE
member: cn=dummy, dc=company, dc=com

Pros: Simple to implement, works with all LDAP servers
Cons: Leaves orphaned reference, requires cleanup

2. Using groupOfUniqueNames

dn: cn=USER_ROLE, ou=groups, dc=company, dc=com
objectClass: groupOfUniqueNames
objectClass: top
cn: USER_ROLE

Note: While this appears to work initially, some implementations may still enforce similar constraints.

3. Schema Modification Approach

For ApacheDS specifically, you can modify the schema:

dn: m-oid=2.5.6.9, ou=schema
changetype: modify
replace: m-may
m-may: member

Here's a complete implementation pattern we use in our CI/CD pipelines:

### Infrastructure Phase
dn: cn=PLACEHOLDER, dc=company, dc=com
objectClass: organizationalRole
cn: PLACEHOLDER
description: Temporary member for group initialization

dn: cn=USER_ROLE, ou=groups, dc=company, dc=com
objectClass: groupOfNames
objectClass: top
cn: USER_ROLE
member: cn=PLACEHOLDER, dc=company, dc=com

### User Provisioning Phase
dn: cn=USER_ROLE, ou=groups, dc=company, dc=com
changetype: modify
delete: member
member: cn=PLACEHOLDER, dc=company, dc=com
-
add: member
member: uid=realUser, ou=accounts, dc=company, dc=com

Consider these alternatives if flexibility is needed:

  • groupOfEntries (RFC 4519)
  • groupOfMembers (draft-ietf-ldup-subentry)
  • organizationalRole for simple cases
Server Behavior Workaround
ApacheDS Strict enforcement Schema mod or dummy member
OpenLDAP Configurable relax: disabled in slapd.conf
Active Directory N/A Use group type

The key insight is that this "limitation" exists for good reason - it ensures group consistency. However, in development environments, we sometimes need to work around it temporarily.


When implementing LDAP directory structures in multi-server environments (especially in DTAP pipelines), we often need to create group definitions separately from user population. The standard groupOfNames objectClass presents a particular challenge due to its mandatory member attribute requirement.

The most obvious attempt - creating a group without members - fails with this common error:

ERR_279 Required attributes [member(2.5.4.31)] not found within entry

While adding an empty member (member:) technically works, it violates LDAP schema validation rules and may cause issues with some directory servers.

Option 1: Using a Dummy Member

dn: cn=USER_ROLE, ou=groups, dc=company, dc=com
objectClass: groupOfNames
objectClass: top
cn: USER_ROLE
member: cn=dummy,dc=company,dc=com

Then remove the dummy during your user population phase:

dn: cn=USER_ROLE, ou=groups, dc=company, dc=com
changetype: modify
delete: member
member: cn=dummy,dc=company,dc=com

Option 2: Schema Modification

For permanent solutions, consider creating a custom objectClass:

objectClasses: ( 1.3.6.1.4.1.99999.1.1.1 NAME 'emptyGroupOfNames'
    SUP groupOfNames
    MAY member )

Option 3: Using groupOfUniqueNames

If your directory supports RFC4519:

dn: cn=USER_ROLE, ou=groups, dc=company, dc=com
objectClass: groupOfUniqueNames
objectClass: top
cn: USER_ROLE

Here's a complete workflow for a CI/CD pipeline:

# Structure deployment phase
dn: cn=DEV_USERS, ou=groups, dc=company, dc=com
objectClass: groupOfNames
objectClass: top
cn: DEV_USERS
member: cn=placeholder,dc=company,dc=com

# Test data population phase
dn: cn=DEV_USERS, ou=groups, dc=company, dc=com
changetype: modify
delete: member
member: cn=placeholder,dc=company,dc=com
-
add: member
member: uid=testuser1,ou=accounts,dc=company,dc=com
member: uid=testuser2,ou=accounts,dc=company,dc=com

Different directory servers handle this differently:

  • OpenLDAP: Requires olcAllows: bind_v2 for schema flexibility
  • ApacheDS: Strict schema validation by default
  • Active Directory: No equivalent restriction exists