Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPS record filtering #6053

Closed
4 tasks done
ExternalDatabase opened this issue Jul 28, 2023 · 6 comments
Closed
4 tasks done

HTTPS record filtering #6053

ExternalDatabase opened this issue Jul 28, 2023 · 6 comments

Comments

@ExternalDatabase
Copy link

Prerequisites

Platform (OS and CPU architecture)

FreeBSD, AMD64 (aka x86_64)

Installation

Docker

Setup

On one machine

AdGuard Home version

v0.107.35

Action

nslookup -debug -type=a 'www.example.com' '$YOUR_AGH_ADDRESS'

/opt/adguardhome/work # nslookup -debug -type=a 'meetings.hubspot.com' '192.168.0.94'
Server: 192.168.0.94
Address: 192.168.0.94:53

Query #0 completed in 4ms:
Non-authoritative answer:
Name: meetings.hubspot.com
Address: 0.0.0.0

Expected result

return 0.0.0.0 or NXDOMAIN
AND
don't ask upstream server

Actual result

returned 4 times 0.0.0.0 and 1 time the request has been passed to upstream DNS server

that domain is just an example - it happens for other domains too randomly
most requests of blocked domains are resolved as 0.0.0.0 locally and AGH doesn't ask upstream for resolve them

Additional information and/or screenshots

From AGH:
dnsleak1

From upstream DNS server:
dnsleak2

@fernvenue
Copy link
Contributor

So what is your block rule for this domain?

@ExternalDatabase
Copy link
Author

ExternalDatabase commented Jul 29, 2023

that domain is listed within StevenBlack/hosts, so it should be blocked
in AGH settings blocking mode is set to return 0.0.0.0 (Null IP)

when the Client asks AGH for that domain type 'A' record - it is blocked
when the Client asks AGH for that domain type 'https' record - AGH resolve it as normal (not listed) domain

SOA, CNAME, NS, TXT requests are processed too (answer blocked by the upstream dns server):
`/opt/adguardhome/work # nslookup -debug -type=soa 'meetings.hubspot.com' '192.168.0.94'
Server: 192.168.0.94
Address: 192.168.0.94:53

Query #0 completed in 21ms:
Non-authoritative answer:

/opt/adguardhome/work # nslookup -debug -type=ns 'meetings.hubspot.com' '192.168.0.94'
Server: 192.168.0.94
Address: 192.168.0.94:53

Query #0 completed in 25ms:
Non-authoritative answer:

/opt/adguardhome/work # nslookup -debug -type=cname 'meetings.hubspot.com' '192.168.0.94'
Server: 192.168.0.94
Address: 192.168.0.94:53

Query #0 completed in 19ms:
Non-authoritative answer:

/opt/adguardhome/work # nslookup -debug -type=txt 'meetings.hubspot.com' '192.168.0.94'
Server: 192.168.0.94
Address: 192.168.0.94:53

Query #0 completed in 21ms:
Non-authoritative answer:
`

dnsleak4

@fernvenue
Copy link
Contributor

when the Client asks AGH for that domain type 'https' record - AGH resolve it as normal (not listed) domain

That's why I asked for your block rules, and you said:

that domain is listed within StevenBlack/hosts, so it should be blocked

Actually this is a duplicate issue for #5124, as @RainmakerRaw said:

If you look at the request types, it's processing HTTPS queries, not IP records. These will not resolve to an IP for the purposes of connecting to the server in question. In that sense, there's nothing to rewrite/block. Only A and AAAA record lookups need rewriting to 0.0.0.0 here, which prevents your client(s) from connecting to the domain in question. The HTTPS lookup is simply asking for information about the domain. See here.

So AdGuardHome's behavior here is actually expected and there is no error, and you can add this file as a separate filtering rule list instead, which will block all types of queries.

@ainar-g
Copy link
Contributor

ainar-g commented Jul 31, 2023

Safari is starting to use the ipv[46]hints for DNS resolving, though, so I feel like we should handle these better.

@Mizzick, please add DNS HTTPS record filtering to AdGuard Home.

@ainar-g ainar-g added this to the v0.107.36 milestone Jul 31, 2023
@ainar-g ainar-g changed the title DNS leak HTTPS record filtering Jul 31, 2023
adguard pushed a commit that referenced this issue Aug 9, 2023
Updates #6053.

Squashed commit of the following:

commit b71957f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Wed Aug 9 16:12:10 2023 +0300

    all: docs

commit 3e394fb
Merge: f406a5f c47509f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Wed Aug 9 15:15:37 2023 +0300

    all: imp code

commit f406a5f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Wed Aug 9 15:05:43 2023 +0300

    all: imp code

commit 0de1e0e
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Wed Aug 9 14:45:21 2023 +0300

    all: docs

commit d98cbaf
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Wed Aug 9 11:54:39 2023 +0300

    dnsforward: https blocked rcode

commit c13ffda
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Wed Aug 9 10:45:27 2023 +0300

    dnsforward: imp tests

commit 9c5bc29
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Wed Aug 9 10:08:06 2023 +0300

    dnsforward: imp code

commit d6ff28b
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Tue Aug 8 16:00:15 2023 +0300

    all: imp code

commit 832b599
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Tue Aug 8 13:32:15 2023 +0300

    dnsforward: https filtering

commit 6a2bdd1
Merge: 257a1b6 54aee22
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Tue Aug 8 11:44:12 2023 +0300

    Merge remote-tracking branch 'origin/master' into 6053-https-filtering

    # Conflicts:
    #	CHANGELOG.md

commit 257a1b6
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Tue Aug 8 11:26:13 2023 +0300

    dnsforward: imp tests

commit edba217
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Fri Aug 4 15:03:02 2023 +0300

    dnsforward: https filtering

commit 4c93be3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Fri Aug 4 14:36:33 2023 +0300

    docs: https filtering

commit 1d2d1aa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Fri Aug 4 12:54:05 2023 +0300

    all: https filtering hints
@Mizzick
Copy link
Contributor

Mizzick commented Aug 9, 2023

Please have a look, we have implemented the requested changes.
The new build version v0.108.0-a.646+1e939703 has been just published to the edge channel.

@ainar-g
Copy link
Contributor

ainar-g commented Aug 21, 2023

We'll close this issue. Feel free to reopen if the filtering doesn't work for you.

@ainar-g ainar-g closed this as completed Aug 21, 2023
@ainar-g ainar-g modified the milestones: v0.107.38, v0.107.37 Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants