pygmystack / pygmy

the pygmy stack is a container stack for local development
MIT License
25 stars 13 forks source link

[bug] Incorrect resolver file for Ubuntu 20 #291

Closed twardnw closed 3 years ago

twardnw commented 3 years ago

Describe the bug Pygmy-go assumes that all linux systems utilize /etc/resolv.conf for managing custom DNS resolvers. On Ubuntu 20, that file is not considered, and will be overwritten by Network Manager without warning. Custom resolvers can be placed in /etc/systemd/resolved.conf.d instead. Instead of injecting the single line into /etc/resolv.conf, Pygmy-go should create /etc/systemd/resolved.conf.d/docker.amazee.io.conf with the following contents

[Resolve]
DNS=127.0.0.1:6053
Domains=docker.amazee.io
fubarhouse commented 3 years ago

I don't have immediate access to a Ubuntu system as I run Arch, but that could change.

Is it safe to assume this logic if /etc/systemd/resolved.conf.d exists and is a directory?

If the key is unspecified, default is used, unless /etc/resolv.conf is a symlink to /run/systemd/resolve/resolv.conf, /lib/systemd/resolv.conf or /usr/lib/systemd/resolv.conf. In that case, systemd-resolved is chosen automatically.

Seems to be all debian-based distributions, which may or may not exclude other distributions.

twardnw commented 3 years ago

I'll have to test, but I think I had to create /etc/systemd/resolved.conf.d, I'll investigate that, have a new Ubuntu 20 server I'm in the middle of bringing online

tobybellwood commented 3 years ago

Given pygmy is a vendor package, it should probably be installing the config into /usr/lib/systemd/resolved.conf.d/*.conf instead https://manpages.ubuntu.com/manpages/groovy/man5/resolved.conf.5.html

Happy to help try things as needed?

fubarhouse commented 3 years ago

I would like that better actually... I'll get a commit in place to get some testing done :)

fubarhouse commented 3 years ago

I've just tested a change to the Resolv config on Arch - seems happy enough! :)

fubarhouse commented 3 years ago

Please test at your own convenience!

fubarhouse commented 3 years ago

Provided you're happy and everything works, I can merge this tonight.

twardnw commented 3 years ago

I'll give it a test later this evening, been a busy day :)