When a user is prompted for their password to set up TFA on a site with LDAP authentication their password does not pass validation. That's because the user doesn't really have a Drupal account password.
The problem has also been described in #2856520: tfa and tfa basic issues and is mentioned in #2931150: Confirmation forms should not require passwords.
Original Report
Have you tried having a LDAP and TFA enabled on the same site? Do you know if they will work together? We're trying it here and it seems to conflict with each other - both work independently, but not when both enabled. Any thoughts on it?
Comments
Comment #2
sanduhrsPlease reopen if this is still active.
Comment #3
sorin_cocorada commentedI'm having the same problem. Users are successfully authenticated against LDAP, but when a LDAP user tries to setup TFA he/she gets 'Incorrect password'. The same process works for the admin user(local account)
Comment #4
sorin_cocorada commentedIssue may be caused by these lines of code(modules/tfa/src/Form/BasicSetup.php) which expect the password to be stored locally
Commenting the if block allows me enabling TFO by skipping password verification
Comment #5
dcam commentedThis is still an issue. Yesterday I encountered the problem as described in comment 3.
I don't have a solution for this yet and I'm reluctant to implement any work-around that by-passes the validation step. I'm not certain, but it seems like that would allow anyone to modify TFA for any account.
Comment #6
gregglesI don't think anyone has intentionally built this, so it seems like a feature.
I think someone who has an LDAP site and wants TFA might want to do TFA at the LDAP point, and not inside of Drupal.
I guess that if this gets built in Drupal, it will require someone with an LDAP site and TFA to write the code or hire someone to write the code. From a code maintenance perspective, I think this should live as a sub-module of the main TFA codebase in some way.
Comment #7
samthemanCan anyone advise on workarounds, other than commenting out the password validation in #4?
Comment #8
jcnventuraI'm closing this again. If you use an IDP (identity provider), you have 100% trust in that system. If you don't trust it, pretty please don't use it!
And yes, that does mean that TFA should be handled at the IDP side of things, and Drupal just accepts that the user being authenticated by the remote system is indeed the person who owns that account.
And finally, this seems to be a duplicate for the request in #2931150: Confirmation forms should not require passwords. so let's keep the discussion going there.
Comment #9
yekaterina k commentedHello @jcnventura,
And if we will decide anyway to use TFA and SAML Drupal Login at the same time, what would be the correct approach to do so (knowing that when user is logged with sso it bypasses TFA) ?
Comment #10
joancatala commentedI have the same problem: the user can't set up the TFA (OTP) application because Drupal doesn't recognize his LDAP password.
Any solution?
Comment #11
input commentedEven this is marked as duplicate and closed, the duplicate issue is about "disabling password" check. This seems not a solution.
I implemented TFA together with Lightweight Directory Access Protocol.
TFA checks directly on vanilla Drupal\Core\Password\PasswordInterface. LDAP Module does not apply here, so I "reauth" if the vanilla verification/validation fails via a custom module.
As this is an direct intervention into security, maybe someone could verify this method as "a" way to go.