Lesson 9 of 9 · 27m
Groups, Provisioning, Auditing, and Deprovisioning at Scale
Design group models and lifecycle automation that make access reversible, auditable, and safe when people change roles or leave.
Directories do not usually fail because create-user works. They fail because nobody knows what removing access means. A contractor leaves, the account is disabled, and three weeks later their SSH key still exists on hosts because a group membership was cached or the automation only ever learned how to add things. Lifecycle design is the difference between an identity system and a user database.
Groups are policy, not convenience labels
Model access around capabilities:
cn=vpn-users network access eligibility
cn=prod-ssh production shell eligibility
cn=deployers release pipeline deployment capability
cn=security-readers read-only security telemetry accessNested groups reduce duplication but increase debugging complexity. If prod-ssh includes linux-admins, then a removal path must calculate effective membership, not just direct membership. Document whether applications flatten nested groups, because many do not.
Membership representations matter
LDAP ecosystems use different conventions:
groupOfNames + member stores member DNs
posixGroup + memberUid stores usernames for Unix semantics
groupOfUniqueNames + uniqueMember older DN-based membership
memberOf overlay/backlink reverse view generated on user entriesA DN-based group breaks or goes stale when users are renamed. A username-based group breaks when username policy changes. There is no free lunch; choose the model based on which rename operations you can prohibit or automate reliably.
Provision through one authoritative pipeline
Identity data usually flows from an HR system or source of truth through an IdM layer into LDAP:
HR record -> lifecycle engine -> LDAP entry/group updates -> host/application cachesThe pipeline should own joins, movers, and leavers. Manual edits are emergencies, not workflow. A good provisioner is idempotent: running it twice produces the same end state and does not oscillate attributes. Emit diffs before applying changes and keep an audit event for every mutation.
Deprovisioning is a timed security operation
A serious offboarding runbook has ordered controls:
1. Disable interactive authentication immediately.
2. Revoke active sessions and tokens in connected systems.
3. Remove privileged group memberships.
4. Remove SSH keys and service ownership.
5. Preserve mailbox/files according to legal and business rules.
6. Archive or delete the LDAP entry after retention requirements are met.Do not conflate disabling with deletion. A disabled entry preserves audit history and ownership references. Premature deletion can break group history, application foreign references, and investigations.
Audit questions should be answerable quickly
If security asks "who could access production on May 14?", can you answer? You need group snapshots or event logs, not merely current state. Useful evidence includes change timestamps, modifier identity, provisioning run IDs, member addition/removal logs, and application cache refresh times.
ldapsearch ... -b 'cn=prod-ssh,ou=groups,dc=sudosecurity,dc=org' '(objectClass=*)' member modifyTimestamp modifiersNameCurrent membership proves now. Investigations usually need then.
Field notes
- Disabling a password does not revoke SSH keys, long-lived application sessions, or certificates; map every credential type separately.
- Renames are lifecycle events too. Test whether groups, ACLs, ownership, and application links survive them.
- Automated removal should handle missing entries gracefully; idempotency beats crashing halfway through a batch.
- Review privileged groups on a schedule, but make sure review evidence records effective membership, not only direct names.
Was this lesson helpful?