我最近检查了我的一个服务器auth.log
文件,发现了一些非常可疑的活动。我最近关闭了我服务器的 ssh 守护进程,所以日志在 1 月 22 日结束,但我在查看日志文件后发现所有 IP 地址都是中文的。
以下是最后 10 行失败的登录尝试:
$ cat auth.log | grep Failed | tail -n10
Jan 22 13:42:14 servername sshd[10306]: Failed password for root from 183.3.202.104 port 10894 ssh2
Jan 22 13:42:18 servername sshd[10306]: message repeated 2 times: [ Failed password for root from 183.3.202.104 port 10894 ssh2]
Jan 22 13:42:28 servername sshd[10365]: Failed password for root from 183.3.202.104 port 34140 ssh2
Jan 22 13:42:32 servername sshd[10365]: message repeated 2 times: [ Failed password for root from 183.3.202.104 port 34140 ssh2]
Jan 22 13:42:44 servername sshd[10423]: Failed password for root from 183.3.202.104 port 56290 ssh2
Jan 22 13:42:48 servername sshd[10423]: message repeated 2 times: [ Failed password for root from 183.3.202.104 port 56290 ssh2]
Jan 22 13:43:03 servername sshd[10511]: Failed password for root from 183.3.202.104 port 64153 ssh2
Jan 22 13:43:08 servername sshd[10511]: message repeated 2 times: [ Failed password for root from 183.3.202.104 port 64153 ssh2]
Jan 22 13:43:18 servername sshd[10569]: Failed password for root from 183.3.202.104 port 33472 ssh2
Jan 22 13:43:23 servername sshd[10569]: message repeated 2 times: [ Failed password for root from 183.3.202.104 port 33472 ssh2]
搜索非 183.3.202.104 IP 地址时,这些行变为:
$ cat auth.log | grep Failed | grep -v 183.3.202.104 | tail -n10
Jan 22 02:36:41 servername sshd[31074]: message repeated 5 times: [ Failed password for root from 221.203.142.71 port 33746 ssh2]
Jan 22 02:36:54 servername sshd[31388]: Failed password for root from 221.203.142.71 port 57792 ssh2
Jan 22 02:37:13 servername sshd[31388]: message repeated 5 times: [ Failed password for root from 221.203.142.71 port 57792 ssh2]
Jan 22 02:37:25 servername sshd[31698]: Failed password for root from 221.203.142.71 port 55440 ssh2
Jan 22 02:37:41 servername sshd[31698]: message repeated 5 times: [ Failed password for root from 221.203.142.71 port 55440 ssh2]
Jan 22 02:37:58 servername sshd[31918]: Failed password for root from 221.203.142.71 port 50225 ssh2
Jan 22 02:38:13 servername sshd[31918]: message repeated 5 times: [ Failed password for root from 221.203.142.71 port 50225 ssh2]
Jan 22 04:55:23 servername sshd[22179]: Failed password for invalid user support from 113.160.158.43 port 61614 ssh2
Jan 22 09:36:40 servername sshd[4160]: Failed password for invalid user a from 115.182.249.11 port 53046 ssh2
Jan 22 09:36:52 servername sshd[4204]: Failed password for invalid user oracle from 115.182.249.11 port 56673 ssh2
所以首先,我想确认这确实是一次攻击;我对管理系统安全性非常陌生。其次,我想知道有没有什么办法可以屏蔽所有中国IP地址;我的服务器目前只在美国使用,与中国无关。