[Pdns-users] Recursor and LUA scripting: I don't understand why preresolve answering a CNAME won't cascade to other records
Roman Steinhart
roman at aternos.org
Sun May 31 10:12:29 UTC 2020
Hi,
If I'm not wrong you need to tell pdns to resolve the CNAME:
https://doc.powerdns.com/recursor/lua-scripting/hooks.html#cname-chain-resolution
Regards,
Roman
Am So., 31. Mai 2020 um 12:08 Uhr schrieb Oscar Koeroo via Pdns-users <
pdns-users at mailman.powerdns.com>:
> Hi,
>
> I’m using my the Recursor version 4.3.1 on my Pi and building the
> following. I have a VPS and a home-server. I use “domain.net” for the
> internet access and in my home I use “domain.local”.
>
> Due to NAT and how my home router works, I intercept the DNS requests and
> provide a local answer instead of the WAN IP address for example. In other
> case I would like to use “domain.net”
>
>
> I’m using the following LUA script to intercept, but I don’t understand
> the results. Why doesn’t the dig get the CNAME to got to the A record I
> have in my domain.local zone? I expected dig to try to get the CNAME value
> of qr.domain.net and the CNAME value of that result, which seems to halt
> there.
>
>
>
>
> The expected result I was looking for was:
>
>
> dig qr.domain.net
>
> ;; ANSWER SECTION:
> qr.domain.net. 3600 IN CNAME qr.domain.local.
> qr.domain.local. 41584 IN CNAME apps.domain.local.
> apps.koeroo.local. 40931 IN A 192.168.1.28
> - EOL
>
>
>
> I got:
>
>
> dig qr.domain.net
>
> ;; ANSWER SECTION:
> qr.domain.net. 3600 IN CNAME qr.domain.local.
> - EOL
>
>
> dig cloud.domain.net
>
> ;; ANSWER SECTION:
> cloud.domain.net. 3600 IN A 192.168.1.15
> - EOL
>
>
>
> Script:
>
> function preresolve(dq)
> if dq.qtype == pdns.A then
> if (dq.qname:toString() == "cloud.domain.net.") then
> pdnslog("preresolve: " .. dq.qname:toString(),
> pdns.loglevels.Info)
> dq:addAnswer(pdns.A, "192.168.1.15")
> dq.rcode = pdns.NOERROR
> return true
> elseif (dq.qname:toString() == "vpn.domain.net.") then
> pdnslog("preresolve: " .. dq.qname:toString(),
> pdns.loglevels.Info)
> dq:addAnswer(pdns.A, "192.168.1.37")
> dq.rcode = pdns.NOERROR
> return true
> elseif (dq.qname:toString() == "qr.domain.net.") then
> pdnslog("preresolve: " .. dq.qname:toString(),
> pdns.loglevels.Info)
> dq:addAnswer(pdns.CNAME, "qr.domain.local")
> dq.rcode = pdns.NOERROR
> return true
> end
> end
> return false
> end
>
>
> Oscar Koeroo
>
>
>
> _______________________________________________
> Pdns-users mailing list
> Pdns-users at mailman.powerdns.com
> https://mailman.powerdns.com/mailman/listinfo/pdns-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20200531/d469e612/attachment.htm>
More information about the Pdns-users
mailing list