-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proxyvm with resolv.conf pointing at systemd-resolved doesn't forward DNS #7469
Comments
That’s my preferred option too, if systemd-resolved is enabled. The default should likely be disabled outside of sys-net and maybe VPN qubes. |
Yes, this all applies only to the case of /etc/resolv.conf pointing at systemd-resolved (so, not even just systemd-resolved running). |
I think the idea of I'd therefore suggest a two-fold approach:
I use 2. in some firewall VMs for a while to get DNS caching for upstream VMs and to implement #5225 as a side effect (didn't really need it, but thought it was cool). The code is here, but probably not really useful for you guys upstream apart from maybe the idea. The Essentially I just run the following in #!/bin/bash
exec_first='
set -e -o pipefail
#allow local DNS server on firewall
#NOTE: vif+ should be the upstream interfaces
iptables -I INPUT -i vif+ -p udp --dport 53 -j ACCEPT
iptables -I INPUT -i vif+ -p tcp --dport 53 -j ACCEPT
#start the DNS server
#NOTE: systemd-resolved monitors /etc/hosts for changes
systemctl start systemd-resolved'
dns_pin2hosts "daemon" --exec-first "$exec_first" &
disown The other scripts aren't involved for that setup. EDIT: I'm on 4.1. |
I'd rather not change this per https://www.qubes-os.org/faq/#what-is-qubes-attitude-toward-changing-guest-distros. If given distro decides to enable systemd-resolved by default, let it be this way. But note that using systemd-resolved for local names resolution is (mostly) independent of using it for forwarded traffic. The former is handled by QubesOS/qubes-core-agent-linux#373 overrides If NM is enabled, it will set DNS addresses itself (likely only in systemd-resolved, leaving
This is the main reason why I'm not so sure about forwarding traffic to it from downstream AppVMs. But the existence of |
I actually disagree with this. The reason is that systemd-resolved is a caching recursive resolver, and it is usually best to have only one or two of those on a system. Any more wastes resources, which contradicts our goal of reducing qube resource requirements. Furthermore, the appropriate configuration for systemd-resolved is very often qube-specific. On my system, for example, systemd-resolved is configured to use DNS over TLS. Needless to say, that will not work in an AppVM that is pointed at a stub listener! I think a much more reasonable approach is to run systemd-resolved if NetworkManager or systemd-networkd is enabled, or if the user explicitly requests it. Otherwise, it is better to disable systemd-resolved by default in qubes other than sys-net, just like we disable NetworkManager by default for such qubes.
I suggest using resolvectl if systemd-resolved is running.
From a performance and resource-consumption perspective, I would prefer to have a single instance of systemd-resolved in sys-net, and have all of the other VMs use that instance by default. Also, we need to make sure that mDNS and LLMNR are disabled by default; both have security problems. |
How can I revert this? Currently I'm having to add |
If you want to disable systemd-resolved - do just that: call |
I don't get that part then. Doesn't it mean that you are essentially considering to redirect DNS traffic from upstream VMs to Since Qubes OS networking then starts to use DNS over If you don't want to incorporate Anyway some attacks I came up with for
(Btw downstream = closer to the Internet "sea" for me.) Also, I belive that attacking |
Ok, makes sense. The side channel attack is probably the most realistic (doesn't rely on any other bug). And also, allows one VM to basically spy (just used domain names, but still) on user actions done in all the other VMs. So, I'll go with the first option - forward DNS queries directly to upstream DNS, bypassing systemd-resolved at all (regardless of if it's running or not). I'll keep it enabled (in distributions doing so) for local queries, though. |
When a qube provides network to others, it needs to forward DNS traffic. If /etc/resolv.conf points at local systemd-resolved, redirecting to it won't work (and is not a good idea). Instead, forward such queries to systemd-resolved's upstream servers. Add a script to get the addresses using systemd-resolved's DBus API. Fixes QubesOS/qubes-issues#7469
When a qube provides network to others, it needs to forward DNS traffic. If /etc/resolv.conf points at local systemd-resolved, redirecting to it won't work (and is not a good idea). Instead, forward such queries to systemd-resolved's upstream servers. Add a script to get the addresses using systemd-resolved's DBus API. Fixes QubesOS/qubes-issues#7469
Yes, that's probably the better choice for a short term update. |
When a qube provides network to others, it needs to forward DNS traffic. If /etc/resolv.conf points at local systemd-resolved, redirecting to it won't work (and is not a good idea). Instead, forward such queries to systemd-resolved's upstream servers. Add a script to get the addresses using systemd-resolved's DBus API. Fixes QubesOS/qubes-issues#7469 (cherry picked from commit cbe782b)
Automated announcement from builder-github The package
|
Automated announcement from builder-github The package
|
Automated announcement from builder-github The package
|
Automated announcement from builder-github The component
|
Automated announcement from builder-github The package
|
Observation
openQA test in scenario qubesos-4.1-update-x86_64-system_tests_network@64bit fails in
VmNetworking_fedora-35
Test suite description
netvm -> proxyvm (with NM) -> testvm1
test checks (among other things) name resolution in testvm1
Reproducible
Fails since (at least) Build 2022042606-4.1 (current job)
This affects Fedora 35 (#6969 ) template, and likely Arch too.
Expected result
Last good: 2022041906-4.1 (or more recent)
Further details
Always latest result in this scenario: latest
When NM is enabled,
/etc/resolv.conf
is not overriden by QubesOS/qubes-core-agent-linux#373 - it still symlinks to systemd-resolved. It includesnameserver 127.0.0.53
line. Qubes tries to redirect DNS traffic to anything found in /etc/resolv.conf, but redirecting (DNAT) to services listening onlo
interface fails (becausenet.ipv4.conf.all.route_localnet = 0
).Possible solutions:
/usr/lib/qubes/qubes-setup-dnat-to-ns
script aware of resolved and get DNS addresses from it (it may not be obvious which DNS server to use - there can be both global and per-interface settings. especially if VPN is in use).DNSStubListenerExtra=
option in its config).I'm slightly in favor of the second option, because then systemd-resolved can route DNS queries to different servers based on the query itself (for example if VPN declares only some specific domain). But I'd like to hear some opinions from others.
The text was updated successfully, but these errors were encountered: