WenRou's Blog

新浪微薄腾讯微薄

最新碎语:测试图片碎语哦

您的位置:WenRou's Blog >分享> 自动更新SSH黑名单,5分钟更新一次

自动更新SSH黑名单,5分钟更新一次

使用LINUX VPS或者云主机最苦恼的事就是N多的SSH试探,Linux或Unix管理员都会发现自己系统每时每刻都在被大量的主机试探密码,并试图控制该主机。目前大部分用户都是通过防火墙封锁TCP/22端口,有部分管理员习惯把SSH监听端口改成2222等一些非默认端口,也可以在一定程度上防止密码试探。

经过努力,东北大学网络应急响应组通过部署相应的SSH攻击采集程序,收集了部分发起SSH攻击的主机IP地址,连接地址为:http://antivirus.neu.edu.cn/ssh/lists/neu.txt,列表每5分钟更新一次,生成新的hosts.deny列表,链接地址:http://antivirus.neu.edu.cn/ssh/lists/neu_sshbl_hosts.deny,Linux或Unix管理员可以通过更新hosts.deny文件来防止主机被攻击。

执行SSH黑名单自动更新脚本:

1、检查sshd是否支持TCP Wrapper

ldd `which sshd` | grep libwrap

输出类似:libwrap.so.0 => /lib/libwrap.so.0 (0x00bd1000)

2、一键安装脚本!

wget xn--doqp8v.top/SSH/heimingdan.sh && bash heimingdan.sh

手动执行:more /etc/hosts.deny 检查是否自动更新
若显示未更新,说明系统没有安装 curl !

一键脚本内容,来自东北大学网络集成为SH脚本,方便使用,可复制一下代码自行创建SH文件执行即可!

cd /usr/local/bin/
wget antivirus.neu.edu.cn/ssh/soft/fetch_neusshbl.sh
echo "Download the script is finished!";
chmod +x fetch_neusshbl.sh
cd /etc/cron.hourly/
ln -s /usr/local/bin/fetch_neusshbl.sh .
./fetch_neusshbl.sh
echo "The completion of the execution!";
echo "Manual execution: more /etc/hosts.deny Whether to check for updates automatically";
echo "If the display is not updated, show that the system is not installed curl";

原文链接:

---

转载请注明本文标题和链接:《自动更新SSH黑名单,5分钟更新一次

发表评论

59 + 6 =
路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交