RPZ seems not work as expected? #15649
-
Hi, I am new to pdns, and I want to try the rpz features. I use the latest source build 5.2.2 version of pdns_recursor. Here is my recursor.yml dnssec:
log_bogus: true
incoming:
listen:
- 127.0.0.1:53
recursor:
extended_resolution_errors: true
forward_zones:
- zone: some.internal.domain
forwarders:
- 10.10.100.100:53
lua_dns_script: /usr/local/etc/rpz_policy.lua
rpzs:
- name: '/usr/local/etc/blocklist.rpz.zone'
defpol: NoAction
defpolOverrideLocalData: true
policyName: 'custom-policy'
includeSOA: true
defttl: 60
outgoing:
source_address:
- 0.0.0.0
- '::'
logging:
trace: yes
quiet: true
loglevel: 6 and blocklist.rpz.zone
and rpz_policy.lua function preresolve(dq)
if dq.policyName == "custom-policy" then
local q = dq.qname:toString()
if q:match("badware%.net%.?$") or q:match(".*%.badware%.net%.?$") then
dq.rcode = 0
dq:addAnswer(pdns.A, "1.1.1.1")
return true
end
end
return false
end
I found some logs when execute
If I changed reference: https://doc.powerdns.com/recursor/lua-config/rpz.html#policy-custom |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There are a few things wrong:
With that it works here. Example dig output:
Trace line:
|
Beta Was this translation helpful? Give feedback.
There are a few things wrong:
#
comments will cause a syntax error. Use;;
for comments in zone files.defpol
anddefpolOverrideLocalData
. Leave them both out.With that it works here. Example dig output: