桌面应用程序环回连接 - 可靠且安全?

发布于 2025-01-04 11:06:33 字数 625 浏览 2 评论 0原文

我正在使用 C++ 为专业用户编写一个桌面应用程序。我当前的设计依赖于第三方 C++ 组件,其 API 基于 TCP/IP。要集成此组件可能需要修改它以用传统的 C++ API 替换网络代码。

如果我可以不修改组件并以预期的方式通过网络与其进行通信,那么事情会容易得多。为此,我需要将该组件作为服务器运行,侦听某些高端口上的环回连接。

我对这种环回方法有两个担忧。谁能减轻或证实我的恐惧?

可靠性和性能 环回连接可能会失败、被防病毒软件阻止或拦截。像这样的事情: 环回连接工作在用户的上下文,但无法通过本地系统帐户工作

安全性 我不太担心有人嗅探我的环回数据包,但我不希望我的服务器本身成为安全风险。让进程监听某个高端口有风险吗?

很多桌面应用程序都是这样操作的吗?

我最初是在 Windows 上进行开发,但将来可能会转向 Mac 和 Linux,因此这个问题适用于所有常见的桌面操作系统。

I am writing a Desktop application for professional users using C++. My current design relies on a third-party C++ component whose API is based on TCP/IP. To integrate this component might involve modifying it to replace the networking code with a conventional C++ API.

It would be a lot easier if I could leave the component unmodified and communicate with it in the way it expects - over the network. To do so I would need to run the component as a server listening on some high port for loopback connections.

I have two concerns with this loopback approach. Can anyone allay or confirm my fears?

Reliability and performance
The loopback connection might fail, be blocked or intercepted by antivirus software. Something like this: Loopback connections working in user's context but not working from Local System account

Security
I am not too concerned about someone sniffing my loopback packets but I don't want my server to become a security risk itself. Is it risky to have a process listening on some high port?

Do many desktop applications operate like this?

I am initially developing on Windows but may move to Mac and Linux in future so this question applies to all the common desktop OSs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天生の放荡 2025-01-11 11:06:34

可靠性:如果组件本身是可靠的,那么监听环回接口就没有问题。如果组件不可靠,那么最好通过环回接口与它对话,而不是直接调用它的函数。您可以轻松处理断开连接并重新启动组件以继续工作,但如果您链接到该组件,组件将会失败 - 您的应用程序也会失败。

性能:有一些性能损失。对于当前的 CPU 能力来说并不是很大。对于大多数应用程序来说,它应该是可以接受的。

安全性:组件应绑定到本地主机地址以避免安全问题。但具有足够访问级别的本地 3D 方软件(病毒)可以拦截甚至修改通信流。对于任何其他通信方法都相同。

环回连接使用广泛(java使用它进行互通,named使用它进行主服务控制等)

Reliability: if component itself is reliable then there's no problem with listening to loopback interface. If component is not reliable then it's better to talk with it via loopback interface instead of calling it's functions directly. You can easily handle disconnects and restart component to continue working, but if you would link to the component and component will fail - your app will fail too.

Performance: There's some performance penalty. Not really big with current CPU power. It should be acceptable for most applications.

Security: component should bind to localhost address to avoid security issues. But local 3-d party software (virus) software with sufficient access level can intercept or even modify communication streams. Same for any other method of communication.

Loopback connections are widly used (java uses it for intercommunication, named used it for master service control, etc.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文