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

fix duplicate PAM msgs, missing loginmsg reset #522

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hellermf
Copy link

Without this change in mm_answer_pam_account all messages added in auth-pam.c sshpam_query(...) case PAM_SUCCESS end up sent here, then are still sitting in the loginmsg buffer and printed a second time in session.c do_login(...)

I initially encountered this problem using pam_duo.so (described by some other user in the link below) however it is not specific to that PAM module, I also get messages printed twice when pam_echo.so, pam_debug.so, and others are included in the auth PAM chain used by sshd.

https://community.cisco.com/t5/protecting-applications/duplicate-success-logging-you-in-after-a-successful-login/td-p/4879911

Autopushing login request to phone...
Success. Logging you in...
Autopushing login request to phone...
Success. Logging you in...

Without this code change, given the logic inside do_login(...) it is possible to work-around the problem on per-user basis with touch ~/.hushlogin but that also has the side-effect of disabling printing of the MOTD by sshd if that is configured ...and it is per-user not system-wide.

I gave some thought to whether there is any circumstance where the behavior of the original code is desired but thus far I cannot imagine one, although I am not deeply familiar with OpenSSH codebase.

without this change in mm_answer_pam_account all messages added in
auth-pam.c sshpam_query(...) case PAM_SUCCESS end up sent here, then are
still sitting in the loginmsg buffer and printed a second time in
session.c do_login(...)
@hellermf hellermf force-pushed the fix/duplicate-PAM-msg-printing branch from c10adb2 to 2f55f92 Compare October 16, 2024 19:32
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.

1 participant