![데비안 9에서는 숨겨진 DNS 쿼리를 허용합니까?](https://linux55.com/image/140768/%EB%8D%B0%EB%B9%84%EC%95%88%209%EC%97%90%EC%84%9C%EB%8A%94%20%EC%88%A8%EA%B2%A8%EC%A7%84%20DNS%20%EC%BF%BC%EB%A6%AC%EB%A5%BC%20%ED%97%88%EC%9A%A9%ED%95%A9%EB%8B%88%EA%B9%8C%3F.png)
이전 Debian Jessie에서는 DNS 트래픽을 내 라우터(192.168.1.1)로 제한하도록 iptables를 구성할 수 있었습니다.
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에도 비슷한 규칙을 사용해야 합니다.