环境
操作系统版本:rhel6.5
·
导致故障的原因
为了修复一个低危的系统安全漏洞,导致了使用 su 的密码验证一直错误(普通用户和 root 用户)
低危漏洞
检查是否配置账户认证失败次数限制(最大值:6)
修改建议
Redhat 编辑/etc/pam.d/system-auth
文件配置:auth required pam_tally.so deny=5 unlock_time=600 account required pam_tally.so
按修改建议配置好之后用普通用户(配置了禁止 root 远程连接功能)可以 ssh 远程连接到服务器。但是使用 su 切换用户的时候一直提示密码错误。
[zxt2000@localhost ~]$ su - rootPassword: su: incorrect password
·
排查方法
1 打开系统日志(实时)
tail -f /var/log/secure
2 使用 su 命令
[zxt2000@localhost ~]$ su - rootPassword: su: incorrect password
3 可以发现报错日志
Jul 27 18:53:07 localhost su:PAM unable to dlopen(/lib64/security/pam_tally.so): /lib64/security/pam_tally.so: cannot open shared object file: No such file or directory
Jul 27 18:53:07 localhost su: PAM adding faulty module: /lib64/security/pam_tally.so
·
故障原因
没有 /lib64/security/pam_tally.so 共享对象文件
解决方法
一般环境中,没有 /lib64/security/pam_tally.so,但是会存在 /lib64/security/pam_tally2.so 共享对象文件。
解决方法一:
将配置文件中的 pam_tally.so 修改为 pam_tally2.so
vim /etc/pam.d/system-authauth required pam_tally2.so deny=5 unlock_time=600account required pam_tally2.so
解决方法二:
创建 /lib64/security/pam_tally.so 软连接
ln -s /lib64/security/pam_tally2.so /lib64/security/pam_tally.so