DNS rewrite of CNAME record does not follow upstream chain #2899

Open
opened 2026-03-04 02:36:32 -05:00 by deekerman · 6 comments
Owner

Originally created by @Freekers on GitHub (Jul 13, 2021).

I have a CNAME record on my domain set up as follows:
bob.domain.com --> alice.domain.com --> 123.123.123.123

I've setup Adguard to rewrite all DNS queries to alice.domain.com to 127.0.0.1, hence I expect bob.domain.com to resolve to 127.0.0.1 as well. However, bob.domain.com still resolves to 123.123.123.123

Is this intended behavior? I would expect bob.domain.com to resolve to 127.0.0.1 since it points to alice.domain.com, which has a DNS rewrite in place to 127.0.0.1

Thank you.


Running Adguard Home Version: v0.106.3 in Docker (tag: latest).

Originally created by @Freekers on GitHub (Jul 13, 2021). I have a CNAME record on my domain set up as follows: bob.domain.com --> alice.domain.com --> 123.123.123.123 I've setup Adguard to rewrite all DNS queries to alice.domain.com to 127.0.0.1, hence I expect bob.domain.com to resolve to 127.0.0.1 as well. However, bob.domain.com still resolves to 123.123.123.123 Is this intended behavior? I would expect bob.domain.com to resolve to 127.0.0.1 since it points to alice.domain.com, which has a DNS rewrite in place to 127.0.0.1 Thank you. ----- Running Adguard Home Version: v0.106.3 in Docker (tag: latest).
Author
Owner

@agneevX commented on GitHub (Jul 13, 2021):

Directly related to #3342, which I opened yesterday.

@agneevX commented on GitHub (Jul 13, 2021): Directly related to #3342, which I opened yesterday.
Author
Owner

@Freekers commented on GitHub (Jul 13, 2021):

I saw your issue indeed but wasn't sure if they were the same. Feel free to merge/close this one.

@Freekers commented on GitHub (Jul 13, 2021): I saw your issue indeed but wasn't sure if they were the same. Feel free to merge/close this one.
Author
Owner

@ainar-g commented on GitHub (Jul 13, 2021):

Hello, could you please add the following information:

  1. How did you add a CNAME record for bob.domain.com that leads to alice.domain.com: through the “Filters → DNS rewrites” form or using $dnsrewrite?
  2. Same with the rewrite of alice.domain.com to 127.0.0.1: did you use the form, $dnsrewrite, or /etc/hosts-style rules in custom rules?
  3. Can you configure AdGuard Home to collect more logs and post the logs related to queries for bob.domain.com and alice.domain.com here?

Thanks!

@ainar-g commented on GitHub (Jul 13, 2021): Hello, could you please add the following information: 1. How did you add a `CNAME` record for `bob.domain.com` that leads to `alice.domain.com`: through the “Filters → DNS rewrites” form or using [`$dnsrewrite`]? 2. Same with the rewrite of `alice.domain.com` to `127.0.0.1`: did you use the form, `$dnsrewrite`, or `/etc/hosts`-style rules in custom rules? 3. Can you [configure] AdGuard Home to collect more logs and post the logs related to queries for `bob.domain.com` and `alice.domain.com` here? Thanks! [`$dnsrewrite`]: https://github.com/AdguardTeam/AdGuardHome/wiki/Hosts-Blocklists#dnsrewrite [configure]: https://github.com/AdguardTeam/AdGuardHome/wiki/FAQ#verboselog
Author
Owner

@Freekers commented on GitHub (Jul 14, 2021):

Hi @ainar-g

  1. Since I own the domain domain.com, I added the CNAME record bob.domain.com that leads to alice.domain.com directly in the DNS of the domain itself (i.e. Cloudflare).

  2. I used the “Filters → DNS rewrites” to create a rewrite from alice.domain.com to 127.0.0.1

  3. I tried enabling verbose logging, but I cannot get it to work. I've enabled verbose logging as follows in the AdGuardHome.yaml

log_file: "/opt/adguardhome/work/log.txt"
verbose: true

It doesn't write anything. I created an empty log.txt file using touch, but AdGuard still does not log anything. AdGuard has permissions to write to the file.

Thanks!

@Freekers commented on GitHub (Jul 14, 2021): Hi @ainar-g 1. Since I own the domain `domain.com`, I added the CNAME record `bob.domain.com` that leads to `alice.domain.com` directly in the DNS of the domain itself (i.e. Cloudflare). 2. I used the “Filters → DNS rewrites” to create a rewrite from `alice.domain.com` to `127.0.0.1` 3. I tried enabling verbose logging, but I cannot get it to work. I've enabled verbose logging as follows in the `AdGuardHome.yaml` ``` log_file: "/opt/adguardhome/work/log.txt" verbose: true ``` It doesn't write anything. I created an empty log.txt file using touch, but AdGuard still does not log anything. AdGuard has permissions to write to the file. Thanks!
Author
Owner

@ainar-g commented on GitHub (Jul 23, 2021):

@Freekers Sorry for the delayed response. I'm not sure what is wrong with the log file not being written (perhaps the volume mounted as readonly?), but after some discussions with other developers it seems like such recursive CNAMEchecking is currently outside of the scope of AGH. There is some very basic recursion checking in the “DNS Rewrites” feature, so if you duplicate the bob.domain.com --> alice.domain.com CNAME there, it should work, but that is a temporary workaround, as these rewrites are about to be merged into the $dnsrewrite rules, see #2499.

This is a systematic issue of the current implementation of AGH, and I'm not sure if we can fix this in the current architecture. Perhaps we can return to this after the big refactorings that are coming in v0.108.0 and v0.109.0.

@ainar-g commented on GitHub (Jul 23, 2021): @Freekers Sorry for the delayed response. I'm not sure what is wrong with the log file not being written (perhaps the volume mounted as readonly?), but after some discussions with other developers it seems like such recursive `CNAME`checking is currently outside of the scope of AGH. There is some very basic recursion checking in the “DNS Rewrites” feature, so if you duplicate the `bob.domain.com --> alice.domain.com` `CNAME` there, it should work, but that is a temporary workaround, as these rewrites are about to be merged into the `$dnsrewrite` rules, see #2499. This is a systematic issue of the current implementation of AGH, and I'm not sure if we can fix this in the current architecture. Perhaps we can return to this after the big refactorings that are coming in v0.108.0 and v0.109.0.
Author
Owner

@Freekers commented on GitHub (Jul 25, 2021):

Thanks for the explanation, @ainar-g
No worries, now that I know it's a limitation and not a bug, I can live with that :)

@Freekers commented on GitHub (Jul 25, 2021): Thanks for the explanation, @ainar-g No worries, now that I know it's a limitation and not a bug, I can live with that :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AdGuardHome#2899
No description provided.