[PATCH] systemd-resolved can't follow more than 8 CNAMEs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
Focal |
Fix Released
|
Low
|
Unassigned |
Bug Description
[Impact]
Using systemd-resolved to resolve a hostname which has more than 8 CNAME redirects will fail because of the hard-coded limit. While this case is somewhat rare, the original reporter demonstrated a real-world scenario where this happened (although that particular hostname seems to be fixed now).
[Test Plan]
This test plan uses a LXC container to test systemd-resolved on Focal. If LXD has not been configured on your system, start with:
$ lxd init --auto
Then, create a Focal container with:
$ lxc launch ubuntu-daily:focal focal
Install dnsmasq-base if needed:
$ apt install dnsmasq-base
Stop other DNS servers:
$ systemctl stop systemd-resolved
$ kill -9 $(pgrep dnsmasq)
Now, on the host start a new DNS server that listens on lxdbr0, and sets up an A record, and many CNAME records which ultimately redirect to the A record:
$ dnsmasq \
--cname=
--cname=
--cname=
--cname=
--cname=
--cname=
--cname=
--cname=
--cname=
--cname=
-k -i lxdbr0 -z -I lo --host-
where $IP is any host on your network.
Now, obtain a shell in the Focal container:
$ lxc exec focal bash
Attempt to resolve test10.lan:
$ resolvectl query test10.lan
test10.lan: resolve call failed: CNAME loop detected, or CNAME resolving disabled on 'test2.lan'
On an affected system, the above error will be seen. On a patched system, the hostname should be resolved.
[Where problems could occur]
The patch simply increases the maximum CNAME redirects that are allowed from 8 to 16, so a reasonable limit is still imposed. If an application specifically relied on systemd-resolved's limit being at 8, then that application would potentially see new behavior.
[Original Description]
On Ubuntu 20.04 (systemd v245.4-
So when using a service like Azure Virtual Desktop that has between 9 and 12 redirections, name resolution fails.
$ host client.
Host client.
$ resolvectl query client.
client.
On the other hand it's working fine on Ubuntu 20.04 because CNAME loop limit has been raised from 8 to 16.
$ host client.
client.
client.
client.
rdweb.wvd.
rdweb.privateli
rdweb.privateli
rdweb-prod-
mrs-chnor1c101-
waws-prod-
waws-prod-
Here's a quick fix that raises the max CNAME limit from 8 to 16 like it is in Ubuntu 22.04, it fixes the problem for me.
Best regards,
Vincent.
--- systemd-
+++ systemd-
@@ -10,7 +10,7 @@
#include "resolved-
#include "string-util.h"
-#define CNAME_MAX 8
+#define CNAME_MAX 16
#define QUERIES_MAX 2048
#define AUXILIARY_
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: systemd 249.11-0ubuntu3.9 [modified: usr/lib/
ProcVersionSign
Uname: Linux 5.19.0-42-generic x86_64
NonfreeKernelMo
ApportVersion: 2.20.11-0ubuntu82.5
Architecture: amd64
CasperMD5CheckR
CurrentDesktop: ubuntu:GNOME
Date: Thu Jun 15 16:53:19 2023
InstallationDate: Installed on 2022-11-22 (205 days ago)
InstallationMedia: Error: [Errno 13] Permission denied: '/var/log/
MachineType: Dell Inc. Latitude 5591
ProcKernelCmdLine: BOOT_IMAGE=
RebootRequiredPkgs: Error: path contained symlinks.
SourcePackage: systemd
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 11/21/2022
dmi.bios.release: 1.25
dmi.bios.vendor: Dell Inc.
dmi.bios.version: 1.25.0
dmi.board.name: 0DVVG1
dmi.board.vendor: Dell Inc.
dmi.board.version: A00
dmi.chassis.type: 10
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.
dmi.product.family: Latitude
dmi.product.name: Latitude 5591
dmi.product.sku: 0819
dmi.sys.vendor: Dell Inc.
modified.
mtime.conffile.
Related branches
- Lukas Märdian: Approve
-
Diff: 391 lines (+345/-0)7 files modifieddebian/changelog (+24/-0)
debian/patches/lp1837227-core-mount-adjust-deserialized-state-based-on-proc-self-m.patch (+119/-0)
debian/patches/lp1969365-Fall-back-to-kexec-when-no-kexec-binary-exists.patch (+28/-0)
debian/patches/lp2024009-dns-query-bump-CNAME_MAX-to-16.patch (+24/-0)
debian/patches/lp2029352-test-ignore-LXC-filesystem-when-checking-for-writable-loc.patch (+29/-0)
debian/patches/lp2037281-core-device-ignore-DEVICE_FOUND_UDEV-bit-on-switching-roo.patch (+116/-0)
debian/patches/series (+5/-0)
Status changed to 'Confirmed' because the bug affects multiple users.