Re: Lua view record - how to return NXDOMAIN?

Greg Owen via Pdns-users <[email protected]> Tue, 29 Oct 2024 23:30:36 +0000
Newsgroups gmane.network.dns.powerdns.user
Message-ID <[email protected]>
On Tue, Oct 29, 2024 at 10:14:29PM +0000, Djerk Geurts via Pdns-users wrote:
> Is there a way to return NXDOMAIn instead of a valid response?
> 
> test IN LUA CNAME "view({{{'10.0.0.0/16'},{‘ns0.internal.domain.com.'}},{{'0.0.0.0/0'},{''}}})”
> 
> I would like to return NXDOMAIN instead of SERVFAIL for sources outside 10.0/16.

I've got some old code that does it like this:

	name.rcode = pdns.NXDOMAIN
	return true;

This is in function preresolve(name). You can look at the code at 
https://github.com/gowenfawr/dnSentry/blob/main/dnSentry.lua

-- 
    gowen - Greg Owen - [email protected]
_______________________________________________
Pdns-users mailing list
[email protected]
https://mailman.powerdns.com/mailman/listinfo/pdns-users