Skip to content

Lesson 7 of 9 · 26m

Schema Design Without Future Pain

Extend LDAP schema conservatively using valid OIDs, auxiliary object classes, stable naming, and migration-aware application contracts.

Bad schema is forever. Applications start reading an attribute, exports depend on it, scripts transform it, and five years later nobody can remove employeeType2 even though nobody remembers what it means. LDAP schema is not application configuration; it is a compatibility contract with every client that will ever touch the directory.

Understand the schema primitives

Schema defines attribute types and object classes. An attribute definition specifies an OID, syntax, matching rules, and whether it is single-valued:

attributetype ( 1.3.6.1.4.1.99999.1.1
  NAME 'sudoCostCenter'
  DESC 'Cost center assigned to a person identity'
  EQUALITY caseIgnoreMatch
  SUBSTR caseIgnoreSubstringsMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE )

An auxiliary object class gathers related attributes:

objectclass ( 1.3.6.1.4.1.99999.1.2
  NAME 'sudoPerson'
  DESC 'SudoSecurity operational person extensions'
  AUXILIARY
  MAY ( sudoCostCenter $ sudoLifecycleState )
  MUST sudoPersonId )

Use a private enterprise number if you have one. If you do not, obtain one rather than inventing OIDs in someone else's namespace. Documentation OIDs and random integers are not production schema hygiene.

Standard schema beats clever schema

Before inventing anything, look for existing attributes: uid, cn, sn, givenName, mail, telephoneNumber, employeeNumber, departmentNumber, manager, member, memberUid, sshPublicKey, and schema used by your target ecosystem. Interoperability is a security feature because every custom mapping is another place identity data can drift.

Mutability determines placement

Store identity attributes in LDAP when they are broadly consumed and change slowly. Do not use the directory as a general-purpose application database because it happens to be highly available. Good candidates: stable account IDs, lifecycle state, Unix IDs, SSH keys, group membership, service ownership. Bad candidates: session state, feature flags, per-request preferences, audit logs, large binary documents.

Schema rollout is data migration

A schema deployment is not finished when the server loads the file. The rollout path is:

1. Define schema in version control.
2. Load in staging and run application test clients.
3. Add optional attributes/classes to producers.
4. Populate data in controlled batches.
5. Switch consumers to read the new values.
6. Remove old writes.
7. Only then consider deprecating old reads.

Because LDAP entries are independently typed, schema changes often coexist across mixed generations of entries. Queries must tolerate missing optional attributes during migration.

Validate schema operationally

Ask servers what they actually know:

ldapsearch -x -H ldaps://ldap.sudosecurity.org   -D 'uid=readonly,ou=services,dc=sudosecurity,dc=org' -W   -b 'cn=subschema' -s base '(objectClass=*)' attributeTypes objectClasses

Replica schema skew can cause replication failure or silent interoperability differences. Version-control schema exactly like database migrations and review it with the same skepticism.

Field notes

  • Once applications depend on a single-valued assumption, changing cardinality becomes a migration rather than a schema tweak.
  • Avoid storing contradictory truth in both groups and user attributes unless one generated view is clearly authoritative.
  • Descriptive DESC text matters; future incident responders will read it at 3 a.m.
  • Never reuse an attribute name for a different meaning after deprecation; choose a new name instead.

Was this lesson helpful?

Sign in to rate