<div dir="ltr">Thank you all for your suggestions<div><br></div><div>I'll try to work with messages instead of cache tables and see where this gets me</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><br><div><div>With Best Regards, </div><div dir="ltr"><br></div><div dir="ltr"><p style="margin:0pt"><span style="color:rgb(2,45,81);background-color:transparent;font-family:Arial;font-weight:bold">Dimitris Chryssanthakopoulos</span></p><p style="margin:0pt"><span style="color:rgb(2,45,81);background-color:transparent;font-family:Arial">IT Manager</span></p><p style="margin:0pt"><br><img src="https://i.postimg.cc/Hx2QhzDF/logokassian.jpg" width="200" height="62"><br></p><p style="margin:0pt"><span style="background-color:transparent;color:rgb(2,45,81);font-family:Arial">As Agents Only</span><br></p><p style="margin:0pt"><span style="background-color:transparent;color:rgb(2,45,81);font-family:Arial">367, Syngrou Av. | 175 64 Athens | Greece</span></p><p style="margin:0pt"><span style="color:rgb(2,45,81);background-color:transparent;font-family:Arial">tel: +30 210 9402001 | fax: +30 210 9402430</span></p><p style="margin:0pt"><span style="color:rgb(2,45,81);background-color:transparent;font-family:Arial">Website: </span><a href="http://www.kassian.gr/" style="background-color:transparent;font-family:Arial;color:rgb(17,85,204)" target="_blank">www.kassian.gr</a></p></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 6, 2022 at 7:16 PM Carsten Strotmann <<a href="mailto:carsten@strotmann.de">carsten@strotmann.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Dimitris,<br>
<br>
On 6 Jun 2022, at 18:01, Dimitris Chryssanthakopoulos via Unbound-users wrote:<br>
<br>
> Let me illustrate by an example, comparing what I get now and what I want<br>
><br>
> to get (what NextDNS does with "CNAME flattening"):<br>
<br>
"CNAME flattening" is a feature that is part of some authoritative server products. It is not part of the DNS protocol, and it is nothing that a DNS resolver such as Unbound can do.<br>
<br>
><br>
> normally, I query for "<a href="http://gravityzone.bitdefender.com" rel="noreferrer" target="_blank">gravityzone.bitdefender.com</a>" and I get a reply that:<br>
><br>
> \- "<a href="http://gravityzone.bitdefender.com" rel="noreferrer" target="_blank">gravityzone.bitdefender.com</a>" is a CNAME for "someserver.on.amazon.aws",<br>
><br>
> AND<br>
><br>
> \- "someserver.on.amazon.aws" has A record "212.216.124.1", AND<br>
><br>
> \- "someserver.on.amazon.aws" has A record "212.216.124.33"<br>
><br>
> what I need is to query for "<a href="http://gravityzone.bitdefender.com" rel="noreferrer" target="_blank">gravityzone.bitdefender.com</a>" and get a reply:<br>
><br>
> \- "<a href="http://gravityzone.bitdefender.com" rel="noreferrer" target="_blank">gravityzone.bitdefender.com</a>" has A record "212.216.124.1", AND<br>
><br>
> \- "<a href="http://gravityzone.bitdefender.com" rel="noreferrer" target="_blank">gravityzone.bitdefender.com</a>" has A record "212.216.124.33"<br>
><br>
> When querying NextDNS, with CNAME Flattening enabled in Settings (far right<br>
><br>
> tab of setup WebGUI) the second scenario occurs. The reason I ask here is<br>
><br>
> that I understand NextDNS use Unbound.<br>
><br>
> The DNS replies from Unbound will be used in my router to create dynamic<br>
><br>
> firewall rules. If I get regular DNS replies, I have to figure out the<br>
><br>
> CNAME chain myself with scripting on my router, which is too slow. (Often,<br>
><br>
> the CNAME chain is longer, and I need to recursively check a tree of CNAME<br>
><br>
> records and A records.)<br>
><br>
> If I get DNS replies like the second scenario, it is reasonably fast to run<br>
><br>
> a few statements for every entry in the router's DNS cache (for A records<br>
><br>
> only). In other words, I want to offload some processing from the router to<br>
><br>
> Unbound. Hope this clarifies.<br>
<br>
To reach your goal, I recommend to filter out all the CNAME responses and only process the A/AAAA Record responses.<br>
<br>
A DNS resolver (such as Unbound) will return all CNAME entries in the chain, as well as the final address records (if they exist).<br>
<br>
A (simple/naive) scripting solution could be<br>
<br>
dig <a href="http://gravityzone.bitdefender.com" rel="noreferrer" target="_blank">gravityzone.bitdefender.com</a> +short | grep -E '([0-9]{1,3}[\.]){3}[0-9]{1,3}'<br>
<br>
Greetings<br>
<br>
Carsten<br>
</blockquote></div>