Search icon
Write icon
IonToLdif icon
Modify icon
SlackIncomingWebhook icon
Webhook icon

LDAP Employee Offboarding and Account Deprovisioning

Orchestrate LDAP employee offboarding with Kestra. Snapshot group membership, relocate the account to an ex-employees OU, and revoke group membership.

Categories
CoreInfrastructure

Offboarding tickets routinely list the systems to lock down: email, SSO, VPN, and the on-premises directory. LDAP is often the one that gets handled manually, days after the fact, because it means editing LDIF by hand or running a one-off ldapmodify command. This blueprint turns that manual step into a repeatable flow: it records the account's current group membership for the audit trail, moves the entry out of the active people tree into an ex-employees OU, and strips it from every group listed on the ticket, all built from Ion records that the LDAP plugin converts to LDIF before applying.

How it works

  1. A io.kestra.plugin.core.trigger.Webhook trigger (offboarding_request) fires the flow when the HRIS or ITSM system marks an employee as terminated, guarded by a secret webhook key.
  2. audit_current_membership (io.kestra.plugin.ldap.Search) looks up the account by uid under ou=people and fetches its memberOf attribute, writing an LDIF snapshot to internal storage before any change is made.
  3. build_deprovision_records (io.kestra.plugin.core.storage.Write) renders one Ion moddn record that relocates the account's DN to ou=expeople, plus one Ion modify record per entry in revoke_group_dns that deletes the account's DN from that group's member attribute.
  4. convert_to_ldif (io.kestra.plugin.ldap.IonToLdif) translates those Ion records into the LDIF format the LDAP plugin's write operations expect.
  5. apply_deprovisioning (io.kestra.plugin.ldap.Modify) submits the moddn and modify operations against the directory. Each record is applied independently, so a group DN that no longer exists is logged and skipped rather than aborting the whole run.
  6. notify (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) confirms the relocation and the number of groups revoked; the errors block alerts a separate channel if any step fails.

What you get

  • A pre-change audit snapshot of the account's group membership, captured before any modification.
  • The account relocated out of the active directory tree instead of just flagged, so group-based ACLs stop applying immediately.
  • Bulk group revocation driven by a simple list input, whether that is one group or twenty.
  • Fault-tolerant application: a missing or already-removed group does not block the rest of the deprovisioning.
  • A distinct Slack alert on failure, since a half-completed offboarding is a security gap.

Who it's for

  • IT and identity teams running an on-premises OpenLDAP, ApacheDS, or similar directory alongside cloud SSO.
  • Security teams who need an auditable, repeatable offboarding step instead of ad hoc ldapmodify commands.
  • Platform teams wiring an HRIS or ITSM offboarding workflow to every downstream system, LDAP included.

Prerequisites

  • An LDAP directory reachable from Kestra, with an admin bind account that can search, move, and modify entries.
  • An ou=expeople (or similarly named) organizational unit to relocate deprovisioned accounts into.
  • An HRIS or ITSM system able to call a webhook with the offboarded employee's username and the group DNs to revoke.
  • A Slack incoming webhook for notifications.

Secrets

  • LDAP_HOSTNAME: hostname of the LDAP server.
  • LDAP_ADMIN_DN / LDAP_ADMIN_PASSWORD: bind credentials for an account with permission to move and modify entries.
  • LDAP_OFFBOARDING_WEBHOOK_KEY: webhook key that guards the trigger.
  • SLACK_WEBHOOK_URL: Slack incoming webhook URL.

Quick start

  1. Add the secrets above to your Kestra namespace.
  2. Create the ou=expeople organizational unit under your base DN if it does not already exist.
  3. POST to the webhook (or run manually) with username, base_dn, and revoke_group_dns.
  4. Check the Slack confirmation and the ou=expeople entry in the directory.

How to extend

  • Validate or restrict username to a safe character set (for example, alphanumeric plus dot and dash) before it reaches the LDAP filter, since it originates from an external webhook payload and unescaped values in a search filter can enable LDAP filter injection.
  • Add an io.kestra.plugin.ldap.Search step against ou=expeople after apply_deprovisioning to confirm the move succeeded before reporting success.
  • Swap the moddn record for a modify record that sets a disabled-account attribute if your schema tracks status instead of relocating entries.
  • Reverse the flow for onboarding: build an add Ion record from HR-provided attributes and feed it through io.kestra.plugin.ldap.IonToLdif and io.kestra.plugin.ldap.Add to provision the entry and its group memberships in one pass.
  • Add a scheduled io.kestra.plugin.ldap.Search trigger elsewhere in the catalog to audit for stale accounts that were never offboarded through this path.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.