为什么我的sshd日志显示对无效端口的多次尝试?


10

我的ssh守护程序设置为侦听2221端口。我还禁用了ssh的root登录。

我不明白为什么auth.log我会尝试登录其他端口(此处以4627为例)。

May 17 15:36:04 srv01 sshd[21682]: PAM service(sshd) ignoring max retries; 6 > 3
May 17 15:36:08 srv01 sshd[21706]: User root from 218.10.19.134 not allowed because none of user's groups are listed in AllowGroups
May 17 15:36:08 srv01 sshd[21706]: input_userauth_request: invalid user root [preauth]
May 17 15:36:10 srv01 sshd[21706]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=218.10.19.134  user=root
May 17 15:36:12 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2
May 17 15:36:15 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2
May 17 15:36:17 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2
May 17 15:36:19 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2
May 17 15:36:24 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2
May 17 15:36:27 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2
May 17 15:36:27 srv01 sshd[21706]: Disconnecting: Too many authentication failures for root [preauth]

SSHD应该考虑这些尝试。为什么日志中显示用户/密码不匹配,而用户/密码不应该接收请求(端口错误)?我想念什么吗?

Answers:


13

日志告诉您:

拥有IP地址218.10.19.134并来自端口的4627用户尝试多次以root用户身份使用密码登录。但:

  • 用户root仍然是invalid,日志只是通知您登录尝试
  • 尝试的登录方法是password身份验证(不是公钥或其他任何东西)
  • 源端口是4627,目标端口是2221(未写入日志,因为sshd仅在监听2221,sshd不会注意到对其他端口的任何其他尝试)
  • 经过一些尝试后,sshd通过disconnectingtcp连接阻止了登录

您会在日志中找到我答案的所有突出显示的词,除了2221


1
感谢您提供此答案,我将禁用密码身份验证以处理密钥。
kheraud

5

日志中给出的端口号是客户端的端口,而不是您的端口。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.