Closed aliron19 closed 3 years ago
Just a quick update.
I've checked that TDS can download a blocklist from a URL when using my SOCKS5 proxy. These are the logs (with proxy on):
[2021-04-17 23:52:22 UTC] [127.0.0.1:58088] [admin] Block list update was triggered.
[2021-04-17 23:52:28 UTC] DNS Server successfully downloaded block list (2,2 MB): https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
[2021-04-17 23:52:28 UTC] DNS Server is reading block list from: https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
[2021-04-17 23:52:28 UTC] DNS Server block list file was read (76473 domains) from: https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
[2021-04-17 23:52:28 UTC] DNS Server block list zone was loaded successfully.
[2021-04-17 23:52:28 UTC] DNS Server config file was saved: C:\Program Files (x86)\Technitium\DNS Server\config\dns.config
If I disable my proxy service, then TDS cannot download anything, so it's actually using the SOCKS5 proxy to download that URL.
I hope it helps to give some debugging hints, although I'm even more confused. 😅
Thanks for the detailed feedback. I will test this once and let you know the results.
I just installed Dante proxy on Ubuntu 20.04 and its working well. The DNS Server is able to do recursive resolution through the socks5 proxy without any errors. Also tested with all forwarder protocol combinations too and its all working well.
I even checked all the network traffic using Wireshark and things are as expected.
If possible, do share your danted.conf file so that I can try the exact config and test again.
Thank you @ShreyasZare for your quick response, and detailed investigation.
This is the content of my /etc/danted.conf
:
logoutput: /var/log/socks.log
internal: 0.0.0.0 port = 2408
external: eth0
socksmethod: none
user.privileged: root
user.notprivileged: nobody
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: error connect disconnect
}
client block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect error
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: error connect disconnect
}
socks block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect error
}
I'm afraid this is some kind of esoteric network problem, very specifically related to my setup, because of the following reasons:
I'd like to debug this, but I still don't know how. Is there a way to make TDS logs more verbose?
Thanks for the config. I tried the same on Ubuntu 20.04 and its working well here again.
As you mentioned that the DNS server is able to download HTTPS resources and also your web browser is working with it, so the proxy is working well for TCP requests. But, for UDP requests, it seems to be failing due to some local issue.
This issue will affect only recursive resolution and thus if you are planning to use a forwarder then it would work with the proxy for other transport protocols.
The error stack trace is the max debug log that is possible on the DNS server. Do try to capture the traffic on the network with tcpdump and share the pcap file. This will make is much clear as to what is going on at the network level.
I think I've partially track down the issue, and it seems to be related to my VPN provider (to simplify my examples I omitted that I'm using a VPN on my VPS, and connecting to it with OpenVPN). Using this specific VPN I can repeat the issue on any VM following these steps:
ssh
, resolvconf
, and openvpn
on that VM.Forwarders
area empty.DNS-over-UDP (default)
as the Forwarder Protocol
.This way, the TDS client requests don't work. However, if you enter a DNS server on the forwarders area, and apply the settings, then the TDS client works as expected (even with DNS-over-UDP). So TDS needs to know the DNS server (IP or FQDN) in order to work with my VPN using DNS-over-UDP.
Interestingly enough, if I use another VPN provider (I've tested a free account on ProtonVPN), then I don't need to specify the forwarders. So the issue only appears when I'm using my current VPN provider (which I prefer not to disclose for privacy reasons) and leave the forwarders area empty.
This weekend I'll try to capture the network traffic on my VM as you suggest, with and without filling the forwarders area, and tell you the results.
Thank you for your patience.
Ahh ... openvpn!
So, openvpn by default hijacks all UDP port 53 traffic and sends it over the VPN tunnel when connected. This is a feature called block-outside-dns
to prevent DNS queries from leaking directly to your Internet which would be devastating for privacy/security reasons.
There is an option which you can use in your vpn client config file to stop this default behavior so that you can query to a DNS server that is configured. To disable the feature, just add the following line in your openvpn client config file:
pull-filter ignore "block-outside-dns"
Make sure to do a DNS leak test if you want to protect your privacy over VPN with this option disabled.
Thank you for your suggestion. I've tried to add that line to my OpenVPN config file, but it doesn't change the results.
However, I've discovered that I can type almost any IP address (even bogons or broadcast) on the forwarders area on TDS, and it will work using OpenVPN + SOCKS5 + DNS-over-UDP on the setup previously described. For example, I've tried some random IP addresses (like 1.0.0.0, 10.0.0.0, or 24.25.26.27), and all of them work fine as long as the forwarders area is not empty.
On my VPS hosting happens something similar, but I need to use DNS-over-TCP (TDS needs its forwarders area not to be empty in order to work with OpenVPN + SOCKS5 + DNS-over-TCP). Once more, it seems to accept almost any IP address, as long as it's not empty anything will work.
Thank you for your suggestion. I've tried to add that line to my OpenVPN config file, but it doesn't change the results.
However, I've discovered that I can type almost any IP address (even bogons or broadcast) on the forwarders area on TDS, and it will work using OpenVPN + SOCKS5 + DNS-over-UDP on the setup previously described. For example, I've tried some random IP addresses (like 1.0.0.0, 10.0.0.0, or 24.25.26.27), and all of them work fine as long as the forwarders area is not empty.
Since you have SOCKS5 running, any IP address that you put in forwarder will be sent to SOCKS5 proxy and the proxy will forward it further. So, now if you have openvpn on the server running on the same server, then the DNS request will get hijacked by openvpn and in such case the destination IP address doesn't matter.
On my VPS hosting happens something similar, but I need to use DNS-over-TCP (TDS needs its forwarders area not to be empty in order to work with OpenVPN + SOCKS5 + DNS-over-TCP). Once more, it seems to accept almost any IP address, as long as it's not empty anything will work.
Without the forwarders configured, the DNS server will do recursive resolution where it has validation checks that could reject the hijacked responses making it non functional.
Well,
After some more testing, I've found the following:
Thank you very much for you time and patience @ShreyasZare.
Thanks for the detailed analysis. This would help someone searching for similar issues for sure.
I have a Dante SOCKS5 proxy server running on a VPS with Debian 9. This proxy works fine with any client I've tested (Firefox and cURL, for example), but for some reason it doesn't work with Technitium DNS Server (TDS) v6.2.1 (I'm using TDS under Windows 10 Pro 64 bits).
To test TDS I first flush its cache, and then I query the
A
record forgoogle.com
from the DNS client tab of TDS web GUI. This is what I get using my SOCKS5 proxy:As you can see, the
Answer
is completely empty.If I look at the TDS logs, I get these results:
However, if I download, install, and run Tor Browser, and use its SOCKS5 proxy from TDS, then TDS works perfectly fine.
As the Tor SOCKS5 proxy works fine, at first glance it may appears like the problem is related to my custom SOCKS5 proxy, but then, why does my SOCKS5 proxy work properly with Firefox (among others)? Why does it fail only with TDS?
If I look to my SOCKS5 proxy logs I can see these errors when I query my TDS server:
Please, let me remark that those error messages only appear when I use my SOCKS5 proxy from TDS, because when I use it from another program (Firefox, etc.) I get no errors at Dante's logs.
I've also tried to use PuTTY, creating a dynamic tunnel (which acts as a SOCKS5 proxy too) when connecting to my VPS, but I get the same results: it doesn't work with TDS, but works fine with other tools.
May there be a bug in the SOCKS5 protocol implementation that TDS is using? According to TDS and Dante's log, it looks like the socket is closed unexpectedly for both parties, as TDS says:
while Dante shows:
How can I help to debug this issue?
Thanks.