AdGuardHome icon indicating copy to clipboard operation
AdGuardHome copied to clipboard

Cannot set custom rule for _dns.resolver.arpa SVCB

Open timkgh opened this issue 1 year ago • 8 comments

Prerequisites

Platform (OS and CPU architecture)

Darwin (aka macOS), AMD64 (aka x86_64)

Installation

GitHub releases or script from README

Setup

On one machine

AdGuard Home version

v0.108.0-b.62

Action

I would like to set a custom rule for _dns.resolver.arpa SVCB queries so that AGH does not advertise DoH, DoT, etc. even though encryption is enabled.

I tried adding the rule: |_dns.resolver.arpa^$important,dnstype=SVCB,dnsrewrite=REFUSED I also tried NXDOMAIN, NOERROR.

It does not work, so either AGH responds to this query before it checks the filter rules or my rule is not quite right.

Expected result

Expect to be able to block _dns.resolver.arpa SVCB queries.

Actual result

Custom rule does not work.

Additional information and/or screenshots

An alternate config setting to disable responding to this SVCB query would be fine too.

Related #7598

timkgh avatar Jan 28 '25 17:01 timkgh

Looks like you cannot rewrite it.

https://github.com/AdguardTeam/AdGuardHome/blob/81213e81cf56164492a2ade998fd96fe7cf91369/internal/dnsforward/process.go#L242

Currently, you can only turn it off by dns.handle_ddr: false, so that AdGuardHome won't respond with misleading info when used with reverse proxy.

aur3l14no avatar Dec 19 '25 08:12 aur3l14no

Currently, you can only turn it off by dns.handle_ddr: false, so that AdGuardHome won't respond with misleading info when used with reverse proxy.

It doesn't work correctly, it passes the SVCB query upstream and the upstream will respond to it (e.g. 8.8.8.8) and then the clients will just connect to the upstream directly over DoT or DoH.

timkgh avatar Dec 20 '25 04:12 timkgh

You are right. It turns out handle_ddr: false doesn't block ddr but forward it instead. I happened to use upstream servers that doesn't respond to SVCB so I didn't notice it in the first place.

However, you can add _dns.resolver.arpa to blocked_hosts. This alongside with handle_ddr: false would effectively block the ddr. Very hacky though :/

aur3l14no avatar Dec 20 '25 05:12 aur3l14no

Isn't it possible to write a custom rewrite rule to return what you want? I'm no expert but I've been following the progress here and it just came to my mind.

Mirabis avatar Dec 20 '25 13:12 Mirabis

Isn't it possible to write a custom rewrite rule to return what you want? I'm no expert but I've been following the progress here and it just came to my mind.

This is exactly what this issue is about. It does not work, for these queries AGH does not look at the custom rules.

timkgh avatar Dec 20 '25 16:12 timkgh

However, you can add _dns.resolver.arpa to blocked_hosts. This alongside with handle_ddr: false would effectively block the ddr. Very hacky though :/

This works, even without setting handle_ddr: false. It looks like AGH just drops the query and the client just takes a while to time out. It would be nicer if it quickly returned REFUSED instead.

timkgh avatar Dec 20 '25 21:12 timkgh

Current source confirms that this is the same design gap described by #7570.

DDR processing runs before normal request filtering. When built-in DDR is enabled, AdGuard Home locally finishes _dns.resolver.arpa handling, so a custom filtering rule cannot override that response. When DDR is disabled, the query can instead reach the upstream unless a separate blocking mechanism intercepts it. The focused current DDR processing test passes under the race detector and preserves that ordering.

I suggest consolidating the requested behavior under #7570, whose scope is to make DDR responses configurable. The acceptance criteria should explicitly cover at least three modes: built-in advertisement, operator-supplied SVCB answers, and an immediate negative response without forwarding the discovery query upstream.

Sil3ntVip3r avatar Aug 05 '26 01:08 Sil3ntVip3r

Hello. User rules cannot override _dns.resolver.arpa while the built-in DDR is active, because AdGuardHome handles this request before filtering begins. This is the same request as #7570. You can vote for the implementation of this feature. I am closing this issue as a duplicate.

sofvaskina avatar Sep 02 '26 10:09 sofvaskina