[Pdns-users] Lua view record - how to return NXDOMAIN?

Greg Owen gowen at swynwyr.com
Tue Oct 29 23:30:36 UTC 2024


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 - gowen at swynwyr.com


More information about the Pdns-users mailing list