Skip to content

Qubes-firewall applies incorrect DNS rules when using VPN and limiting AppVM connections #7882

Description

@tezeb

Qubes OS release

4.1

Brief summary

I searched the issues and I believe this one to be distinct than other possibly related (ie. #1183, #5706, #6927).

With the following setup:
AppVM --> VPN VM --> Firewall VM --> NetVM
and with the "AppVM" firewall set to limit outgoing connections to set of hosts(via GUI), the firewall in VPN VM applies DNS rules with
incorrect DNS servers set, thus cutting off the actual networking in AppVM.

For the AppVM with ip (10.137.0.27), that should be able to connect only to "X.X.X.X", the rules looks like:
sudo nft list table qubes-firewall

        chain qbs-10-137-0-27 {
                ip daddr X.X.X.X tcp dport 443 accept
                ip daddr 127.0.0.53 tcp dport 53 accept
                ip daddr 127.0.0.53 udp dport 53 accept
                ip protocol icmp accept
                reject with icmp admin-prohibited
                reject with icmp admin-prohibited
        }

and the sudo iptables -t nat -nvL shows:

Chain PR-QBS (1 references)
 pkts bytes target     prot opt in     out     source               destination         
  770 54160 DNAT       udp  --  *      *       0.0.0.0/0            10.139.1.1           udp dpt:53 to:1.1.1.1
    0     0 DNAT       tcp  --  *      *       0.0.0.0/0            10.139.1.1           tcp dpt:53 to:1.1.1.1
   64  4304 DNAT       udp  --  *      *       0.0.0.0/0            10.139.1.2           udp dpt:53 to:8.8.8.8
    0     0 DNAT       tcp  --  *      *       0.0.0.0/0            10.139.1.2           tcp dpt:53 to:8.8.8.8

It is my understanding that the script /etc/dhclient.d/qubes-setup-dnat-to-ns.sh works correctly, but the
qubes-firewall uses the incorrect values to setup nft rules, not respecting that the systemd-resolved is active
using the value from /etc/resolv.conf instead.

This used to work fine in 4.0 as far as I can tell, as the VMs in question were migrated directly from a working installation of 4.0.
The problem affects migrated as well as newly created AppVMs.

Steps to reproduce

  1. Create AppVM and configure it's firewall to "Limit outgoing connections" with a one or more hosts.
  2. Configure AppVM to use VPN-VM, which uses custom DNS(vpn-provided).
  3. Try connecting from AppVM to the allowed host(using domain name).

Expected behavior

AppVM connects succesfully to the allowed host.

Actual behavior

It is not possible to resolve the domain name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: networkingThis issue pertains to networking in Qubes OS.P: defaultPriority: default. Default priority for new issues, to be replaced given sufficient information.affects-4.1This issue affects Qubes OS 4.1.eol-4.1This issue has been closed because Qubes OS 4.1 has reached end of life (EOL).

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions