Skip to content
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

Setting try_first_pass on pam_unix.so does nothing #12

Open
jonesmz opened this issue Aug 6, 2022 · 1 comment
Open

Setting try_first_pass on pam_unix.so does nothing #12

jonesmz opened this issue Aug 6, 2022 · 1 comment

Comments

@jonesmz
Copy link
Contributor

jonesmz commented Aug 6, 2022

Used here:

auth [success=1 new_authtok_reqd=1 ignore=ignore default=bad] pam_unix.so {{ nullok|default('', true) }} {{ debug|default('', true) }} try_first_pass

password {{ 'sufficient' if sssd else 'required' }} pam_unix.so try_first_pass {{ unix_authtok|default('', true) }} {{ nullok|default('', true) }} {{ unix_extended_encryption|default('', true) }} {{ debug|default('', true) }}

See answer here:
https://unix.stackexchange.com/questions/687772/whats-the-difference-between-use-authtok-and-try-first-pass-or-use-first-pass-i

Copied below:

Here's what I've been able to figure out thanks to Andrew's comment, Tomáš Mráz's explanation, and an examination of the source code:

Despite what the documentation implies, try_first_pass does absolutely nothing when applied to pam_unix.so.

use_authtok does exactly the same thing as use_first_pass when applied to pam_unix.so: It uses the previously entered password if there was a previously entered password AND that password meets the previous modules' password quality requirements. Otherwise, it strictly fails.

If neither use_first_pass nor use_authtok is applied to pam_unix.so, behavior depends on whether a password was previously entered. If there was not a previously entered password, pam_unix.so graciously prompts for one. If there was, pam_unix.so behaves as if use_first_pass or use_authtok was set.

This is all for pam_unix.so. Beware that try_first_pass, use_first_pass, and use_authtok work differently in other PAM modules.

@jonesmz
Copy link
Contributor Author

jonesmz commented Mar 14, 2024

This appears to still be relevant in the latest version of the system-auth template.

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

No branches or pull requests

1 participant