-
Notifications
You must be signed in to change notification settings - Fork 259
Correct pam_sss behavior with inherited 2fa_single authtok #7916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hi. Is this an update for a #7456 fix? |
I mean you claim a deficiency in a fix for #7456 |
yes, the fix for #7456 caused a new bug |
@justin-stephenson, @thalman, could you please take a look since you reviewed original fix? |
I'm fine with the changes, but are you willing to implement the refactor you are mentioning? This will clean up the code a bit and you can do it in a different commit to keep things separate. |
Hi, it is a general problem to determine how to handle credentials forwarded by other PAM modules. That's why we recommend to use Since there already is the unfortunately undocumented option bye, |
I think you are underweighting the fact that a configuration that was previously working will stop working when sss is upgraded. If you want to require additional options to enable new functionality that's fine, but as things exist now a person is unable to sudo to change the configuration after installing the new sss. I think maintaining compatibility with the prior release is essential. It would be valid to deprecate this pam configuration syntax entirely and not support any new functionality until the pam configuration is changed, but people need to be able to authenticate as they did before in order to make that change. Making continued administration of the system dependent on an undocumented configuration flag makes no sense, IMO. |
given @sumit-bose comment I don't know what a refactor should look like |
Hi, thank you for your comment. I completely agree that they recent changes in SSSD are a regression with respect to your PAM configuration. However, it was not expected to work as I tried to explain since Since, as far as I can see your patch won't break any other use case and, as mentioned, using the bye, |
Yes pam_sss didn't expect anything but passwords, but until #7462 passwords and 2fa_single had identical semantics when 2fa was being used.
Sounds good. Maybe a runtime warning if the implicit behavior is in use (which would be eliminated by setting explicit parameter)? |
@mstone232 If you don't mind, I'd like to see this refactored to make the condition easier to understand. |
This reverts commit 4a435eb.
Makes explicit the fact that a credential obtained by use_first_pass from the pam stack is neither an SSS_AUTHTOK_TYPE_PASSWORD nor an SSS_AUTHTOK_TYPE_2FA_SINGLE, but rather a Schrodinger's cat whose status can't be determined until it is used.
@sumit-bose @ikerexxe based on the comments and rethinking the problem a bit, I've taken the patch in a different direction. The problem I see is that the current flow (and my previous change) are trying to cram the use_first_pass credential into either an SSS_AUTHTOK_TYPE_PASSWORD or an SSS_AUTHTOK_TYPE_2FA_SINGLE, but it's not really either of those at the point the decision is made. What I've done is add a new type, SSS_AUTHTOK_TYPE_PAM_STACKED specifically for the use_first_pass case where a credential is passed from a prior pam module and there's no chance to be explicit about its type. That lets us defer the decision about how to use that credential until we're actually asked for either a password or an otp. This restores the original semantics for use_first_pass, and I've tested that it works with IPA in either password or 2fa mode without having to fiddle with use_2fa. |
Hi, thank you, I like the idea, especially moving the decision away from the PAM module. So far I see no issue with the approach but I have to think a bit more about it. In the meantime I wonder if you can fix the issue
While technically correct it would be much easier to read/understand if there are parentheses. bye, |
done |
After the change in "krb5_child: do not try passwords with OTP #7462" pam_sss broke PAM configurations like this:
auth sufficient pam_unix.so nullok
auth sufficient pam_sss.so forward_pass
What happens in this case is that the combined password+otp is entered at the prompt generated by pam_unix, then forwarded to pam_sss. But in pam_sss any forwarded authtok is unconditionally set to SSS_AUTHTOK_TYPE_PASSWORD. This causes tokeninfo_matches to bail with the message "Unsupported authtok type 1" in krb5_child.log because tokeninfo_matches no longer handles SSS_AUTHTOK_TYPE_PASSWORD.
This patch adds the logic used elsewhere in pam_sss to determine whether a pam_authtok string should be treated as SSS_AUTHTOK_TYPE_PASSWORD or SSS_AUTHTOK_TYPE_2FA_SINGLE. Given the duplication it may be useful to refactor that logic into a separate function, but I tried to keep the change minimal.