代码改变世界

JumpServer报“认证失败 Authentication Error”小案例分析

2020-06-23 16:45  潇湘隐者  阅读(1268)  评论(0编辑  收藏

在JumpServer里面跳转到一台MySQL服务器时,出现下面错误认证失败 Authentication Error

 

Opt or ID>: 5
 
Only match Host:  xxxx 
 
Connecting xxxx ...
 
认证失败 Authentication Error.

 

首先检查JumpServer的日志 /opt/jumpserver/logs/jumpserver.log,发现下面一些日志信息

 

2020-06-23 15:43:15,581 - connect.py - DEBUG - {'ip': u'192.168.xxx.xxx', 'role_name': u'xxxxx', 'role_key': u'/opt/jumpserver/keys/user/xxxxx_xxxxx.pem', 'user': <User: xxxxx>, 'role_pass': 'xxxxx', 'port': 22, 'asset': <Asset: 192.168.xxx.xxx>}
 
2020-06-23 15:43:17,815 - connect.py - WARNING - 使用ssh key /opt/jumpserver/keys/user/xxxxx_xxxxx.pem 失败, 尝试只使用密码

 

然后从控制台登录那台需要连接的服务器上,看到如下所示日志信息

 

Jun 23 16:02:12 xxxxx sshd[24534]: User xxxxx from xxxxx not allowed because not listed in AllowUsers

Jun 23 16:02:12 xxxxx sshd[24535]: input_userauth_request: invalid user xxxxx

Jun 23 16:02:12 xxxxx sshd[24534]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=xxxxx  user=xxxxx

Jun 23 16:02:14 xxxxx sshd[24534]: Failed password for invalid user xxxxx from xxxxx port 54441 ssh2

Jun 23 16:02:14 xxxxx sshd[24536]: User xxxxx from xxxxx not allowed because not listed in AllowUsers

Jun 23 16:02:14 xxxxx sshd[24537]: input_userauth_request: invalid user xxxxx

Jun 23 16:02:14 xxxxx sshd[24536]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=xxxxx  user=xxxxx

Jun 23 16:02:16 xxxxx sshd[24536]: Failed password for invalid user xxxxx from xxxxx port 54445 ssh2

Jun 23 16:02:16 xxxxx sshd[24537]: Connection closed by xxxxx

Jun 23 16:02:16 xxxxx sshd[24535]: Connection closed by xxxxx

 

检查 /etc/ssh/sshd_config,发现JumpServer服务器的IP地址被注释了。应该是某个时候,粗心大意给释掉的。然后就出现了这一幕,从JumpServer跳转到这台服务器时报认证失败 Authentication Error

 

#AllowUsers *@192.168.xxx.xxx

 

解决方法取消JumpServer主机的注释重启sshd服务。问题解决。