[GH-ISSUE #5577] Snap install: AppArmor blocks SetDefaultRoute/SetDNSOverTLS/SetDomains on systemd-resolved Link object (snapd bug) #10804

Open
opened 2026-08-05 01:27:20 -04:00 by saavagebueno · 1 comment
Owner

Originally created by @jean147 on GitHub (Mar 11, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5577

Summary

The NetBird snap's DNS configuration via systemd-resolved is broken due to an incomplete AppArmor fix in snapd. This prevents search domains from being set on the WireGuard interface, breaking short hostname resolution (e.g. gogo.company.internal).

Root cause

snapd's network-control interface has D-Bus rules for org.freedesktop.resolve1. The Manager-level rules allow all SetLink* methods:

member="SetLink{DefaultRoute,DNSOverTLS,DNS,DNSEx,DNSSEC,DNSSECNegativeTrustAnchors,MulticastDNS,Domains,LLMNR}"

But the Link object rules (added in snapd 2.67.1 via canonical/snapd#14751) are missing DefaultRoute, DNSOverTLS, and DNSEx:

member="Set{DNS,DNSSEC,DNSSECNegativeTrustAnchors,MulticastDNS,Domains,LLMNR}"

NetBird uses GetLink then calls methods on the Link object directly (systemd_linux.go). So:

  1. SetDNS allowed
  2. SetDNSSEC allowed
  3. SetDNSOverTLS blocked by AppArmor (warning, continues)
  4. SetDefaultRoute blocked by AppArmor (returns hard error)
  5. SetDomains ⏭️ never reached (function already returned)

Result: DNS server is set on wt0, but no search/match domains are configured. resolvectl domain wt0 shows nothing.

AppArmor denial

AppArmor policy prevents this sender from sending this message to this recipient;
type="method_call", sender=":1.2681" (uid=0 pid=220931
  comm="/snap/netbird/197/bin/netbird service run --log-le"
  label="snap.netbird.service-run (enforce)")
interface="org.freedesktop.resolve1.Link" member="SetDefaultRoute"
destination="org.freedesktop.resolve1" (uid=101 pid=1076
  comm="/usr/lib/systemd/systemd-resolved" label="unconfined")

Who is affected

All NetBird snap users on Ubuntu with snapd >= 2.65 (where the AppArmor tightening was introduced). The incomplete fix in snapd 2.67.1 restored GetLink, SetDNS, SetDNSSEC, SetDomains, and SetLLMNR on the Link object, but missed SetDefaultRoute and SetDNSOverTLS. Since SetDefaultRoute returns a hard error in applyDNSConfig, SetDomains is never called.

Apt/deb installs are not affected (no snap confinement).

Workaround

Manually patch the AppArmor profile (needs to be redone after each snap refresh netbird):

sudo sed -i 's/member="Set{DNS,DNSSEC,DNSSECNegativeTrustAnchors,MulticastDNS,Domains,LLMNR}"/member="Set{DefaultRoute,DNS,DNSEx,DNSSEC,DNSSECNegativeTrustAnchors,DNSOverTLS,Domains,LLMNR,MulticastDNS}"/' \
  /var/lib/snapd/apparmor/profiles/snap.netbird.service-run
sudo apparmor_parser -r /var/lib/snapd/apparmor/profiles/snap.netbird.service-run
sudo systemctl restart snap.netbird.service-run.service

Upstream fix needed

A bug has been filed against snapd to add the missing members to the Link object rules in interfaces/builtin/network_control.go and network_manager.go: https://bugs.launchpad.net/snapd/+bug/2143934
Related: LP #2086203.

Secondary note

In systemd_linux.go, when setDomainsForInterface fails, the error is only logged and not returned. This means that even if SetDefaultRoute were fixed, a SetDomains failure would be silently swallowed. Consider returning the error so DNS misconfigurations are visible to the user.

Environment

  • Ubuntu 24.04, kernel 6.17.0-14-generic
  • snapd 2.73+ubuntu24.04
  • NetBird snap 0.66.1
Originally created by @jean147 on GitHub (Mar 11, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5577 ## Summary The NetBird snap's DNS configuration via systemd-resolved is broken due to an incomplete AppArmor fix in snapd. This prevents search domains from being set on the WireGuard interface, breaking short hostname resolution (e.g. `go` → `go.company.internal`). ## Root cause snapd's `network-control` interface has D-Bus rules for `org.freedesktop.resolve1`. The Manager-level rules allow all `SetLink*` methods: ``` member="SetLink{DefaultRoute,DNSOverTLS,DNS,DNSEx,DNSSEC,DNSSECNegativeTrustAnchors,MulticastDNS,Domains,LLMNR}" ``` But the Link object rules (added in snapd 2.67.1 via [canonical/snapd#14751](https://github.com/canonical/snapd/pull/14751)) are missing `DefaultRoute`, `DNSOverTLS`, and `DNSEx`: ``` member="Set{DNS,DNSSEC,DNSSECNegativeTrustAnchors,MulticastDNS,Domains,LLMNR}" ``` NetBird uses `GetLink` then calls methods on the Link object directly (`systemd_linux.go`). So: 1. `SetDNS` ✅ allowed 2. `SetDNSSEC` ✅ allowed 3. `SetDNSOverTLS` ❌ **blocked by AppArmor** (warning, continues) 4. `SetDefaultRoute` ❌ **blocked by AppArmor** (returns hard error) 5. `SetDomains` ⏭️ **never reached** (function already returned) Result: DNS server is set on `wt0`, but no search/match domains are configured. `resolvectl domain wt0` shows nothing. ## AppArmor denial ``` AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.2681" (uid=0 pid=220931 comm="/snap/netbird/197/bin/netbird service run --log-le" label="snap.netbird.service-run (enforce)") interface="org.freedesktop.resolve1.Link" member="SetDefaultRoute" destination="org.freedesktop.resolve1" (uid=101 pid=1076 comm="/usr/lib/systemd/systemd-resolved" label="unconfined") ``` ## Who is affected All NetBird snap users on Ubuntu with snapd >= 2.65 (where the AppArmor tightening was introduced). The incomplete fix in snapd 2.67.1 restored `GetLink`, `SetDNS`, `SetDNSSEC`, `SetDomains`, and `SetLLMNR` on the Link object, but missed `SetDefaultRoute` and `SetDNSOverTLS`. Since `SetDefaultRoute` returns a hard error in `applyDNSConfig`, `SetDomains` is never called. Apt/deb installs are not affected (no snap confinement). ## Workaround Manually patch the AppArmor profile (needs to be redone after each `snap refresh netbird`): ```bash sudo sed -i 's/member="Set{DNS,DNSSEC,DNSSECNegativeTrustAnchors,MulticastDNS,Domains,LLMNR}"/member="Set{DefaultRoute,DNS,DNSEx,DNSSEC,DNSSECNegativeTrustAnchors,DNSOverTLS,Domains,LLMNR,MulticastDNS}"/' \ /var/lib/snapd/apparmor/profiles/snap.netbird.service-run sudo apparmor_parser -r /var/lib/snapd/apparmor/profiles/snap.netbird.service-run sudo systemctl restart snap.netbird.service-run.service ``` ## Upstream fix needed A bug has been filed against snapd to add the missing members to the Link object rules in `interfaces/builtin/network_control.go` and `network_manager.go`: https://bugs.launchpad.net/snapd/+bug/2143934 Related: [LP #2086203](https://bugs.launchpad.net/snapd/+bug/2086203). ## Secondary note In `systemd_linux.go`, when `setDomainsForInterface` fails, the error is only logged and not returned. This means that even if `SetDefaultRoute` were fixed, a `SetDomains` failure would be silently swallowed. Consider returning the error so DNS misconfigurations are visible to the user. ## Environment - Ubuntu 24.04, kernel 6.17.0-14-generic - snapd 2.73+ubuntu24.04 - NetBird snap 0.66.1
Author
Owner

@jean147 commented on GitHub (Mar 11, 2026):

The upstream snapd bug has been filed: https://bugs.launchpad.net/snapd/+bug/2143934

<!-- gh-comment-id:4040938625 --> @jean147 commented on GitHub (Mar 11, 2026): The upstream snapd bug has been filed: https://bugs.launchpad.net/snapd/+bug/2143934
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#10804