Score:0

PowerDNS: spoof NXDOMAIN response from "forward-zones" server and forward it

cn flag

I faced an issue trying to setup PowerDNS for my local network. I have a domain example.com managed by Cloudflare.

For instance I have A record on Cloudflare like server.example.com pointing to 1.1.1.1 but my local clients should resolve server.example.com to 10.10.10.1 and it's not a problem by using forward-zones="example.com=127.0.0.1:54"; in recursor config, but I have another record like mail.example.com pointing to 2.2.2.2, that server is outside of my local network and I have to copy A record from Cloudflare to my local PowerDNS by hands otherwise local client gets NXDOMAIN.

Looks like I need to spoof NXDOMAIN response from local PowerDNS and query forwarder. Is it possible?

EDIT: I started with LUA script and is able to catch NXDOMAIN response. But I can't forward it.

function nxdomain(dq)
    pdnslog("Intercepting NXDOMAIN for: "..dq.qname:toString())
    if dq.qtype == pdns.A
    then
        dq.rcode=0 -- make it a normal answer
        dq:addAnswer(pdns.A, "10.10.10.10")
        return true
    end
    return false
end
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.