pam_unix(sudo:auth):对话失败,auth无法识别[用户名]的密码 [英] pam_unix(sudo:auth): conversation failed, auth could not identify password for [username]
问题描述
我正在使用 ansible 来配置Centos 7产品集群.不幸的是,使用 ansible Tiemout
和Linux可插拔身份验证模块( pam )error conversation failed
执行以下命令会导致结果.
I'm using ansible to provision my Centos 7 produciton cluster. Unfortunately, execution of below command results with ansible Tiemout
and Linux Pluggable Authentication Modules (pam) error conversation failed
.
相同的 ansible 命令效果很好,可以对在 vagrant 框外疯狂运行的虚拟实验室执行.
The same ansible command works well, executed against virtual lab mad out of vagrant boxes.
$ ansible master_server -m yum -a 'name=vim state=installed' -b -K -u lukas -vvvv
123.123.123.123 | FAILED! => {
"msg": "Timeout (7s) waiting for privilege escalation prompt: \u001b[?1h\u001b=\r\r"
}
SSHd日志
# /var/log/secure
Aug 26 13:36:19 master_server sudo: pam_unix(sudo:auth): conversation failed
Aug 26 13:36:19 master_server sudo: pam_unix(sudo:auth): auth could not identify password for [lukas]
推荐答案
我发现了问题.原来是 PAM的 auth 模块问题!让我描述一下如何解决.
I've found the problem. It turned out to be PAM's auth module problem! Let me describe how I got to the solution.
我设置了机器进行调试-即打开了四个终端窗口.
I set up my machine for debugging - that is I had four terminal windows opened.
- 第一终端(本地计算机):在这里,我正在执行
ansible prduction_server -m yum -a 'name=vim state=installed' -b -K -u username
- 第二终端(生产服务器):在这里,我执行了
journalctl -f
(系统范围的日志). - 第三终端(生产服务器):在这里,我执行了
tail -f /var/log/secure
(sshd的日志). - 第四终端(生产服务器):在这里,我正在编辑
vi /etc/pam.d/sudo
文件.
- 1st terminal (local machine): Here, I was executing
ansible prduction_server -m yum -a 'name=vim state=installed' -b -K -u username
- 2nd terminal (production server): Here, I executed
journalctl -f
(system wide log). - 3nd terminal (production server): Here, I executed
tail -f /var/log/secure
(log for sshd). - 4nd terminal (production server): Here, I was editing
vi /etc/pam.d/sudo
file.
每次,我从第一终端执行命令时,我收到以下错误消息:
Every time, I executed command from 1st terminal I got this errors:
# ansible error - on local machine
Timeout (7s) waiting for privilege escalation prompt error.
# sshd error - on remote machine
pam_unix(sudo:auth): conversation failed
pam_unix(sudo:auth): [username]
我向同事展示了我的整个设置,他告诉我该错误与"PAM" 有关.坦白说,这是我第一次听说 PAM .因此,我必须阅读此 PAM教程.
我发现,该错误与/etc/pam.d/sudo 模块中的 auth 界面有关.在Internet上挖掘时,我用sufficient
控件标记偶然发现了这个pam_permit.so
模块,从而解决了我的问题!
I showed my entire setup to my colleague, and he told me that the error had to do something with "PAM". Frankly, It was the first time that I've heard about PAM. So, I had to read this PAM Tutorial.
I figured out, that error relates to auth interface located in /etc/pam.d/sudo module. Diging over the internet, I stambled upon this pam_permit.so
module with sufficient
controll flag, that fixed my problem!
基本上,我添加的是/etc/pam.d/sudo
文件的auth sufficient pam_permit.so
行.看下面的例子.
Basically, what I added was auth sufficient pam_permit.so
line to /etc/pam.d/sudo
file. Look at the example below.
$ cat /etc/pam.d/sudo
#%PAM-1.0
# Fixing ssh "auth could not identify password for [username]"
auth sufficient pam_permit.so
# Below is original config
auth include system-auth
account include system-auth
password include system-auth
session optional pam_keyinit.so revoke
session required pam_limits.so
session include system-auth
结论:
我花了4天的时间来解决这个问题.我偶然发现了数十种不适用于我的解决方案,从"ansible主机/配置文件中的重复sudo密码" ,"ldap特定配置" 到获得建议总是脾气暴躁的系统管理员!
Conclusion:
I spent 4 days to arrive to this solution. I stumbled upon over a dozens solutions that did not worked for me, starting from "duplicated sudo password in ansible hosts/config file", "ldap specific configuration" to getting advice from always grumpy system admins!
由于我不是PAM专家,所以我不知道此修补程序是否会影响系统的其他方面,因此请谨慎复制粘贴此代码!但是,如果您是PAM的专家,请与我们分享替代解决方案或意见.谢谢!
这篇关于pam_unix(sudo:auth):对话失败,auth无法识别[用户名]的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!