feat(auth): tell user if they are locked out (new pr, had to switch up branches)#1776
Open
feat(auth): tell user if they are locked out (new pr, had to switch up branches)#1776
Conversation
alanzhu0
requested changes
May 19, 2025
Member
There was a problem hiding this comment.
Hi Sam, sorry for the delayed review. This is a great start. Please see the comments.
I finally got a chance to check PAM on our systems, and unfortunately it doesn't return a special status code for locked out users by default. I need to modify the backend authentication mechanism on our servers for it to work. But I did get the modified version to work, which is good. Please make the following changes, which are specific to our configuration:
- Line 75: replace the existing line with this:
result = pam_authenticator.authenticate(full_username, password, service="ion-login") - The return code from pam_authenticator will be 6 for locked out users ("permission denied"). You can just check
if pam_authenticator.code == 6: [do locked out users logic]
I can explain how I configured the PAM backend sometime if you want me to.
Thanks!
Member
Author
|
Thanks for the review! I edited the code to how you configured it and I think everything should work now, hopefully. I also squashed all the commits. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1749
Proposed changes
Brief description of rationale
The user will know that they are locked out instead of just knowing that the login did not work.
The specific PAM error message when a user is locked out is at line 65 at this link:
https://github.com/linux-pam/linux-pam/blob/master/libpam/pam_strerror.c