如何使端口安全

How to make a port secure

我们正在开发一个服务器应用程序,它将 24/7 全天候侦听来自外部设备的所有连接 (TCPListener),并将这些消息存储在我们的数据库中。

对于这些连接,我们在我们的服务器中打开一个端口(比方说 13002)。我们希望使此端口安全,这意味着有人将无法扫描端口,无法连接并向此特定端口发送数千个请求,从而使我们的应用程序变慢甚至出现故障。

有什么想法吗?

使用 firewall.

In computing, a firewall is a network security system that monitors and controls the incoming and outgoing network traffic based on predetermined security rules. A firewall typically establishes a barrier between a trusted, secure internal network and another outside network, such as the Internet, that is assumed to not be secure or trusted.

如果给出的是您对 "secure" 的定义:

someone will not be able to scan ports, and connect and send thousands of requests to this specific port

然后正确配置的防火墙就可以了。

但这并不能阻止恶意用户对您的软件造成损害。如果有人可以通过数据包检查找出您使用的协议,他们就可以向您的应用程序发出任意请求。

这意味着如果您的协议设计不当,用户可以冒充其他用户,发送他们不应该发送的消息,从而执行他们不允许的操作。

只是在两者之间放置防火墙不会使您的协议更安全。