Configurazione SMTP per usare localhost o 172.17.0.1 non funziona, come fare il debug

Continuando a discussão de Come impostare la configurazione SMTP per usare localhost?:

Sto cercando di connettermi a Protonmail Bridge in esecuzione sulla macchina host e fallisce con connection refused. Le mie impostazioni sono:

  DISCOURSE_SMTP_ADDRESS: 172.17.0.1
  DISCOURSE_SMTP_PORT: 1025

Ora, test nmap:

nmap 127.0.0.1 sulla macchina host restituisce:

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 nel container docker non restituisce alcuna porta 1025

Ho anche provato nel mio file app.yml, nella sezione expose:

172.17.0.1:1025:1025

Ma poi il container docker non è riuscito ad avviarsi con l’errore “la porta è già in uso”.

Infine, se provo a connettermi con openssl da localhost:

openssl s_client -connect 127.0.01:1025 -starttls smtp

funziona bene; ma non quando provo dal container docker:

openssl s_client -connect 172.17.0.1:1025 -starttls smtp

Verificando con ss sulla macchina 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))

Cosa sto sbagliando?


Una cosa che ho trovato in questa risposta di stackoverflow dice:

  • sarai in grado di accedere ai servizi host che sono o (a) in ascolto su INADDR_ANY (alias 0.0.0.0) o che sono esplicitamente in ascolto sull’interfaccia docker0.

Innanzitutto, ho controllato iptables --list, che credo dia l’output predefinito:

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

Ora, mi chiedo se il servizio Protonmail Bridge che è in ascolto su 127.0.0.1:1025 non accetta connessioni dal container Docker perché non provengono esattamente da 127.0.0.1?

A quanto pare il traffico deve essere reindirizzato, leggi di più qui:

1 Mi Piace

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.