Repository navigation
Description
Submission type
- Bug report
systemd version the issue has been seen with
systemd 234
Used distribution
Ubuntu 17.10
In case of bug report: Expected behaviour you didn't see
My system should send dns lookups to the dns server provided by my vpn service only.
In case of bug report: Unexpected behaviour you saw
My system sends dns lookups to my local ISPs dns server when connected to my vpn service.
In case of bug report: Steps to reproduce the problem
- Install OpenVPN
- Connect to a vpn service (such as the highly popular Private Internet Access) using OpenVPN and the vpn service's vpn config files (see attachments for instance) openvpn-config-files.zip
- Go to dnsleak.com. Note that there are DNS query leaks to your ISPs DNS server.
My limited understanding of tcp/udp, http/https and vpn tells me that when a network interface is connected to a vpn server then the main principle to follow is that every single outgoing ip package should (after having been packaged into a new tcp/udp stream) be relayed to the vpn server.
So why is it that (if my understanding is correct) we have a system here responsible for dns lookups that chooses to ignore the fact that a vpn connection is in use and instead relays lookup requests to the local dns server?
Why is this problem being ignored instead of being dealt with immediately? Isn't this an extremely serious security related bug? Yes I know lots and lots of people use VPN services for illegal file sharing and looking at beautiful people pursing various stages of undress (and other things...), but it is also being used in oppressive countries such as Iran by politically active people to regain some level of privacy and peace of mind when they take their share of internet material and communication that is deemed as "unfavorable" by the state.
I shiver to think of the poor soul that gets a knock on the door early in the morning by a secret police representative who would like to ask a few questions about his political ideologies and asks him to come to the station for a "pleasant chat". Why did this happen? Because someone thought that vpn communication on his system follows the principle that all traffic should go through the vpn service.
Activity
boucman commentedon Oct 25, 2017
the principle that every packet should go through the VPN is not always true. What if you have multiple VPN ?
A very common VPN setup (my setup) is to have normal internet traffic be directly sent to the internet and only have packets internal to the corporate network go to the corporate network.
the core answer here is that the VPN is just a network interface like any other, and what decides what packet goes through the VPN and what packet goes out is decided by the kernel routing table
Now, who sets up the kernel routing table can vary quite a bit, but IIRC it's openvpn's responsability. So it's probably an openvpn configuration problem
PureRumble commentedon Oct 26, 2017
Nearly every time someone purchases a VPN service or sets up a VPN server they want all traffic (including dns lookups) to go through the VPN server, and this is especially true for novice users. You are the one describing special cases (multiple vpn connections, personal traffic and corporate vpn traffic, etc.).
Thus I believe common sense dictates that the default behavior of any system/module/etc involved in the process of DNS lookups coupled with a VPN connection should be that DNS lookups are relayed to the VPN server too.
Now you say the fault lies with OpenVPN not configuring the kernel routing table correctly, but it's strange that this wasn't an issue with OpenVPN until systemd-resolved came along. Specifically, OpenVPN had no such issues with the DNS server dnsmasq. Did OpenVPN configure the the kernel routing table correctly for dnsmasq all these years as opposed to for systemd-resolved?
I'm not an expert in this field, but other sources suggest that this is caused by a bug/design flaw in systemd-resolved. The following link for instance raises some what seem to be serious concerns that suggest this problem isn't only limited to OpenVPN as you suggest: https://lists.dns-oarc.net/pipermail/dns-operations/2016-June/014964.html. I'll quote some of its criticism of systemd-resolved here:
"It is yet another program/daemon that runs races with other software in controlling /etc/resolv.conf. Eg VPN software adding nameservers."
"It sends out a DNS queries over all its obtained DNS servers all the time. This means DNS queries for split-DNS view resources leak all over the internet."
So if I'm not mistaken then this is a problem caused by systemd-resolved. If this is true, my question still stands: is anything going to be done to fix this problem, and why isn't this considered to be a serious security flaw since it breaks all common sense that your system should by default spout out dns lookups to your ISP's DNS server when you're connected to a VPN service?
snabb commentedon Oct 28, 2017
This is a duplicate of: #6076
Also related: #5755
Looks like the author insists nothing is broken. Situation is hopeless.
flo-wer commentedon Oct 28, 2017
I suppose you are using the script from update-systemd-resolved than make sure to set
DOMAIN-ROUTEto.see Usage.For this special syntax see: systemd.network#Domains=
This should ensure that all DNS lookups are routed exclusive over the VPN interface.
PureRumble commentedon Oct 29, 2017
Thanks for your help @flo-wer but no, I'm not using that script. It's 400 lines long. What does it do? Is it safe? Will it break something? Why do I need a 400 lines long script to do something as essential as relaying all traffic through my VPN connection? This should be doable out-of-the-box and should in fact be the default behavior.
PureRumble commentedon Oct 29, 2017
@snabb, thank you for your referral. I cam up empty handed when I did a search among the project's issues (using GitHub's search feature) before posting my own. I have now posted our "grievances" in the issue you referred to too.
flo-wer commentedon Oct 29, 2017
I can understand your criticism of systemd-resolved, but it's not the primary fault of systemd-resolved per se, as it can handle your use case.
The problem is, that systemd-resolved only talks over D-Bus to receive name servers. So you either make direct D-Bus calls or you use a third party tool to make this communication easier.
The posted script is such a tool who works as a callback from openVPN and sends the name server over D-Bus to systemd-resolved. Note that I haven't used this script nor reviewed it, I only studied the man page.
Another way is using NetworkManager to handle the VPN, as NM supports
ipv4.dns-priorityto filter name servers per interface and will only pass the appropriate information to systemd-resolved. Note that there was a bug, that should be fixed recently: https://bugzilla.gnome.org/show_bug.cgi?id=783569, NetworkManager/NetworkManager@70792e5, that prevented this from working.xpcone commentedon Nov 18, 2017
still open issue with Network-Manager 1.8.4 and unfixed ...
poettering commentedon Dec 8, 2017
Hmm, can you please provide "systemd-resolve --status" for your system?
By default, systemd-resolved will send lookup request to every interface that has at least one DNS server configured in parallel, but takes any per-interface configured search and routing domains into account. This is done in the following way:
Now, if you have a VPN set up then conceptually two approachs might make sense:
I am pretty sure both usecases are fully valid. One is more "corporate" the other more "privacy-minded". We can't really know which one is the right one, we default to the "corporate" one though. To switch to the "privacy-minded" one, just include "." in the search domains for that interface and you should be good.
Does that make sense?
Gullumluvl commentedon Apr 2, 2018
Hi everyone, I also suffer from this issue, and I am also quite inclined to rant about it...
I simply couldn't find how to configure
systemd-resolved.serviceso that it's not showing my ISP box as the first DNS server. Here is the output ofsystemd-resolve --status, where you can see192.168.1.254as the first entry for interfaceeno1(ethernet?):I tried various things, like first symlinking
/etc/resolv.confto/etc/systemd/resolvconf/resolv.conf, and also editing the file/etc/systemd/resolved.confto add the line(see
man resolved.conf)but no change in the output of
systemd-resolve --status...However, regarding my openvpn client setup, I tried adding this line in the config file, as you mention in your previous comment:
as well as using the recommended script
update-systemd-resolved(which by the way is packaged for ubuntu), and it seems to fix my DNS leaks.HOWEVER, I still have interrogation, because the ouput of
systemd-resolve --statusstill shows my ISP box, and because the openvpn connection logs seem to still create a route to my ISP box:upon running
openvpn client.conf(suspicious parts in bold):I might very well have wrongly understood it, because I am totally lost in all those routing concepts, but could you clarify that in the above output, my box is only used as gateway, not DNS server?
Thanks a lot.
poettering commentedon Dec 4, 2018
Closing this, as @PureRumble never responded. Moreover, I am pretty sure this is ultimately a duplicate of #10830, let's close this hence.