大网数据广告活动
服务器运维问答

DigitalOcean Network Firewall allowing SSH connections on ports other than only 22

· 52CE 我爱测

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 …

问题原文

原帖链接 · 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?

  1. There was ssh client request to connect as user antonio, which does not exist on the system
  2. Request came from the IP address 43.153.179.44
  3. 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-12-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。