Configure DNS settings using the D-Bus interface of systemd-resolved


My application needs to configure DNS settings for a network interface using the D-Bus interface of systemd-resolved calling the SetLinkDNS and SetLinkDomains methods. I’m not able to figure out what interface would allow to achieve this. My investigations led me to take a close look at the NetworkManager snap that does seem to have the required permissions:

$ grep DNS /var/lib/snapd/apparmor/profiles/

I have tried using the exact same interfaces that the former is declaring for my own app but I’m still hitting the same AppArmor violation

Oct 20 09:21:57 padua audit[860]: USER_AVC pid=860 uid=100 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/resolve1" interface="org.freedesktop.resolve1.Manager" member="SetLinkDNS" mask="send" name="org.freedesktop.resolve1" pid=42538 label="snap.nsconf.nsconf" peer_pid=531 peer_label="unconfined"
                                   exe="/usr/bin/dbus-daemon" sauid=100 hostname=? addr=? terminal=?'