pfsense:stopping_dns_leaks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
pfsense:stopping_dns_leaks [2020/04/14 15:23] – [PFSense - Stopping DNS Leaks] peter | pfsense:stopping_dns_leaks [2020/11/30 12:07] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PFSense - Stopping DNS Leaks ====== | ||
- | |||
- | Navigate to **Services -> DNS Resolver** | ||
- | |||
- | * DNS Query Forwarding: | ||
- | * Custom Options: | ||
- | server: | ||
- | # Next line is needed only if pfBlockerNG is being used. | ||
- | include: / | ||
- | ssl-upstream: | ||
- | do-tcp: yes | ||
- | forward-zone: | ||
- | name: " | ||
- | # Below 4 addresses are Cloudflare DNS. | ||
- | forward-addr: | ||
- | forward-addr: | ||
- | forward-addr: | ||
- | forward-addr: | ||
- | # Below 3 addresses are Quad9 DNS. | ||
- | forward-addr: | ||
- | forward-addr: | ||
- | forward-addr: | ||
- | </ | ||
- | |||
- | See https:// | ||
- | |||
- | It’s OK to set the resolver to listen on all interfaces, since the firewall rules on the WAN will prevent Internet hosts from using your resolver anyway. | ||
- | |||
- | <WRAP important> | ||
- | **WARNING: | ||
- | |||
- | However this is only for the first query. | ||
- | |||
- | Reason for this is that CloudFlare' | ||
- | |||
- | To prevent this increase in latency, switch to standard port 53, or to an alternative DNS provider that does not use TLS for example: | ||
- | |||
- | < | ||
- | server: | ||
- | # | ||
- | #do-tcp: yes | ||
- | forward-zone: | ||
- | name: " | ||
- | # Below 4 addresses are Cloudflare DNS SSL. | ||
- | # forward-addr: | ||
- | # forward-addr: | ||
- | # forward-addr: | ||
- | # forward-addr: | ||
- | # Non TLS. | ||
- | forward-addr: | ||
- | forward-addr: | ||
- | forward-addr: | ||
- | forward-addr: | ||
- | </ | ||
- | |||
- | Try other settings as needed, for instance: | ||
- | |||
- | < | ||
- | server: | ||
- | do-tcp: yes | ||
- | # Speed and privacy | ||
- | minimal-responses: | ||
- | prefetch: yes | ||
- | qname-minimisation: | ||
- | rrset-roundrobin: | ||
- | forward-zone: | ||
- | name: " | ||
- | # To keep local overrides and avoid slow downs. | ||
- | forward-ssl-upstream: | ||
- | # Below addresses are Cloudflare DNS | ||
- | forward-addr: | ||
- | forward-addr: | ||
- | # forward-addr: | ||
- | # forward-addr: | ||
- | </ | ||
- | |||
- | <WRAP info> | ||
- | **NOTE: | ||
- | |||
- | So using **forward-tls-upstream** instead inside the ' | ||
- | </ | ||
- | |||
- | |||
- | Testing with Google Chrome was a bit upset at first, but a **< | ||
- | |||
- | Measured a few lookups with Chrome and the network inspector, and it looks like uncached lookups are taking about 50ms. Without TLS the lookups run about 10ms. | ||
- | </ | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | ===== Test ===== | ||
- | |||
- | ==== Test using an internal DNS: ==== | ||
- | |||
- | <code bash> | ||
- | dig www.google.com @yourrouter.local | ||
- | </ | ||
- | |||
- | You should see a resolve against your router’s local DNS resolver that works. | ||
- | |||
- | <WRAP info> | ||
- | **NOTE: | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ==== Test using an external DNS ==== | ||
- | |||
- | Try and dig something against an IP that you know is not internal and is not a DNS server. | ||
- | |||
- | <code bash> | ||
- | dig www.google.com @8.8.8.8 | ||
- | </ | ||
- | |||
- | Assuming that’s all fine, you should now be able to configure a broad block rule to bar all outbound port 53. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Block all outbound non-encrypted DNS ===== | ||
- | |||
- | Navigate to **Firewall -> Rules** | ||
- | |||
- | On the **WAN** interface, define a new rule at the top of the list. This rule should use these settings; | ||
- | |||
- | * Action: **Block**. | ||
- | * Interface: **WAN**. | ||
- | * Address Family: **IPv4+IPv6**. | ||
- | * Protocol: **TCP/ | ||
- | * Source: **any**. | ||
- | * Destination: | ||
- | * Destination Port: **DNS (53)**. | ||
- | * Description: | ||
- | |||
- | Verify that you can still resolve against the local resolver (your router’s IP), and that you can still resolve against what seems to be external resolver (e.g, 8.8.8.8). | ||
- | |||
- | You should also check that when you do so that nothing passes on the WAN interface on port 53. | ||
- | |||
- | ---- | ||
- | |||
- | ===== References ===== | ||
- | |||
- | https:// | ||
- | |||
- | https:// | ||
- | |||
- | https:// | ||
- | |||
- | https:// | ||
pfsense/stopping_dns_leaks.1586877832.txt.gz · Last modified: 2020/07/15 09:30 (external edit)