使用fail2ban来防止暴力破解linux服务器,结果。。。

in 云服务器 with 0 comment

那些专职搞破坏的畜生

从开始接触互联网,应该还是2000年左右,记得当时和一个小电脑专卖店老板关系不错,他拉了一条联通的100M的光纤到办公室,还带有固定IP。要知道,那时绝大部分国内互联网用户都还只是使用电话线来拔号上网,网速只有56K的样子。网吧倒是10M/100M,不过毕竟不带固定IP的。然后老板在办公室搞了一台电脑,装了个WIN2000,用作服务器。
那时候我就开始倒腾这台电脑,在上面装上asp/IIS环境,搞几个小网站玩。
结果有一天深夜,发现电脑数据有些奇怪,好多文件都打不开。重启电脑,发现所有文档全部消失,桌面上还有遗留的文档让打钱找回文档。这才意识到碰到黑客。之前大家都没什么安全意识的,还好电脑里也没什么重要资料,直接格式化重装,然后稍微设置了一下安全策略。
这是我第一次碰到黑客。

后面应该在2017年左右,我心血来潮在客厅里搞了一个小服务器,自己组的DIY电脑,主要用来远程下载,还有在家里的电视、手机上看电影,还有存放一些下载的电子书之类的东西。服务器装的是ESXI,虚拟了好多个系统,其中有个WIN10系统,我又打通了这个WIN10的主要端口到外网,方便在公司也能远程连接上去。
某天晚上也不知道发什么病,居然把超级管理员Administrator的密码,改成了123456,因为弄得太晚,就忘记修改回来了。结果第二天早上起来一看,中了勒索木马,所有文件全部上锁,让打比特币解锁。
没办法,只能删除这个虚拟机,重新挂一个上去。
第是我第二次碰到黑客。

后来就一直在玩云服务器,结果首先要解决的问题,就是遍布全网的暴力破解问题。

查询linux服务器SSH登录失败日志

使用以下命令查询SSH登录失败log:

utmpdump /var/log/btmp

不出意外,你就能看到一屏一屏的失败信息滚过。如果你一周不清理,你看下能滚个几分钟信不信?

防范措施

以上安装大家可以去搜索一下就好。实在不会,安装个宝塔,在安全里直接设置也比较方便。

今天想说的是,我查了一下我所有VPS的被fail2ban给封锁的IP来源。

大厂一般来说,有专门的网络安全配置,比如阿里云、腾讯云、亚马逊云、甲骨文云、UCLOUD等等,都有。不过我还有一些在国外淘的一些小厂VPS,这些只能依靠在系统里的安全措施保证自身安全。

今天去查了一下,上次说的那个性能非常差的土耳其VPS,fail2ban居然封锁了623个IP。。。

root@45:~# fail2ban-client status sshd
Status for the jail: sshd
|- Filter
|  |- Currently failed: 1
|  |- Total failed:     9100
|  `- File list:        /var/log/auth.log
`- Actions
   |- Currently banned: 623
   |- Total banned:     623
   `- Banned IP list:   1.117.233.118 1.117.70.195 1.12.240.127 1.12.255.45 1.13.159.117 1.13.188.57 1.14.226.190 1.197.78.123 101.126.70.9 101.132.144.228 101.32.194.186 101.34.218.206 101.34.250.251 101.34.252.72 101.36.231.233 101.42.164.72 101.42.166.44 101.43.118.80 101.43.160.137 101.43.88.35 101.43.92.81 102.223.92.101 103.115.24.11 103.130.145.236 103.130.212.202 103.143.249.129 103.170.204.115 103.231.40.36 103.235.34.82 103.236.253.29 103.255.216.43 103.31.226.155 103.44.237.68 103.84.236.242 104.131.73.79 104.168.100.175 104.248.174.139 104.248.228.79 104.249.156.250 104.28.211.192 106.12.112.171 106.12.167.196 106.13.223.14 106.14.171.140 106.225.196.151 106.52.93.130 106.54.8.223 106.55.181.104 106.55.181.235 106.55.187.66 106.55.54.56 106.55.57.164 107.172.108.217 107.173.153.235 107.182.20.3 110.235.243.121 110.40.150.68 110.40.192.96 110.42.246.184 110.44.126.98 111.229.10.52 111.229.29.113 111.231.80.10 111.62.142.14 112.13.76.166 112.161.86.234 113.106.63.54 113.31.114.37 114.219.56.217 114.98.235.127 116.198.203.50 117.27.118.123 117.27.88.61 117.50.190.75 117.64.237.58 117.72.15.113 117.72.16.117 117.83.178.140 118.70.134.18 119.255.245.44 119.4.250.94 119.45.219.32 119.91.214.145 119.91.31.153 119.91.32.36 119.91.40.51 119.91.78.12 12.156.67.18 120.234.204.246 120.48.122.45 120.48.38.132 120.48.74.47 120.53.88.44 120.89.98.72 121.126.37.211 121.5.244.205 121.5.71.176 121.9.250.122 122.225.31.9 124.126.75.104 124.220.162.56 124.220.96.73 124.221.128.115 124.221.136.242 124.221.178.202 124.221.89.71 124.222.110.32 124.222.133.216 124.222.138.152 124.222.247.193 124.223.109.183 124.223.164.41 124.223.43.10 124.235.224.14 124.43.18.35 125.63.92.226 125.91.33.72 128.199.194.1 128.199.241.112 128.199.98.192 128.199.99.204 129.150.60.218 129.151.44.205 129.226.209.249 129.226.89.244 129.226.92.40 134.175.129.189 134.175.223.67 134.175.229.235 134.209.174.155 134.209.19.26 134.209.31.33 137.184.166.124 137.184.24.153 138.197.31.240 139.224.105.5 14.103.47.110 14.18.92.211 14.225.255.208 141.5.100.61 141.95.158.59 141.98.210.41 141.98.7.213 142.93.63.89 143.244.190.52 144.217.173.156 147.139.212.237 147.182.245.3 150.109.24.40 150.158.144.155 150.158.35.73 150.158.37.5 150.185.5.5 150.95.30.112 150.95.30.155 154.198.212.244 154.8.156.154 157.230.247.165 157.245.147.5 157.245.154.225 158.220.105.238 158.69.48.204 159.203.60.162 159.223.193.55 159.223.237.140 159.28.66.99 159.75.139.191 159.75.4.174 161.18.228.75 162.19.25.67 162.241.208.68 164.90.182.73 164.92.74.47 165.154.163.202 165.227.101.226 165.232.158.187 167.71.99.157 167.99.129.0 170.106.103.24 170.106.113.27 170.106.153.108 170.106.172.144 170.106.192.5 170.106.197.113 170.106.99.33 172.104.164.6 172.104.192.219 172.245.57.172 172.247.38.199 173.47.101.43 174.138.26.173 174.138.54.13 175.166.88.31 175.178.180.239 175.178.2.44 175.178.34.163 175.178.71.95 175.27.239.13 175.4.49.172 175.6.141.237 177.153.69.10 178.128.91.164 178.176.250.107 178.177.40.47 178.238.225.162 179.51.153.37 179.95.180.141 180.151.215.230 180.76.166.33 180.76.250.158 180.94.161.180 182.42.234.23 182.43.235.218 182.44.75.253 182.52.21.251 185.126.1.143 185.162.235.138 185.183.243.140 185.183.243.60 185.202.113.234 185.218.20.93 185.227.137.54 185.227.137.57 185.252.234.173 185.255.90.36 185.46.18.99 185.74.5.184 185.81.154.124 187.157.135.152 187.188.240.7 187.84.112.136 188.166.145.213 188.166.178.230 188.166.184.204 189.126.4.42 189.244.55.22 190.12.102.58 190.12.106.242 190.146.5.153 191.252.179.62 191.252.181.100 191.252.195.148 192.241.157.126 194.152.206.17 194.209.191.243 194.87.146.88 196.220.67.231 198.12.85.199 2.180.41.182 20.244.178.58 20.71.215.181 201.124.82.195 201.186.40.250 201.231.255.236 202.137.26.6 202.139.199.93 202.185.12.124 202.65.158.178 203.195.173.239 206.189.41.22 206.189.45.206 206.81.25.18 207.154.245.38 207.35.136.227 209.141.58.142 209.38.229.174 210.73.214.228 210.87.195.112 210.91.73.167 211.159.166.97 211.253.10.96 213.165.188.134 217.71.207.183 218.206.136.24 218.56.160.82 218.94.28.22 220.181.114.54 221.226.183.94 222.128.87.64 222.211.70.30 222.219.131.94 222.255.115.237 222.71.175.10 223.18.72.180 223.240.105.90 23.94.83.12 27.155.77.232 27.71.16.216 34.126.71.110 34.140.65.171 34.171.171.156 34.81.214.64 34.84.82.194 34.92.143.190 35.202.12.242 35.226.126.79 36.103.211.88 36.111.187.119 36.134.70.142 36.137.0.81 36.137.112.13 36.153.0.227 37.113.26.6 41.175.18.170 41.77.11.130 42.192.8.64 42.193.19.22 42.194.196.180 43.128.101.97 43.128.68.235 43.128.68.45 43.128.88.108 43.129.50.235 43.130.59.111 43.130.61.210 43.133.58.37 43.133.60.251 43.133.77.92 43.133.82.136 43.134.129.107 43.134.178.163 43.134.180.30 43.134.22.17 43.134.226.170 43.134.231.46 43.135.140.48 43.135.155.217 43.135.159.108 43.135.166.230 43.135.172.115 43.136.80.235 43.138.0.96 43.138.126.73 43.138.157.184 43.138.216.217 43.138.87.174 43.139.171.132 43.139.54.124 43.140.225.242 43.140.252.68 43.143.177.236 43.143.243.121 43.153.103.74 43.153.110.61 43.153.195.114 43.153.196.37 43.153.212.115 43.153.225.154 43.153.27.134 43.153.30.11 43.153.4.150 43.153.68.200 43.153.76.36 43.153.87.16 43.154.189.227 43.154.239.200 43.155.138.135 43.156.114.18 43.156.117.232 43.156.124.108 43.156.134.43 43.156.14.158 43.156.16.109 43.156.238.160 43.156.239.137 43.156.38.16 43.156.39.45 43.156.77.105 43.156.83.163 43.159.133.39 43.159.35.57 43.159.46.253 43.163.219.169 43.247.13.122 44.208.155.41 45.173.130.126 45.20.209.253 45.225.195.250 46.245.93.42 46.249.98.203 47.102.137.27 47.102.142.208 47.102.144.202 47.102.151.13 47.109.92.235 47.245.89.5 49.232.113.85 49.232.26.35 49.234.218.57 49.235.135.82 49.247.31.251 49.51.178.89 49.51.196.102 49.7.206.13 5.29.135.63 51.83.131.5 57.128.200.181 58.221.62.191 58.34.180.42 58.56.20.70 58.8.178.196 60.208.131.117 61.136.164.15 62.234.16.162 62.234.168.183 62.234.29.14 64.119.29.156 64.226.119.58 64.226.120.7 64.227.137.183 64.227.177.112 68.183.18.215 68.183.236.193 69.49.246.48 72.167.132.247 74.208.243.40 77.105.147.91 77.68.117.176 77.91.70.64 79.137.202.87 79.183.158.99 8.215.26.47 8.219.238.25 8.222.153.123 8.222.158.122 80.210.18.170 81.17.24.130 81.170.214.174 81.192.87.130 81.69.249.202 81.70.90.226 82.102.12.130 84.54.51.180 85.240.58.125 86.104.38.239 88.201.185.71 89.179.126.155 89.190.203.54 91.235.136.127 92.114.19.110 94.102.125.123 95.111.236.145 95.156.72.34 43.134.174.158 139.59.178.77 117.68.110.114 175.178.56.243 82.157.6.212 159.65.113.139 77.91.78.166 43.134.20.231 156.232.6.238 191.252.210.180 34.91.0.68 114.132.201.92 116.196.80.54 144.217.13.134 43.153.48.149 43.155.91.190 139.59.27.154 154.221.25.18 27.128.174.164 43.134.3.202 174.138.24.127 182.75.65.22 212.18.19.196 20.169.248.82 106.55.178.174 51.158.99.178 84.52.103.234 182.254.141.117 124.220.157.77 157.245.147.26 154.92.23.218 43.156.133.239 124.156.140.229 43.134.176.185 124.156.204.21 114.132.201.106 85.18.236.229 157.245.204.102 159.75.179.86 137.184.185.77 178.128.93.152 195.88.208.38 43.128.88.27 125.129.82.220 124.223.76.183 134.209.108.136 43.134.231.58 194.163.155.210 117.33.250.38 162.241.87.50 165.232.167.69 160.251.138.186 200.1.219.138 89.252.131.116 43.135.26.50 146.190.58.73 196.0.120.211 45.130.20.158 198.71.57.187 118.25.141.189 34.126.160.149 121.41.60.220 175.178.114.15 139.199.192.171 46.101.3.129 106.12.120.232 103.146.16.52 185.126.34.211 168.232.79.91 124.13.155.196 43.134.162.156 182.79.68.42 69.49.245.160 106.13.211.17 43.156.9.243 157.245.216.87 137.184.96.200 187.189.213.55 118.27.32.140 60.244.70.4 43.128.81.234 103.244.232.110 195.155.67.231 101.32.31.213 61.80.179.118 110.227.203.10 124.222.89.71 82.156.151.198 81.17.21.234 103.140.194.87 170.106.147.157 141.11.246.250 198.100.154.31 119.189.0.15 39.108.170.100 124.221.23.193 43.247.156.241 64.225.48.214 211.47.49.116 101.43.5.153 112.133.225.72 120.92.111.55 66.98.112.247 195.178.191.5 187.72.57.84 182.61.2.136 167.71.202.205 106.12.121.227 43.153.110.16 198.16.63.175 43.154.154.86 217.18.63.130 95.167.221.138 77.237.98.70 43.156.42.123 137.184.112.37 43.159.198.109 106.227.89.165 170.106.195.8 103.74.105.172 95.236.65.129 43.153.82.238 223.17.0.181 124.220.179.246 49.7.154.4 43.139.6.199 49.233.142.22 132.248.65.8 59.127.158.223 103.7.41.144 106.51.1.72 157.245.192.215 5.188.31.162 172.173.138.110 162.0.216.94 174.138.26.189 190.128.241.2 62.234.39.158 185.180.204.233 43.159.147.202 165.227.224.30 1.15.141.77 79.104.0.82 216.10.245.180 43.138.194.39 159.75.52.94 23.95.14.155 14.63.62.165 122.176.93.67 45.10.154.15 103.226.138.171 106.52.69.186 148.66.132.204 51.77.58.143 152.136.201.219 180.167.207.234 117.34.71.28 172.104.4.139 61.240.138.240 159.65.41.104 191.252.202.173 122.38.251.9 178.128.16.191 175.178.101.2 139.198.179.54 31.13.39.220 132.247.232.152 198.12.85.154 103.167.88.250 46.148.227.158 147.182.141.239 8.210.64.91 35.244.25.124 167.71.136.141 105.28.108.165 47.113.189.177 43.134.0.112 43.155.159.250 43.155.146.138 182.16.255.176

好家伙,,,这是招了马蜂窝了
统计了一下:
2024-01-11T09:08:22.png

看看排名,第一名比第二名多出一倍多。

2024-01-11T09:12:32.png

运营商的分析,除了未知IP,前七位,基本全是国内运营商。

你们说,这说明了啥?

无语

什么样的环境成就什么样的人,和人生。
很多人会说,就说这个土耳其的小小小小运营商,能在那里买VPS的,会有什么重要的数据资料放在那里?甚至估计大部分连生产环境都不算。你破解,就算成功了,有个毛线的意义。

然而我们还是太年轻,这就像电诈一样,数据重要不重要,它这个事不重要,有人中招,中招的面积大了,总会有那么一点概率会有人打款的,对于那些畜生而言,就够了。

然而,那么多国内的服务器IP,要么蠢到用自己服务器去直接扫描,要么都成为了黑客们的肉鸡,被他们控制去进行扫描破解的活动,就这网络安全环境,那得差到什么地步?
我个人还是坚持认为,肉鸡很多,但一般不会这么用,所以,还是国内有太多心思不正常的畜生。

为什么?
没人管呗!
不发展到一定地步,他们是真的不会管的。祖孙几代都稳稳的吃喝贪腐,几千年的经验就是,没自己利益的事,不管。
这就造成了太多类似这种情况的局面,电诈是一个,什么地产、金融、足球。。。。方方面面,都是一样。

唉,可怎么办哟。。。。

只能说,趋势应该就到了,只是还缺少一根稻草。

Responses