首页 > 解决方案 > 如何通过 Dante socks 代理配置 SOCKS4 身份验证

问题描述

我能够使用 Dante socks 代理配置 socks4、socks5 和 socks5 的身份验证,但我不知道如何配置 socks4 的身份验证。我知道 socks_v4 代理仅支持 userId(不是密码)。

我的 danted.conf 文件如下所示:

logoutput: syslog
internal: eth0 port =1081
external: eth0
user.privileged: root
user.unprivileged: nobody
socksmethod: username
clientmethod: none

client pass {
        from: 0.0.0.0/0
        to: 0.0.0.0/0
        log: error
}

socks pass {
        from: 0.0.0.0/0
        to: 0.0.0.0/0
        command: bind connect udpassociate
        protocol: tcp udp
        proxyprotocol: socks_v4
        log: error
        socksmethod:username
}

我得到了错误

#username and password
curl -x socks4://user1:user1@x.2xx.1xx.x:1081 http://google.com
curl: (7) Can't complete SOCKS4 connection to 142.250.73.206:80. (91), request rejected or failed.

#just username
curl -x socks4://user1@x.2xx.1xx.x:1081 http://google.com
curl: (7) Can't complete SOCKS4 connection to 142.250.73.206:80. (91), request rejected or failed.

#no auth
curl -x socks4://x.2xx.1xx.x:1081 http://google.com
curl: (7) Can't complete SOCKS4 connection to 142.250.73.206:80. (91), request rejected or failed.

标签: proxysocksdante

解决方案


SOCKS 协议版本 4 不支持身份验证方法“用户名”,仅 SOCKS v5 支持。当您将 Dante 配置为要求所有客户端的“方法:用户名”时,您实际上阻止了所有 SOCKS v4 客户端。

您的配置的其他问题是 SOCKS v4 不支持 UDP,因此您的 socks-rule 中的设置也没有多大意义。

您应该将 Dante 配置为记录,并查看 Dante 日志。由于是 Dante 阻止了连接,因此在 Dante 日志中更容易看到原因是什么。Dante 可能还会在其日志文件中报告您的 danted.conf 的一些问题。


推荐阅读