Debian
啟用 pam_faillock 模組後無法登錄
我正在執行 Ubuntu 20.04 LTS。我通過在文件
pam_faillock
中添加以下兩行來啟用該模組。/etc/pam.d/common-auth
auth [default=die] pam_faillock.so authfail auth sufficient pam_faillock.so authsucc
我在下面添加這些行
auth [success=2 default=ignore] pam_unix.so nullok
以上:
auth [success=1 default=ignore] psm_sss.so use_first_pass
發佈在下面,我的更改已
/etc/pam.d/common-auth
被註釋掉。# here are the per-package modules (the "Primary" block) auth [success=2 default=ignore] pam_unix.so nullok #auth [default=die] pam_faillock.so authfail #auth sufficient pam_faillock.so authsucc auth [success=1 default=ignore] pam_sss.so use_first_pass # here's the fallback if no module succeeds auth requisite pam_deny.so # prime the stack with a positive return value if there isn't one already; # this avoids us returning an error just because nothing sets a success code # since the modules above will each just jump around auth required pam_permit.so # and here are more per-package modules (the "Additional" block) auth optional pam_cap.so auth required pam_faildelay.so delay=4000000 # end of pam-auth-update config
添加這些行後,我取消註釋以下行
/etc/security/faillock.conf
audit silent deny = 3 fail_interval = 900 unlock_time = 0
這些更改後我重新啟動,當我在重新啟動後嘗試登錄時,它告訴我密碼不正確。(是的,我已經驗證這不是一個錯誤的密碼)我在這方面不是最強的,我不確定是什麼導致了這種情況發生。
我已取消註釋您的台詞,並將它們放在我認為現在正確的位置。我還移動了其他一兩行來修復身份驗證流程。
# here are the per-package modules (the "Primary" block) auth [success=4 default=ignore] pam_unix.so nullok auth [success=3 default=ignore] pam_sss.so use_first_pass auth [default=die] pam_faillock.so authfail auth required pam_faildelay.so delay=4000000 # here's the fallback if no module succeeds auth requisite pam_deny.so # prime the stack with a positive return value if there isn't one already; # this avoids us returning an error just because nothing sets a success code # since the modules above will each just jump around auth required pam_permit.so # and here are more per-package modules (the "Additional" block) auth optional pam_cap.so auth sufficient pam_faillock.so authsucc # end of pam-auth-update config
請注意,我還更改了前兩
auth
行 -[success=N]
告訴 PAM 在成功時跳轉 N 條規則,因此成功從pam_unix
或pam_sss
將跳轉到pam_permit
,任何失敗都會將您帶到pam_faillock
、pam_faildelay
和pam_deny
。**我無法測試這個,因為我沒有
pam_faillock
安裝。**因此,要對此進行測試,首先在您的系統上打開一個 root shell,除了更改 PAM 配置文件外,不要觸摸它。使用第二個終端會話,嘗試登錄等,並測試它是否有效。
如果沒有,您已經準備好打開第一個會話以恢復您的更改。在您完全確定您的配置有效之前,請勿關閉此會話。