使用客户端IP作为服务器IP

发布于 2024-08-12 20:25:51 字数 203 浏览 10 评论 0原文

这可能是“嗯,为什么?”之一。问题,但我认为值得一试。

如何从服务器端应用程序使用客户端 IP 地址作为另一个网站的应用程序 IP 地址?基本思想是,服务器端应用程序执行的任何工作都被视为客户端本身在执行工作,而不是服务器的静态 IP。

我不确定更改 HTTP 标头是否有效,但我可能是错的。有这方面的任何文档吗?

谢谢,

凯尔

This might be one of those "huh, why?" questions, but I figured it would be worth the try.

How would one, from a server-side application, use the clients IP address as the applications IP address to another website? The basic idea is that any work the server side application does, is seen as the client itself doing the work, and not the servers static IP.

I am not sure if changing HTTP headers would work, but I could be wrong. Is there any documentation out there on this?

Thanks,

Kyle

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

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

发布评论

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

评论(5

冰雪之触 2024-08-19 20:25:51

绝对、绝对不可能。您甚至无法打开 TCP 连接,因为其他网站的服务器将尝试与客户端握手,但会失败。

IP 地址不仅仅是任何旧 ID,它是服务器将向其发送任何响应的实际地址。基本上,只有当您可以将请求放入单个 IP 数据包(排除 TCP 和 HTTP)并且对响应不感兴趣时​​,欺骗它才有意义。即使如此,它也可能会失败,因为您的 ISP 路由器可能有反欺骗规则,会丢弃来自“内部”网络的“外部”IP 地址的数据包。

Utterly, utterly impossible. You won't even be able to open a TCP connection because the other website's server will try to handshake with the client, and fail.

An IP address isn't just any old ID, it's the actually address that servers will send any response to. Spoofing it basically only makes sense if you can fit your request into a single IP packet (which rules out TCP and thus HTTP) and are not interested in the response. Even then it can fail because your ISP's routers may have anti-spoofing rules that drop packets with "outside" IP addresses originating from "inside" networks.

银河中√捞星星 2024-08-19 20:25:51

到底为什么合法的应用程序想要欺骗其 IP 地址?

更改 HTTP 标头可能会解决这个问题,但很可能不会。取决于其他服务器的天真程度。

听起来您正在尝试以错误的方式做某事,您能否提供更多关于用例到底是什么的信息?

Why on earth would a legitimate application want to spoof its IP address?

Changing HTTP headers might cut it, but most likely it won't. Depends on how naive the other server is.

It sounds like you're trying to do something the wrong way, can you give a bit more information as to what exactly the use-case is?

零時差 2024-08-19 20:25:51

如果中间不需要进行任何处理,您可以在服务器的 IP 防火墙上进行端口转发,这样客户端就可以连接到您的服务器,但最终会与另一台服务器进行通信。

如果您的服务器参与更多,那么正确的做法是将客户端的 IP 作为 URL 的一部分(如果它是 Web 应用程序)或数据中的其他位置(如果不是)传递到其他服务器,以便接收服务器可以知道并正确记录该过程,无需任何伪造。当然,这也需要对其他应用程序进行更改。

If there's no processing to be done in between, you can do port forwarding on your server's IP firewall, so the client connects to your server but ends up talking to the other server.

If there's more involvement of your server, then the correct thing to do would be to pass the client's IP to the other server as part of the URL (if it's a web app) or elsewhere in the data (if not) so the receiving server can know and correctly log the process without any need for fakery. Of course this would also call for a change in the other app.

孤独患者 2024-08-19 20:25:51

再次假设我们正在谈论 HTTP,我想到的另一个想法是将您的客户端重定向到其他服务器。只要所有必要的数据都在 URI 中,您就可以建议客户端浏览器使用您自己创建的 URI 连接到其他服务器,该 URI 可以携带服务器处理添加到请求中的任何额外值。

Again assuming we're talking about HTTP, another idea that came to my mind would be to redirect your client to the other server. As long as all necessary data is in the URI, you could advise the client's browser to connect to the other server with a URI of your own creation that could carry whatever extra value your server's processing adds to the request.

赏烟花じ飞满天 2024-08-19 20:25:51

几十年前,互联网的设计者问道:“我们怎样才能阻止凯尔·罗森多(Kyle Rozendo)做这种不正当的事情?”

如果客户端配合,您可以在客户端计算机上安装一些软件,并从那里完成工作。例如,您的页面上有一个已签名的 Java 小程序。 [开玩笑]如果客户端不配合,安装一些木马病毒[/开玩笑]

Decades ago, the designer of internet asked, "how can we prevent Kyle Rozendo from doing such a devious thing?"

If the client is cooperating, you can install some software on client machine, and do the work from there. For example, a signed java applet on your page. [kidding]If the client is not cooperating, install some trojan virus[/kidding]

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