Loomio
Mon 5 Feb 2018 10:11PM

Mailserver refuses connection from inside Loomios containers

T telegnom Public Seen by 47

Hello,

I tried to install loomio on my own server, but I failed enabling loomio to send out emails.

I can reach my mailserver from the docker host. And with openssl's c_client I get a connect on the expected port. But when I try the same from within the docker container I only receive a connection refused. But the mailserver itself is reachable from within the container, at least it responds to pings, sent from the container.

root@tool3 ~ # openssl s_client -connect my.mail.server:587
CONNECTED(00000003)
139820236264704:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:252:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 5 bytes and written 176 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : 0000
    Session-ID: 
    Session-ID-ctx: 
    Master-Key: 
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1517868325
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
    Extended master secret: no
---
root@tool3 ~ # 
root@tool3 ~ # docker exec -ti loomiodeploy_worker_1 openssl s_client -connect my.mail.server:587
connect: Connection refused
connect:errno=111

root@tool3 ~ # docker exec -ti loomiodeploy_worker_1 ping my.mail.server
PING my.mail.server (1.2.3.4): 56 data bytes
64 bytes from 1.2.3.4: icmp_seq=0 ttl=54 time=3.296 ms
64 bytes from 1.2.3.4: icmp_seq=1 ttl=54 time=3.220 ms
64 bytes from 1.2.3.4: icmp_seq=2 ttl=54 time=3.146 ms
^C--- my.mail.server ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 3.146/3.221/3.296/0.061 ms
root@tool3 ~ # 

Any ideas what the problem might be or how to fix this issue?

Cheers,
telegnom

RG

Robert Guthrie Tue 6 Feb 2018 2:41AM

Hi @telegnom4. Thanks for giving Loomio a go.

Is your mailserver being used by other applications successfully?

Is your Loomio docker image updated to the latest? ie:
docker-compose pull && docker-compose down && docker-compose up -d

Can you show me the error you're getting when Loomio tries to send an email?

T

telegnom Tue 6 Feb 2018 4:41PM

Hi,
yes the mailserver is in use since several years and so far I didn't had probles like this.

I'm on the newest images and tried to rebuild the containers several times during the last days.

Okay, sofar I figured out, that it is a problem with IPv6. The Mailserver has IPv6 enabled, but the docker container has no ipv6 gateway :/

I'll try to add a ipv6 gateway and report again.

T

telegnom Sun 18 Feb 2018 10:02AM

So, finally I fixed the problem. The solution was not as straight forward as I thought, because docker and ipv6 feels like a mess...
1. Enable ipv6 support in docker engine
1. create custom docker network and assign an ipv6 prefix
1. add custom network to worker in compose file
1. rebuild the containers
1. have fun