The following solution for /rw/config/rc.local is a lot easier than my suggestion above and survives hotplugging of sys-dns:
#!/bin/sh
# allow redirects to localhost
/usr/sbin/sysctl -w net.ipv4.conf.all.route_localnet=1
/usr/sbin/iptables -I INPUT -i vif+ -p tcp --dport 53 -d 127.0.0.1 -j ACCEPT
/usr/sbin/iptables -I INPUT -i vif+ -p udp --dport 53 -d 127.0.0.1 -j ACCEPT
# there is no place like 127.0.0.1
echo "nameserver 127.0.0.1" > /etc/resolv.conf
echo "nameserver 127.0.0.1" >> /etc/resolv.conf
# enable hotplugging survival
qubesdb-write /qubes-primary-dns 127.0.0.1
qubesdb-write /qubes-secondary-dns 127.0.0.1
# rerun setup of DNAT rules
/usr/lib/qubes/init/network-proxy-setup.sh
# start dnscrypt-proxy
/usr/bin/systemctl start dnscrypt-proxy.service
As written above dnscrypt-proxy
has to be installed in sys-dns
â template and at least /etc/dnscrypt-proxy/dnscrypt-proxy.toml
has to be set up to your needs inside of the template. As you donât want the service running in other VMs I suggest to disable dnscrypt-proxy.service
in the template.
A separate template is not necessary. From my point of view sys-dns
should be placed between sys-firewall
and sys-net
. One could argue to run the service in sys-net
as it is the VM with the biggest attack surface anyway.