-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Podman 5.0 的破坏性更新使得 Rootless 模式下 socks5 服务器无法正常收到任何请求 #339
Comments
我在基于WSL2的podman 5.0中使用rootless模式启动容器,尝试socks连接时使用wsl虚拟机的ip可以成功连上。 |
感谢两位的反馈!我测试了一下,看起来 Pasta 的默认行为是:从宿主机的哪个网络接口入站的,在容器里面也在同一接口入站。这也可以解释为什么从外部可以访问到,而直接在宿主机访问 127.0.0.1 却不行: danted 没有监听 lo。 docker-easyconnect/docker-root/usr/local/bin/start.sh Lines 50 to 58 in e9a7b23
我得询问这部分的贡献者有没有这样做(排除 lo)的特别的原因再去修改。 |
在容器内部,slirp4netns使用tap0与宿主机通信,pasta直接使用宿主机的接口。 |
@w568w 能否帮忙测试下,internal直接监听0.0.0.0 具体步骤如下 容器内执行
修改danted.conf,删除原先internal开头的行,改成
查找包含 /usr/sbin/danted -D -f /run/danted.conf的行,类似
|
已经测试,pasta 模式下按此操作后可以正常通过 socks5 代理访问网站。 |
@w568w 测试时代理是全局的吗。还有个点忘记让你帮忙测试了。全局代理的情况下,访问百度之类的网站是否正常 |
我直接用 Curl 测试的。
都是正常的: $ curl -skx socks://127.0.0.1:1080 https://<学校内网 IP> | tail -n 10
</div>
<script type="text/javascript">
/* Hide everything classed as "noscript" */
document.querySelectorAll('.noscript').forEach(function(element){
element.hidden = true;
});
</script>
</body>
</html>
$ curl -skx socks://127.0.0.1:1080 https://baidu.com | tail -n 10
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>bfe/1.0.8.18</center>
</body>
</html> |
感谢帮忙测试
w568w ***@***.***> 于 2024年5月21日周二 17:41写道:
… 测试时代理是全局的吗
我直接用 Curl 测试的。
访问百度之类的网站是否正常
都是正常的:
$ curl -skx socks://127.0.0.1:1080 https://<学校内网 IP> | tail -n 10
</div>
<script type="text/javascript">
/* Hide everything classed as "noscript" */
document.querySelectorAll('.noscript').forEach(function(element){
element.hidden = true;
});
</script></body></html>
$ curl -skx socks://127.0.0.1:1080 https://baidu.com | tail -n 10<html><head><title>302 Found</title></head><body bgcolor="white"><center><h1>302 Found</h1></center><hr><center>bfe/1.0.8.18</center></body></html>
—
Reply to this email directly, view it on GitHub
<#339 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEBARTVXHBSROMDCHESICMLZDMJDBAVCNFSM6AAAAABFHQOLCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRSGIYDSOBTHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
…g to IP address
@w568w 感谢反馈。可以试一下重新 |
问题
Podman 升级到 5.0 之后,Rootless 模式下运行本项目的 cli 版本,http 代理正常,但 socks5 代理无法连接。实际上,socks5 代理看起来没有收到任何请求。
在 Podman 5.0 更新公告 中,提到:
原先的默认网络后端是 slirp4netns,而 5.0 中变更为 pasta。
这两者的行为很不一致,例如前者会创建名为
tap0
的虚拟接口,后者则会将宿主机的网络接口名映射到内部。start.sh
从几个端口中猜测内部接口名($internals
):docker-easyconnect/docker-root/usr/local/bin/start.sh
Lines 50 to 58 in e9a7b23
在我的设备上,slirp4netns 模式下获得的接口名是
tap0
,而 pasta 下是wlps0
(和主机网络接口名相同)。该脚本将该接口名传递给 dante 程序,使之仅监听
$internals
接口。然而,在 pasta 模式下,监听wlps0
将不会收到任何请求。具体原因还需查明,但我猜测 pasta 仅会转发去往 localhost 的请求(即lo
接口),或者是由于网络接口名变化,脚本中某些地方的防火墙配置出现了问题。另一方面,http 代理可以正常工作。我猜想这是因为它监听了所有网络接口。
太长不看:一个简单粗暴的解决方案是要求创建容器时添加
--network slirp4netns
,从而设置网络模式为原先的模式。相关信息
系统:Archlinux x86_64
Podman 版本:5.0.0
启动参数(请以普通用户身份执行以复现该 bug,不要用 root 或 sudo):
容器内执行
ip addr
,pasta 模式下(socks5 异常):容器内执行
ip addr
,slirp4netns 模式下(socks5 正常):容器内执行
cat /run/danted.conf
,slirp4netns 模式下(socks5 正常):容器内执行
cat /run/danted.conf
,pasta 模式下和上面唯一的区别是internal: tap0 port = 1080
变成了internal: wlp4s0 port = 1080
。The text was updated successfully, but these errors were encountered: