为什么我没有看到用户锁定消息?

为什么我没有看到用户锁定消息?

当我尝试使用错误密码(本地)登录 3 次时,没有看到用户锁定消息:

su - myuser
Account locked due to 3 failed logins

我看到的是:

[myuser@ip-10-10-2-53 ~]$ su - myuser
Password: 
su: Permission denied
[myuser@ip-10-10-2-53 ~]$ su - myuser
Password: 
su: Permission denied
[myuser@ip-10-10-2-53 ~]$ su - myuser
Password: 
su: Authentication failure
[myuser@ip-10-10-2-53 ~]$ su - myuser
Password: 
su: Authentication failure
[myuser@ip-10-10-2-53 ~]$ su - myuser
Password: 
su: Authentication failure
[myuser@ip-10-10-2-53 ~]$ su - myuser
Password: 
su: Authentication failure
[myuser@ip-10-10-2-53 ~]$ su - myuser
Password: 
su: Authentication failure
[myuser@ip-10-10-2-53 ~]$ sudo faillock 
myuser:
When                Type  Source                                           Valid
2018-03-23 21:26:26 TTY   pts/1                                                V
2018-03-23 20:54:01 RHOST 192.168.8.67                                         I
2018-03-23 20:54:05 RHOST 192.168.8.67                                         I
2018-03-23 20:58:39 RHOST 192.168.8.67                                         I
2018-03-23 20:58:41 RHOST 192.168.8.67                                         I
2018-03-23 21:24:50 TTY   pts/1                                                I
2018-03-23 21:24:56 TTY   pts/1                                                I
2018-03-23 21:26:55 TTY   pts/1                                                V
2018-03-23 21:26:59 TTY   pts/1                                                V
root:
When                Type  Source                                           Valid

我的/etc/pam.d/password-auth/etc/pam.d/system-auth文件(它们完全相同)

#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        required      pam_faildelay.so delay=2000000
auth        required      pam_faillock.so preauth silent audit deny=3 even_deny_root unlock_time=60
auth        sufficient    pam_unix.so nullok try_first_pass
auth        [default=die] pam_faillock.so authfail audit deny=3 even_deny_root unlock_time=60
auth        requisite     pam_succeed_if.so uid >= 1000 quiet_success
auth        required      pam_deny.so

account     required      pam_faillock.so
account     required      pam_unix.so
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 1000 quiet
account     required      pam_permit.so

password    requisite     pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
-session     optional      pam_systemd.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so

答案1

auth部分中的是silent用于pam_failock阻止显示有关锁定的消息(因为这有助于识别现有帐户)。如果要显示消息,您需要使用

auth     requisite      pam_faillock.so preauth audit deny=3 even_deny_root unlock_time=60

这也可以防止锁定账户的密码提示

更详细的解释在手册页中https://linux.die.net/man/8/pam_faillock

相关内容