AdGuardHome icon indicating copy to clipboard operation
AdGuardHome copied to clipboard

Domains with CNAME records are not processed correctly

Open c15412 opened this issue 5 months ago • 4 comments

Prerequisites

Platform (OS and CPU architecture)

Windows, AMD64 (aka x86_64)

Installation

GitHub releases or script from README

Setup

On one machine

AdGuard Home version

v0.107.52

Action

(My English is not very good, so I use examples to express my meaning) I write those rules on Custom filtering rules(as follow). But the domains that use CNAME records point to domains that should be processed are not have been processed correctly These domains are still randomly assigned IPs in different zones via the original DNS through the CNAME records. Domains with the CNAME records that match the rule are not processed! Now, I can only rewrite domains that use CNAME records one by one. which is cumbersome and unstable! I think the filter should be applied to the domain on the CNAME records I also tried setting up different DNS providers, but when I set 223.6.6.6 as the provider for *.w.alikunlun.com, those domains using CNAME records pointing to *.w.alikunlun.com resolved via default DNS.

for example: example1.com and example2.com etc. (Thousands of domains using the same CDN) use the CNAME records point to the sub domains of *.w.exampleCDN.com , Then I run the test to get the best CDN IPs for *.w.exampleCDN.com under my network. So I add the rewrite rules to rewrite the CDN IP. But in fact the example1.com get the IPs-Group-1 via the original DNS through the CNAME records the example2.com get the IPs-Group-2 via the original DNS through the CNAME records etc.

||w.alikunlun.com^$dnsrewrite=39.173.176.101 ||w.alikunlun.com^$dnsrewrite=39.173.176.102 ||w.alikunlun.com^$dnsrewrite=39.173.176.103 ||w.alikunlun.com^$dnsrewrite=39.173.176.104 ||w.alikunlun.com^$dnsrewrite=39.173.176.105 ||w.alikunlun.com^$dnsrewrite=39.173.176.106 ||w.alikunlun.com^$dnsrewrite=39.173.176.107 ||w.alikunlun.com^$dnsrewrite=39.173.176.108

Expected result

I believe that the IP resolution of domains in CNAME records should be resolved by the appropriate provider in the provider list, not the provider of the domain itself using that CNAME record. Also, because there are different servers and different subdomains, I can't single out a provider for the main domain. I think it would be better to triage the domains inside the CNAME record to get resolution based on the provider rules and filtering rules

example : I set the provider DNSProvider2(192.168.1.3) for exampleCDN.com. And default DNS (192.168.1.1) for default example1.com use the CNAME record point to exampleCDN.com exampleCDN.com resolves to 111.1.164.249 on the default dns. (Which server is not the best and fastest) exampleCDN.com resolves to 39.173.176.101 on DNSProvider2.(the best server)

when I use "nslookup example1.com" It resolved the domain via default DNS (192.168.1.1) and got the IPs. This is how it works. DOMAIN:example1.com==>(match the default Provider) ↓ use default Provider(192.168.1.1)==> records: CNAME exampleCDN.com ↓ use default Provider(192.168.1.1)==>IP: 111.1.164.249

I think that's the right way to work: DOMAIN:example1.com==>(match the default Provider) ↓ use default Provider(192.168.1.1)==> records: CNAME exampleCDN.com ↓ exampleCDN.com==>(match the DNSProvider2) ↓ use DNSProvider2(192.168.1.3)==>IP: 39.173.176.101

Actual result

NAME: media.cdn.queniuqe.com.w.alikunlun.com Addresses: 111.1.164.244 111.1.164.243 111.1.164.245 111.1.164.246 111.1.164.248 111.1.164.249 111.1.164.222 111.1.164.242 Aliases: media.cdn.queniuqe.com This is how it works. image image

Additional information and/or screenshots

the domains with CNAME records were wrongly resolved by the dns provider of the domain itself, instead of the provider of domains in CNAME records.

c15412 avatar Sep 20 '24 10:09 c15412