namshi / docker-smtp

SMTP docker container
MIT License
548 stars 199 forks source link

add ipv6 addresses to dc_relay_nets #78

Open matthijskooijman opened 3 years ago

matthijskooijman commented 3 years ago

Previously, this added all connected ipv4 networks to enable relaying for all direclty connected hosts, but if a host would connect through an ipv6-enabled network and actually uses an ipv6 connection, relay would suddenly be denied.

This commit also includes all ipv6 addresses, just like ipv4 addresses. Note that Exim uses : as a separator between entries in this list, so any : inside the ipv6 address must be doubled.

This also adds scope global to the ip address show command, to prevent also picking up link-local addresses. This should not normally affect the ipv4 address, since those are normally global scope anyway.

matthijskooijman commented 3 years ago

Note that enabling ipv6 on docker is not as trivial as it should be currently. It might be a matter of switching on ipv6 on the default network, but I have a more complicated setup with different networks with static ipv6 configuration, so I can't quickly give you details on how to reproduce this issue.

However, I can show you how the ip addr output looks on my smtp docker instance:

root@4ec6869d6468:/# ip address show eth0
443: eth0@if444: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ac:50:03:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.80.3.2/24 brd 172.80.3.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fd00:dead:beef:3::2/64 scope global nodad 
       valid_lft forever preferred_lft forever
    inet6 fe80::42:acff:fe50:302/64 scope link 
       valid_lft forever preferred_lft forever
root@4ec6869d6468:/# cat /etc/exim4/update-exim4.conf.conf |grep relay_net
dc_relay_nets='172.80.3.2/24:fd00::dead::beef::3::::2/64'