Open thinkwelltwd opened 4 years ago
If you just need to do something to log them - the policy being applied is available in preresolve
and you can just check dq.appliedPolicy.policyName ~= ""
or similar.
Indeed that is right; preresolve
gets me what I want. I'd read over the hooks carefully and wondered what the postrpz
hook was. Apparently it's preresolve
and I suppose I should've intuited that.
If the docs could be changed from:
This function is called before any DNS resolution is attempted,
to:
This function is called after RPZs are applied and before any DNS resolution is attempted,
I'll leave the ticket open because the behaviour I'm seeing does not match the docs. postresolve
should really be called...
Anyway, this does get me logging, so very many thanks @phonedph1!
postresolve
should really be called...
I agree the documentation should be more explicit on that, but I don't think it really makes sense to call postresolve
in that case since the RPZ hit prevents the resolution process from even starting.
Short description
postresolve lua hook never gets DNS Questions that were found in a response policy zone
Environment
Steps to reproduce
/etc/pdns-recursor/recursor.conf
recursorconf.lua
lua_dns_script.lua
Expected behaviour
Log line when RPZ fired
Log lines of when no RPZ fired
Actual behaviour
There's no postresolve logline for the domains in the urlhaus RPZ, so no way of logging malware activity.
Log line when RPZ fired
Log lines of when no RPZ fired
Question
Presumably postresolve logging would be the recommended approach to logging RPZ hits to a file for further activity reporting. I also tried
dnstap
config but wasn't able to get that working. In reading this issue it doesn't seem like dnstap in Recursor is ready for prime time.