Skip to content

Lesson 6 of 9 · 25m

Backups, Restoration, Performance, and Bad-Day Troubleshooting

Build verifiable directory backups, understand database-specific restore constraints, and troubleshoot load with evidence instead of superstition.

A directory backup you have never restored is a hope, not a control. The bad version of this lesson is discovering during a ransomware response that your LDIF export omitted operational attributes, your binary database backup cannot be imported on the replacement host, and replication will not magically heal because the surviving nodes inherited the corruption. Backup design is restore design.

LDIF export is portable but incomplete by itself

An LDIF backup is readable, diffable, and ideal for logical recovery:

slapcat -b 'dc=sudosecurity,dc=org' -l backup-$(date +%Y%m%d%H%M%S).ldif

For 389ds:

dsctl instance-name ldif2db --help
dsconf -D 'cn=Directory Manager' ldap://localhost backend export dc=sudosecurity,dc=org

Know what you are capturing. User entries are not the whole service: schema, configuration, replication metadata, password policy state, and operational attributes may matter during restoration. Store configuration separately from data.

Binary backups are fast but version-sensitive

OpenLDAP's LMDB backend can be copied safely only using procedures that respect database consistency. 389ds uses its own database files and backup tooling. Binary copies are efficient, but restoration can depend on architecture, library version, database version, and instance layout. A portable LDIF plus a fast binary backup is often the right combination.

Restore drills need measurable acceptance

A restore is successful when concrete checks pass:

ldapsearch -x -H ldaps://restored.example.org   -D 'uid=readonly,ou=services,dc=sudosecurity,dc=org' -W   -b 'dc=sudosecurity,dc=org' '(uid=amorales)' entryUUID modifyTimestamp

Validate entry counts, sample critical accounts, schema presence, indexes, TLS, ACL behavior, and replication convergence. Record actual recovery time. If restoring takes six hours and the business expects one, the backup technically works and the service objective still fails.

Performance symptoms are usually search shape

High CPU often comes from unindexed searches, wildcard filters, excessive scope, missing connection reuse, or applications polling large group membership. Start with logs and server statistics, not guesses:

who is connecting?
which base/scope/filter repeats?
is the filter indexed?
is TLS resumption/session reuse happening?
are clients opening one connection per request?
is replication lag growing at the same time?

A single application doing (memberOf=cn=admins,...), once per HTTP request, across a load-balanced fleet can produce a directory outage without any malicious actor.

Build a diagnostic bundle

During incidents, capture the same facts every time: server version, uptime, recent configuration changes, replication state, disk use, certificate dates, index health, top repeated filters, connection counts, and authentication failure counts. That bundle turns the postmortem into engineering instead of folklore.

Field notes

  • Never copy live database files with plain cp unless the server documentation explicitly says that method is safe.
  • Protect backups: directory data contains password hashes, organizational structure, and enough metadata to plan further compromise.
  • Test restore onto the same major server version first; cross-version migration is a separate project.
  • Alert on backup job success and restore validation age; a green backup job can still produce unusable output.

Was this lesson helpful?

Sign in to rate