New to Kestra?
Use blueprints to kickstart your first workflows.
Orchestrate LDAP employee offboarding with Kestra. Snapshot group membership, relocate the account to an ex-employees OU, and revoke group membership.
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.
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.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.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.convert_to_ldif (io.kestra.plugin.ldap.IonToLdif) translates those Ion records into the LDIF format the LDAP plugin's write operations expect.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.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.ldapmodify commands.ou=expeople (or similarly named) organizational unit to relocate deprovisioned accounts into.username and the group DNs to revoke.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.ou=expeople organizational unit under your base DN if it does not already exist.username, base_dn, and revoke_group_dns.ou=expeople entry in the directory.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.io.kestra.plugin.ldap.Search step against ou=expeople after apply_deprovisioning to confirm the move succeeded before reporting success.moddn record for a modify record that sets a disabled-account attribute if your schema tracks status instead of relocating entries.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.io.kestra.plugin.ldap.Search trigger elsewhere in the catalog to audit for stale accounts that were never offboarded through this path.