polkaned / dockerfiles

MIT License
108 stars 53 forks source link

Problem while sharing network #24

Closed lplinux closed 3 years ago

lplinux commented 3 years ago

https://github.com/polkaned/dockerfiles/blob/8e08dd7daa47e10cbe25d93356b856bf761781fe/expressvpn/entrypoint.sh#L4

Hello polkaned.

I've been working with using this image to share the networking with other containers and I faced an issue with the DNS resolution.

As the entrypoint is umounting the /etc/resolv.conf file, any container that uses expressvpn container will not be able to use the specific DNS from the connection. The secondary container will use the hosts DNS instead.

I work on a scenario where the expressvpn container is reuse and not destroy, so I reconnect without stopping it.

I'm not sure why you are umounting the resolv.conf file. Is this something that could be changed? I'm trying to avoid having a fork or a local image created with just this change.

Regards

polkaned commented 3 years ago

Hi,

Like you can see, this is a transparent operation:

cp /etc/resolv.conf /tmp/resolv.conf
su -c 'umount /etc/resolv.conf'
cp /tmp/resolv.conf /etc/resolv.conf

The expressvpn change the resolv.conf, and I do it for this. This just allows expressvpn to change the resolv.conf (because the process is not root, he can't by default).

Expressvpn logs:

2020/12/19 14:59:08 [I] updateResolveConf: scriptType="up"
2020/12/19 14:59:08 [T] acquiring /var/run/expressvpn/xv-update-resolv-conf.lock took 0.0ms
'/etc/resolv.conf' -> '/etc/resolv.conf.expressvpn-orig'
dhcp-option DNS X.X.X.X
renamed '/etc/resolv.conf.expressvpn-new' -> '/etc/resolv.conf'
DNS setting update type: up, completed
2020/12/19 14:59:08 [T] updateResolvConf took 7.4ms

So I can't remove this.