SSH远程服务器发现很多次的登录失败,被攻击了吗?如何解决这个问题

2020年10月29日23:30:32 发表评论

今天ssh远程服务器,发现Last failed login: Mon Oct 5 04:52:34 CST 2020 from 47.110.180.42 on ssh:nottyThere were 319 failed login attempts since the last successful login. Last login: Mon Sep 28 00:03:00 2020如何解决这个问题

目前有两种办法解决这个问题

1 使用 ssh-keygen,禁用密码登陆

2.使用PAM模块,参考HowTo: Configure Linux To Track and Log Failed Login Attempt Records,其实就是登陆尝试次数设置和延时

第二种解决方案具体步骤

1 通过脚本获取尝试登陆失败的IP

2 将获取的IP写入到/etc/hosts.deny文件,进行屏蔽

3 使用inotify-tools,监控/var/log/secure文件,来实时更新/etc/hosts.deny文件

发表评论

您必须才能发表评论!