Ambiguous behavior in response to unrelated DNS queries
The server is currently coded to respond with status code NOERROR to all non-tunnel queries. Despite the response content always being empty, it may still cause external probes to misidentify the server as an open recursive DNS resolver, which raises unwanted suspicion and might even cause certain hosting providers to suspend it:
$ dig A google.com @ns.mydomain.com
; <<>> DiG 9.18.39-0ubuntu0.24.04.3-Ubuntu <<>> A google.com @ns.mydomain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35565
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: a8b1267f30d88fe6 (echoed)
;; QUESTION SECTION:
;google.com. IN A
;; Query time: 79 msec
;; SERVER: RE.DA.CT.ED#53(ns.mydomain.com) (UDP)
;; WHEN: Thu May 14 12:41:20 MSK 2026
;; MSG SIZE rcvd: 51
Compare this behavior with Slipstream, which returns a more appropriate error code (NXDOMAIN) in this case:
$ dig A google.com @ns.mydomain.com
; <<>> DiG 9.18.39-0ubuntu0.24.04.3-Ubuntu <<>> A google.com @ns.mydomain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 32694
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;google.com. IN A
;; Query time: 79 msec
;; SERVER: RE.DA.CT.ED#53(ns.mydomain.com) (UDP)
;; WHEN: Thu May 14 12:41:43 MSK 2026
;; MSG SIZE rcvd: 39
Note the line: "WARNING: recursion requested but not available", which means Slipstream has explicitly rejected this request, also indicated by the status code NXDOMAIN. MasterDNS should follow suit, and respond with a similar error code instead of NOERROR.
Also note the flag "ra" (recursion available) in the response from MasterDNS, which should probably be removed as well.
As a temporary (or maybe permanent) and partial (yet) solution I did this (example):
iptables -A INPUT -i eth0 -p udp --dport 53 -m string --hex-string "|01|v|06|domain|03|com|00|" --algo bm -j ACCEPT
ip6tables -A INPUT -i eth0 -p udp --dport 53 -m string --hex-string "|01|v|06|domain|03|com|00|" --algo bm -j ACCEPT
iptables -A INPUT -i eth0 -p udp --dport 53 -j REJECT
ip6tables -A INPUT -i eth0 -p udp --dport 53 -j REJECT
In this case, port 53 on the public interface will only work with the needed domain for MasterDnsVPN and its subdomains, and for other domains the port will not work (as if there is no DNS server there). And regarding nftables unfortunately can't make the same rules for it, but iptables can be used simultaneously with nftables.