简体   繁体   English

无法从 Docker 容器连接到 Protonmail Bridge SMTP(主机)

[英]Cannot connect to Protonmail Bridge SMTP (host machine) from a Docker container

My setup is:我的设置是:

  • Debian, Docker Debian, Docker
  • Host machine running Protonmail Bridge as a service将 Protonmail Bridge 作为服务运行的主机
  • Docker container running Discourse with their default recommended setup Docker 容器使用默认推荐设置运行 Discourse

Issue: From the Docker container, I cannot connect to the SMTP server exposed by the Protonmail Bridge on the host machine.问题:从 Docker 容器,我无法连接到主机上 Protonmail 桥暴露的 SMTP 服务器。

I checked open ports on the host machine, all good:我检查了主机上的开放端口,一切都很好:

ss -plnt
State  Recv-Q  Send-Q  Local Address:Port  Peer Address:Port  Process
LISTEN   0      4096       127.0.0.1:1025      0.0.0.0:*    users:(("proton-bridge",pid=953,fd=12))

How I test我如何测试

Host machine: openssl s_client -connect 127.0.01:1025 -starttls smtp Works.主机: openssl s_client -connect 127.0.01:1025 -starttls smtp工作。

Docker container: openssl s_client -connect 172.17.0.1:1025 -starttls smtp Connection refused. Docker 容器: openssl s_client -connect 172.17.0.1:1025 -starttls smtp连接被拒绝。

I'm wondering if the Protonmail Bridge service that's listening on 127.0.0.1:1025 is not accepting connections from the Docker container because they are not coming from 127.0.0.1 exactly?我想知道在127.0.0.1:1025上侦听的 Protonmail Bridge 服务是否不接受来自 Docker 容器的连接,因为它们不完全来自127.0.0.1 If this is the problem, how to validate and fix?如果这是问题,如何验证和修复? If this is not the problem, what am I doing wrong?如果这不是问题,我做错了什么?

Other tests其他测试

nmap 127.0.0.1 on the host machine outputs:主机上的nmap 127.0.0.1输出:

Nmap scan report for localhost (127.0.0.1)
Host is up (0.000010s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
1025/tcp open  NFS-or-IIS
1042/tcp open  afrog

Note that it lists the open port 1025.请注意,它列出了开放的端口 1025。

nmap 172.17.0.1 in the docker container does not output any 1025 port. docker 容器中的nmap 172.17.0.1没有 output 任何 1025 端口。 I'm not sure if this is the problem either.我也不确定这是否是问题所在。

Output of route in the Docker container: Docker容器中route的Output:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.17.0.1      0.0.0.0         UG    0      0        0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0

This may be impossible currently, but should be solved by this pull request .目前这可能是不可能的,但应该通过这个 pull request来解决。

If you're comfortable compiling the proton-bridge package from source, you only have to change 1 line in the internal/bridge/constants.go file to say如果您愿意从源代码编译proton-bridge package,您只需更改internal/bridge/constants.go文件中的 1 行即可

Host = '127.0.0.1'

To

Host = '0.0.0.0'

Then recompile with make build-nogui (to build the "headless" version).然后使用make build-nogui重新编译(构建“无头”版本)。

And you should be good to go!你应该很高兴去!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM