动态应用级端口转发 ( ssh -D) 不支持此功能。看看Dante 吧:
[I] net-proxy/dante
Available versions: 1.1.19-r4 (~)1.2.3 (~)1.3.0 (~)1.3.1 (~)1.3.1-r1 (~)1.3.2 {debug kerberos pam selinux static-libs tcpd}
Installed versions: 1.3.2(04:14:03 PM 11/08/2011)(pam static-libs tcpd -debug -kerberos -selinux)
Homepage: http://www.inet.no/dante/
Description: A free socks4,5 and msproxy implementation
Run Code Online (Sandbox Code Playgroud)
但请注意,密码以明文形式传输。
要配置基于用户名的身份验证,请打开/etc/sockd.conf文件并添加/更改以下内容:
logoutput: syslog /var/log/dante.log
# methods for socks-rules.
method: username #rfc931
# when doing something that can require privilege,
# it will use the userid "sockd".
user.privileged: root
# when running as usual,
# it will use the unprivileged userid of "sockd".
user.notprivileged: sockd
pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
protocol: tcp udp
command: bind connect udpassociate
log: error
method: username
}
Run Code Online (Sandbox Code Playgroud)
启动后检查监听套接字:
# netstat -nlp | grep sockd
tcp 0 0 127.0.0.1:1080 0.0.0.0:* LISTEN 5463/sockd
tcp 0 0 192.168.15.36:1080 0.0.0.0:* LISTEN 5463/sockd
Run Code Online (Sandbox Code Playgroud)
如果出现错误,请查看日志文件(/var/log/messages或/var/log/dante.log)。
PS:系统密码文件(/etc/passwd)用于验证用户名和密码组合。
ssh -D不需要密码即可访问,并且在当前的实现中也无法要求密码。如果需要,您可以使用现有的 http 服务器(例如 apache)设置多级代理,然后使用 ssh 隧道进行出站连接。
话又说回来,如果你已经陷入困境,那么你可能走错了路,也许需要重新思考你想要实现的目标。