Continuando la discusión de Cómo configurar SMTP para usar localhost?:
Estoy intentando conectarme a Protonmail Bridge ejecutándose en la máquina host y falla con connection refused. Mis configuraciones son:
DISCOURSE_SMTP_ADDRESS: 172.17.0.1
DISCOURSE_SMTP_PORT: 1025
Ahora, pruebas con nmap:
nmap 127.0.0.1 en la máquina host muestra:
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
nmap 172.17.0.1 en el contenedor docker no muestra ningún puerto 1025.
También probé en mi archivo app.yml, en la sección expose:
172.17.0.1:1025:1025
Pero luego el contenedor docker no pudo iniciarse, dando el error “el puerto ya está en uso”.
Finalmente, si intento conectarme con openssl desde localhost:
openssl s_client -connect 127.0.01:1025 -starttls smtp
funciona bien; pero no cuando intento hacerlo desde el contenedor docker:
openssl s_client -connect 172.17.0.1:1025 -starttls smtp
Verificando con ss en la máquina host:
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))
¿Qué estoy haciendo mal?
Una cosa que encontré en esta respuesta de stackoverflow dice:
- solo podrás acceder a los servicios del host que estén (a) escuchando en
INADDR_ANY(también conocido como 0.0.0.0) o que estén escuchando explícitamente en la interfazdocker0.
Primero, comprobé iptables --list, que creo que da la salida predeterminada:
iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain DOCKER (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere 172.17.0.2 tcp dpt:https
ACCEPT tcp -- anywhere 172.17.0.2 tcp dpt:http
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source destination
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-2 (1 references)
target prot opt source destination
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere
Ahora, me pregunto si el servicio Protonmail Bridge que está escuchando en 127.0.0.1:1025 no está aceptando conexiones del contenedor Docker porque no son exactamente de 127.0.0.1?