systemd-resolved leaks mDNS queries to DNS
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| nss-mdns (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Bug Description
On a freshly installed ubuntu focal machine, access to local machines advertised via mDNS is now broken. This is a regression wrt eoan where it used to work.
Trying to ping something like <host>.local invariably results in pinging 40.68.249.35 because systemd-resolved passes the query to the DNS even if .local is reserved for multicast DNS and for some reasons <anything>.local seems to resolve to 40.68.249.35. This happens even if the avahi daemon is up and running.
Stopping systemd-resolved makes the mDNS resolution work as expected.
Not only this breaks standard workflows, but it also means that anyone pretending to be 40.68.249.35 on the network could probably impersonate any local host.
ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: systemd 245.4-4ubuntu3.1
ProcVersionSign
Uname: Linux 5.4.0-37-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.2
Architecture: amd64
CasperMD5CheckR
CurrentDesktop: KDE
Date: Tue Jun 16 23:43:22 2020
EcryptfsInUse: Yes
InstallationDate: Installed on 2020-02-16 (121 days ago)
InstallationMedia: Kubuntu 19.10 "Eoan Ermine" - Release amd64 (20191017)
MachineType: SCHENKER SCHENKER_
ProcKernelCmdLine: BOOT_IMAGE=
SourcePackage: systemd
SystemdDelta:
[EXTENDED] /usr/lib/
[EXTENDED] /usr/lib/
2 overridden configuration files found.
UpgradeStatus: Upgraded to focal on 2020-05-23 (24 days ago)
dmi.bios.date: 10/02/2019
dmi.bios.vendor: INSYDE Corp.
dmi.bios.version: 1.07.04RTR1
dmi.board.
dmi.board.name: N141CU
dmi.board.vendor: SCHENKER
dmi.board.version: Not Applicable
dmi.chassis.
dmi.chassis.type: 10
dmi.chassis.vendor: Notebook
dmi.chassis.
dmi.modalias: dmi:bvnINSYDECo
dmi.product.family: Not Applicable
dmi.product.name: SCHENKER_
dmi.product.sku: Not Applicable
dmi.product.
dmi.sys.vendor: SCHENKER
| information type: | Private Security → Public Security |

Did some more checks about this. If I understand correctly:
- Passing ".local" queries to the DNS is something that now happens because systemd-resolved is doing all of the name resolution (DNS and mDNS) while in the past it was the avahi daemon to be in charge of the mDNS resolution.
- Specifically, the reason is that systemd-resolved adds its own switches to configure mDNS and by default it is configured to pass ".local" queries to the DNS.
- You can have systemd-resolved use mDNS only for .local names by either
a) activating DNSSEC in its global configuration; or
b) activating multicast DNS in its global configuration and then tweak the Network Manager configuration files for the individual connections by adding mdns=2 in the [connection] section.
I have some comments/inquires on this:
- the Network Manager configuration with respect to mdns is not something that can be done from the GUI (at least with the KDE applet), which makes recovering the "normal" mDNS behavior inconvenient;
- the implications of activating DNSSEC in systemd-resolved are unclear to me. Is everything ready to do this without side effects?
- It is my understanding that the reason why mDNS is now passed by default to regular DNS is that in some enterprise environments the .local domain is used as a local domain controlled by an internal DNS. However, again to my understanding, this should not be the standard according to RFC 6762. Even less so now that the operation of many consumer network-attached peripherals is based on zeroconf. Because of this, I think that the default should be the opposite and that if .local needs to be resolved by unicast DNS, then in that case a configuration action should be taken.
- Even in environments where hosts on the .local domain require unicast DNS, it seems unreasonable to attempt that if the configured DNS is not local (e.g., the ISP provided one, google, etc.). In fact it is unclear to me why on public DNS *.local points to 40.68.249.35. Probably my ignorance, found no reference to it googling.
- It is unclear to me why systemd-resolved places additional configuration switches in front of mDNS when this should be already configured in nsswitch.conf. Particularly the default nsswitch.conf says to lookup first using mDNS, so when this is not done the result is confusing.
- Ubuntu seems to ship by default with both systemd-resolved and the avahi-daemon. Is this redundant? Is there a way to tell systemd-resolved to refrain from mDNS lookup and just hand it over to the avahi daemon? Shouldn't systemd-resolved just do that when mDNS is disabled for it but globally enabled via nsswitch? Is the avahi daemon needed at all if systemd-resolved can take care of everything? Can there be issues in having both up? For instance the arch wiki explicitly says "If Avahi has been installed, consider disabling avahi-daemon. service and avahi-daemon.socket to prevent conflicts with systemd-resolved".