使用socks4时的验证方法
我有一个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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
了解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 runningidentd
or it is not reachable from the server) and0x5D
(request failed because client'sidentd
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 anident
server that reports whatever it wants.Otherwise, switch to SOCKS v5 instead, which has support for true server-side authentication.