-
以下IP地址对SSH服务进行攻击,在/etc/hosts.deny文件拒绝改ip访问。
链接:https://pan.baidu.com/s/1lQ8jWvZZ7KRgpBPSpGY_6Q 密码:pj3x
2.centos系统中/var/log/secure(Ubuntu日志貌似记录在/var/log/auto文件中)文件记录登录日志,可以吧Failure攻击SSH服务的ip地址刷选出来加入/etc/hosts/deny中即可
格式为:sshd:ip地址
查看/var/log/secure文件中的IP地址对本机SSH服务进行攻击的前二十个IP:
cat /var/log/secure | awk '/Failed/{print $(NF-3)}' | sort | uniq -c | awk '{print $2" = "$1;}' | sort -nrk3 | head -n 20
刷选出来的ip加入/etc/hosts.deny中:
cat /var/log/secure | awk '/Failed/{print $(NF-3)}' | sort | uniq -c | awk '{print "sshd:"$2;}' >> /etc/hosts.deny