使用socks4时的验证方法

发布于 2025-01-01 06:44:02 字数 233 浏览 3 评论 0原文

我有一个socks4 服务器,用于将来自不同类型的应用程序(http、ftp 等)的请求代理到目的地。

我知道socks4没有定义应用程序以任何方式进行身份验证的方法(当客户端连接到服务器时,它只指定一个可选用户名,但似乎没有办法告诉客户端这是应该发送该信息以便服务器中继请求)

是否有一种方法可以通过普通应用程序协议(http、ftp 等)可以理解的socks4 实现某种身份验证?

I have a socks4 server that I use to proxy requests from different kinds of applications (http, ftp, etc..) to their destination.

I know that socks4 does not define a way for applications to authenticate in any way (it specifies only an optional username when client connects to the server but it seems there is no way you can tell the client that is should send that information in order for the server to relay the request)

Is there a way to implement some kind of authentication over socks4 that is understood by the regular applications protocols: http, ftp, and others ?

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

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

发布评论

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

评论(1

素年丶 2025-01-08 06:44:02

了解SOCKS 协议的工作原理。

SOCKS v4/4a 响应的第二个字节是一个状态值,指示客户端的请求是被接受还是被拒绝(以及原因)。在这种情况下,您可能需要使用状态值 0x5C(请求失败,因为客户端未运行 identd 或无法从服务器访问)和 0x5D (请求失败,因为客户端的 identd 无法确认请求中的用户 ID 字符串)。这将使请求的用户名字段必须包含有效且可识别的值。当然,这不是真正的身份验证,因为客户端可以运行一个 ident 服务器来报告它想要的任何内容。

否则,请改用 SOCKS v5,它支持真正的服务器端身份验证。

Read up on how the SOCKS protocol works.

The second byte of a SOCKS v4/4a response is a status value that indicates whether the client's request was accepted or rejected (and why). In this case, you would likely need to use status values 0x5C (request failed because client is not running identd or it is not reachable from the server) and 0x5D (request failed because client's identd could not confirm the user ID string in the request). That would make the request's username field have to contain a valid and recognizable value. This is not true authentication, of course, since a client can run an ident server that reports whatever it wants.

Otherwise, switch to SOCKS v5 instead, which has support for true server-side authentication.

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