fix(pam-info): restore deny default when faillock.conf lacks it#374
Open
maybebyte wants to merge 1 commit into
Open
fix(pam-info): restore deny default when faillock.conf lacks it#374maybebyte wants to merge 1 commit into
maybebyte wants to merge 1 commit into
Conversation
When /etc/security/faillock.conf has no uncommented "deny =" line (commented out, or written without spaces), the parse overwrites the deny=3 default with an empty string. The empty value slips past the [[ "$deny" == *[!0-9]* ]] numeric guard, then evaluates to 0 in the remaining-attempts arithmetic, producing a false "Login blocked, boot into recovery mode" message for users still well below the threshold. Fall back to the documented default of 3 when the parse yields empty.
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.
Summary
pam-info(the failed-login notifier shown on login/su) can tell a usertheir account is locked and to boot into recovery mode when it is not.
This restores the script's own documented
denydefault so the messagestays accurate.
Changes
/etc/security/faillock.confhas no uncommenteddeny =line (commented out, or written asdeny=Nwithout spaces),the parse overwrites the
deny=3default with an empty string. Emptyslips past the
[[ "$deny" == *[!0-9]* ]]numeric guard, then evaluatesto
0in$(( deny - failed_login_counter )), soremaining_attemptsgoes negative and the "Login blocked" branch fires.
deny=3when the parse yields empty, re-arming thefallback the code already documents at the top of the block.
Testing
bash -non the script — no syntax errors.empty/commented/space-less
denypreviously bypassed the numeric guardand produced the false lockout; with the fix it falls back to
3andshows remaining attempts.
deny = 50anddeny = 3are unchanged.Notes for reviewers
etc/security/faillock.conf.security-miscwith an uncommenteddeny = 50, so the parse succeeds there. The bug surfaces when theeffective
/etc/security/faillock.confdiverges (plain Debian shipsdenycommented, or a hand-editeddeny=50without spaces).