在几个系统上,我有这个sshd_config
Port 22 Protocol 2 PermitRootLogin no StrictModes yes PasswordAuthentication no ChallengeResponseAuthentication no MaxStartups 2 AllowUsers john joe
任何人都可以解释键盘交互和密码validation之间的区别吗? 我如何testing我的sshd服务器?
这些系统可以通过互联网使用SSH访问(防火墙端口转发)。 尽pipeclosures了密码authentication,我仍然看到无效用户的系统日志logging和无效的密码被sshd拒绝 – 显然有些僵尸networking试图进行暴力密码猜测。
如果我尝试在没有设置公用密钥的情况下sshlogin,那么在有机会input用户名之前,我的会话将被closures,并显示“Permission denied(publickey)”权限。 所以我不明白这些密码尝试是如何发生的。
这是一个来自系统日志的例子(所有行前缀'Oct 12 08:40:49 host sshd [14790]:')
Could not reverse map address 203.0.113.1. User root not allowed because not listed in AllowUsers input_userauth_request: illegal user root Failed password for illegal user root from 203.0.113.1 port 35902 ssh2 Received disconnect from 203.0.113.1: 11: Bye Bye
这些无效的密码是如何通过的? 服务器是否仍然易受密码猜测的影响?
AFAIK使用PasswordAuthentication客户端提示input您的用户名和密码,然后发送到服务器。 在键盘交互式的客户端请求你的用户名,把它发送到服务器,然后服务器回应一个密码提示,然后通过客户端传回给你。
整个事情已经完成,以便能够实施进一步的安全措施,以确保您(用户)实际上交互式input密码,而不是以某种方式存储,然后才input。
PasswordAuthentication只是KbdInteractiveAuthentication(ssh_config和sshd_config中使用的实际关键字)的一种types。
KbdInteractiveAuthentication涵盖了多种方法:S / Key是另一种,就像PAM一样。 (这是一个RFC规范, 这里logging
您可以在ssh_config中指定一个KbdInteractiveDevices列表。 (如果没有指定,则需要服务器列表。由于在sshd_config中没有这个选项,所以我假设它是一个编译时选项,但是我没有validation它。)
我不认为manpages( ssh_config和sshd_config )对于理解这里的关系特别有帮助,但O'Reilly的SSH书是一个很好的参考。