Debian 9 允许隐藏 DNS 查询吗?

Debian 9 允许隐藏 DNS 查询吗?

在以前的 Debian Jessie 中,我可以配置 iptables 来限制到我自己的路由器 (192.168.1.1) 的 DNS 流量:

Chain OUTBOUND (1 references)
target     prot opt source               destination         
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:443
ACCEPT     tcp  --  192.168.1.1          0.0.0.0/0            tcp dpt:53
ACCEPT     udp  --  192.168.1.1          0.0.0.0/0            udp dpt:53
LSO        all  --  0.0.0.0/0            0.0.0.0/0 

使用 Debian Stretch 就不再有效

Debian Stretch 强制向所有地方开放端口 53,否则浏览器和其他软件将无法工作。我担心这会允许第三个软件隐藏 DNS 查询。

我想知道为什么这个简单的 iptables 规则不能在 Stretch 中工作。


编辑:

root:# cat /etc/resolv.conf
# Generated by NetworkManager
search 192.168.1.1
nameserver 192.168.1.1


root:# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.424 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.298 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.494 ms


root:# tcpdump -nt -i eth0 udp port 53
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
^C
0 packets captured


root:# dig 192.168.1.1
^C

没有答案

从路由器端:

root@router:~ # dig 192.168.1.103

; <<>> DiG 9.2.4 <<>> 192.168.1.103
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31716
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;192.168.1.103.                 IN      A

;; ANSWER SECTION:
192.168.1.103.          0       IN      A       192.168.1.103

;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Oct 17 19:07:32 2018
;; MSG SIZE  rcvd: 47


root@router:~ # ping 192.168.1.103
PING 192.168.1.103 (192.168.1.103) 56(84) bytes of data.
64 bytes from 192.168.1.103: icmp_seq=0 ttl=64 time=0.257 ms
64 bytes from 192.168.1.103: icmp_seq=1 ttl=64 time=0.222 ms
64 bytes from 192.168.1.103: icmp_seq=2 ttl=64 time=0.331 ms
^C
--- 192.168.1.103 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.222/0.270/0.331/0.045 ms, pipe 2

答案1

这:

ACCEPT     tcp  --  192.168.1.1          0.0.0.0/0            tcp dpt:53
ACCEPT     udp  --  192.168.1.1          0.0.0.0/0            udp dpt:53

意味着您允许从 192.168.1.1 到端口 53 的传出请求。您需要对源端口 53 使用类似的规则。

相关内容