[root@lvc ~]# vi /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 /lib64/security/pam_tally.so onerr=fail
auth required /lib64/security/pam_tally.so onerr=fail deny=2 这里意思是输入二次验证失败,即锁定帐户
#auth required /lib64/security/pam_tally.so onerr=fail deny=2 lock_time=60 这里意思是每一次进行了错误的验证后,需要60秒钟后,才能再进行验证,但是错误验证了二次,将被系统永久锁定,除非管理员手动把错误验证的次数恢复成0,使用faillog -u user 可查看次数,使用faillog -u user -r 将错误次数重置为0
#auth required /lib64/security/pam_tally.so onerr=fail deny=2 lock_time=60 unlock_time=80
错误验证二次前, 每次错误验证需要60秒后,才能再次进行验证,验证正确,就能登入系统
错误验证二次后, 超过系统最大错误次数限制, 将被系统把帐户永久锁住,即使60分钟后可以再次输入验证,将依然会提示密码错误, 这个时候unlock_time就发挥了作用, unlock_time可以允许帐户超过错误验证最大限制后,多长时间后可以继续访问(也就是自动解锁),你就可以访问了(如果加上下面那段 pam_tally.so reset,就会将错误验证的次数重置为0),如果再次访问验证失败,即再次被锁, 需要60 秒后可以访问,如果unlock_time输入错误, 下面那段也没加pam_tally.so reset, 帐户则继续被系统锁定,继续80秒后才能访问.
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 500 quiet
auth required pam_deny.so
account required pam_tally.so reset 用户验证正确后,将错误次数重置为0
account required pam_unix.so
account sufficient pam_succeed_if.so uid < 500 quiet
account required pam_permit.so
password requisite pam_cracklib.so try_first_pass retry=3
password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok
password required pam_deny.so
session optional pam_keyinit.so revoke
#session required pam_limits.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
总结需求:
1、每进行一次错误的验证,即将帐户锁定5分钟.、
2、进行了五次错误验证,就将帐户永久锁定
3、进行了五次错误验证,错误验证超过最大错误次数,帐户永久被锁定后,在一定的时间内系统自动解锁,帐户再次验证时,如果输入正确则将错误次数重置为0,如果输入错误次数再超过五次,则继续被永久锁定,在一定的时间内系统自动解锁,依次类推
4、进行五次错误验证后,帐户被永久锁定,在一定的时间内系统自动解锁,帐户再次验证时,如果输入正确的验证则不将错误次数重置为0,如果下次再次输入错误验证,则又被系统锁定, 这样的做法很拙,只要输错了一次验证就必须要等unlock_time时间到了才能解锁
需求一:
每进行一次错误的验证,即将帐户锁定5分钟.、操作:
vi /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 /lib64/security/pam_tally.so onerr=fail
auth required /lib64/security/pam_tally.so onerr=fail lock_time=300 每输入错误一次,锁定5分钟,5分钟后才可以以再次验证
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 500 quiet
auth required pam_deny.so
account required pam_tally.so
account required pam_unix.so
account sufficient pam_succeed_if.so uid < 500 quiet
account required pam_permit.so
password requisite pam_cracklib.so try_first_pass retry=3
password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok
password required pam_deny.so
session optional pam_keyinit.so revoke
#session required pam_limits.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
需求二:进行了五次错误验证,就将帐户永久锁定
vi /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 /lib64/security/pam_tally.so onerr=fail
auth required /lib64/security/pam_tally.so onerr=fail deny=5错误输入五次,将被永久锁定,除非管理员手动解锁
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 500 quiet
auth required pam_deny.so
account required pam_tally.so
account required pam_unix.so
account sufficient pam_succeed_if.so uid < 500 quiet
account required pam_permit.so
password requisite pam_cracklib.so try_first_pass retry=3
password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok
password required pam_deny.so
session optional pam_keyinit.so revoke
#session required pam_limits.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
需求三、进行了五次错误验证,错误验证超过最大错误次数,帐户永久被锁定后,在一定的时间内系统自动解锁,帐户再次验证时,如果输入正确则将错误次数重置为0,输入正确进了系统后,如果输入错误次数再超过五次,则继续被永久锁定,在一定的时间内系统自动解锁,依次类推, 如果在自动解锁的第一次被输入错误验证,则将继续被系统锁定,继续等待系统的解锁时间
vi /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 /lib64/security/pam_tally.so onerr=fail
auth required /lib64/security/pam_tally.so onerr=fail deny=5 unlock_time=xxxx错误输入五次,帐户被锁定,等到unlock_time时间到了,帐户可自动解锁,如解锁后输入正确可将错误次数重置为0,如输入错误则继续被锁
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 500 quiet
auth required pam_deny.so
account required pam_tally.so reset验证成功后,将fail次数重置为0
account required pam_unix.so
account sufficient pam_succeed_if.so uid < 500 quiet
account required pam_permit.so
password requisite pam_cracklib.so try_first_pass retry=3
password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok
password required pam_deny.so
session optional pam_keyinit.so revoke
#session required pam_limits.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
需求四、进行五次错误验证后,帐户被永久锁定,在一定的时间内系统自动解锁,帐户再次验证时,如果输入正确的验证则不将错误次数重置为0,如果下次再次输入错误验证,则又被系统锁定, 这样的做法很拙,只要输错了一次验证就必须要等unlock_time时间到了才能解锁
vi /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 /lib64/security/pam_tally.so onerr=fail
auth required /lib64/security/pam_tally.so onerr=fail deny=5 unlock_time=xxxx错误输入五次,帐户被锁定,等到unlock_time时间到了,帐户可自动解锁,如解锁后输入正确验证当然就能进入系统,但是错误次数将不会重置为0,如输入再输入一次错误验证则继续被锁
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 500 quiet
auth required pam_deny.so
account required pam_tally.so
account required pam_unix.so
account sufficient pam_succeed_if.so uid < 500 quiet
account required pam_permit.so
password requisite pam_cracklib.so try_first_pass retry=3
password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok
password required pam_deny.so
session optional pam_keyinit.so revoke
#session required pam_limits.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
阅读(3506) | 评论(0) | 转发(0) |