Wires up systemd support to configure DNS on startup and when enabling/disabling exit mode. On startup (and when turning off an exit) we tell systemd-resolved to direct .loki and .snode lookups to lokinet (leaving other DNS traffic alone). On exit enabling, we reconfigure it to resolve "." (i.e. the root DNS domain) so that all lookups come into it.
Lokinet now talks to systemd directly via sdbus to set up DNS, but in order for this to work the
user running lokinet (assumed
_lokinet in these example files) needs permission to set dns servers
To set up the permissions:
If lokinet is running as some user other than
_lokinetthe change the
If on a Debian or Debian-derived distribution (such as Ubuntu) using polkit 105, copy
/var/lib/polkit-1/localauthority/10-vendor.d/lokinet.pkla(for a distro install) or
/etc/polkit-1/localauthority.conf.d/(for a local install).
/usr/share/polkit-1/rules.d/(distro install) or
Make use of it by switching to systemd-resolved:
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf sudo systemctl enable --now systemd-resolved