问题原文
原帖链接 · Ouss · CC BY-SA 4.0
I have a droplet on DigitalOcean with IPv4 and IPv6 enabled. The droplet is behind a digital ocean network firewall with the following rules:
Inbound:
- SSH TCP 22 All IPv4, All IPv6
- HTTP TCP 80 All IPv4, All IPv6
- HTTP TCP 443 All IPv4, All IPv6
Outbound:
- ICMP ICMP All IPv4 All IPv6
- All TCP TCP All ports All IPv4 All IPv6
- All UDP UDP All ports All IPv4
My understanding and expectation is that will block all ssh attempts on ports other than port 22. However when checking the sshd unit in systemd journal. I see the following entries:
2022-12-29 03:00:32 Disconnected from invalid user antonio 43.153.179.44 port 45614 [preauth]
2022-12-29 03:00:32 Received disconnect from 43.153.179.44 port 45614:11: Bye Bye [preauth]
2022-12-29 03:00:31 Invalid user antonio from 43.153.179.44 port 45614
2022-12-29 02:58:37 Disconnected from invalid user desliga 190.129.122.3 port 1199 [preauth]
2022-12-29 02:58:37 Received disconnect from 190.129.122.3 port 1199:11: Bye Bye [preauth]
2022-12-29 02:58:37 Invalid user desliga from 190.129.122.3 port 1199
and many more of these lines, which means the firewall is not blocking ssh connections on ports other than 22.
The following graph shows the number of ssh connections to ports other than 22 in the last hour. The connections are reduced with enabling the Network Filter, but they not diminished.
Could it be that the Network Firewall of DigitalOcean is broken?
What am I missing?
Anyone is seeing the same situation on their infrastructure?
已采纳解答
原帖链接 · dexter · CC BY-SA 4.0
Services are listening on certain port, e.g. sshd on port 22 by default. It means that if there is ssh client request to establish connection on the port other than 22 it would not be heard by the sshd service at all. There would be no trace in the log file for sshd for this request.
In this case, that requests are actually coming on the port 22.
What does Invalid user antonio from 43.153.179.44 port 45614 means actually?
- There was ssh client request to connect as user
antonio, which does not exist on the system - Request came from the IP address
43.153.179.44 - Port number of the ssh client used for connection was
45614, it is the port number on the client side not on your droplet.
Could it be that the Network Firewall of DigitalOcean is broken?
This is very unlikely.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
