Skip to content

Fix LDAP eauth 2FA incompatibility with auth.ldap.freeipa#69234

Open
ggiesen wants to merge 1 commit into
saltstack:3006.xfrom
ggiesen:fix-ldap-freeipa-2fa
Open

Fix LDAP eauth 2FA incompatibility with auth.ldap.freeipa#69234
ggiesen wants to merge 1 commit into
saltstack:3006.xfrom
ggiesen:fix-ldap-freeipa-2fa

Conversation

@ggiesen
Copy link
Copy Markdown
Contributor

@ggiesen ggiesen commented May 27, 2026

What does this PR do?

Fixes the LDAP eauth group-membership lookup so it works with single-use 2FA
(e.g. FreeIPA OTP, Duo) when auth.ldap.freeipa is enabled.

In groups(), the FreeIPA branch re-bound the user with auth(username, password)
on every job payload to re-verify the password. With a single-use 2FA
credential that second bind fails (the OTP is already consumed) or double-prompts.

The standard LDAP branch already guards against this by only re-binding on the
first payload of a job (detected via the presence of show_jid in kwargs).
This PR applies that same guard to the FreeIPA branch, using _bind() with the
configured anonymous handling. The Active Directory and standard LDAP branches
are unchanged, and auth()/_bind() themselves are not modified.

What issues does this PR fix or reference?

Fixes #61974

Previous Behavior

With auth.ldap.freeipa: True, every authentication performed a second user
bind during group lookup, breaking single-use 2FA tokens and causing duplicate
Duo prompts.

New Behavior

With auth.ldap.freeipa: True, the user is only re-bound on the first payload
of a job, matching the existing standard-LDAP behavior. Without
auth_by_group_membership_only/anonymous configured, the re-bind remains a
normal user bind, so existing behavior is retained.

Merge requirements satisfied?

  • Changelog
  • Tests written/updated

Commits signed with GPG?

No

@dwoz
Copy link
Copy Markdown
Contributor

dwoz commented May 27, 2026

This sounds like a bug fix, if so it should go into the oldest applicable branch 3006.x, 3007.x, or 3008.x.

When auth.ldap.freeipa is enabled, groups() re-bound the user on every job
payload to re-verify the password. With single-use 2FA (e.g. a FreeIPA OTP,
or Duo push) that second bind fails or double-prompts, because the credential
is only valid once.

Apply the same guard the standard LDAP branch already uses: only re-bind on
the first payload of a job (detected via the presence of show_jid in kwargs),
using _bind() with the configured anonymous handling. Non-FreeIPA and Active
Directory code paths are unchanged.

Fixes saltstack#61974
@ggiesen ggiesen force-pushed the fix-ldap-freeipa-2fa branch from 18b7601 to 391e781 Compare May 27, 2026 15:40
@ggiesen ggiesen changed the base branch from master to 3006.x May 27, 2026 15:40
@ggiesen
Copy link
Copy Markdown
Contributor Author

ggiesen commented May 27, 2026

Thanks @dwoz - agreed, it's a bug fix. Re-targeted to 3006.x (the oldest supported branch containing the affected salt/auth/ldap.py code); it'll merge forward to 3007.x/3008.x/master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] LDAP eauth module not compatible with 2FA when auth.ldap.freeipa is set to True

2 participants