I suggest using SSH keys and not using passwords at all. Even if you don't do that I recommend disabling SSH logins as root directly. Either way you won't have to worry about your problem. Remember that if you block IPs on failed login attempts then you'll have to worry about denial of service that can allow anyone to deny you access to your own machine if he's behind the same NAT as you, etc. Also any attacker worth his salt would just distribute the attack across many IPs anyway.
发布评论
评论(2)
fail2ban (开箱即用,而且效果很好)
fail2ban (works out of the box, and works quite nicely)
我建议使用 SSH 密钥,而不使用密码。即使您不这样做,我也建议您直接以 root 身份禁用 SSH 登录。无论哪种方式,您都不必担心自己的问题。请记住,如果您在登录尝试失败时阻止 IP,那么您将不得不担心拒绝服务,如果任何人与您位于同一 NAT 后面,则可能会允许任何人拒绝您访问您自己的计算机,等等。还有任何值得攻击的攻击者无论如何,攻击都会分布在多个 IP 上。
I suggest using SSH keys and not using passwords at all. Even if you don't do that I recommend disabling SSH logins as root directly. Either way you won't have to worry about your problem. Remember that if you block IPs on failed login attempts then you'll have to worry about denial of service that can allow anyone to deny you access to your own machine if he's behind the same NAT as you, etc. Also any attacker worth his salt would just distribute the attack across many IPs anyway.