dns/bind: add Response Policy Zone (RPZ) support#5399
Conversation
|
@mbedworth can you please use our PR template? |
|
The PR description has been updated to use the standard template (checkboxes, "Describe the problem" / "Describe the proposed solution" sections). Let me know if anything else needs adjusting before review. |
|
Just checking in on the BIND RPZ PR — let us know if there's anything blocking review or if any additional information would be helpful. Happy to rebase if anything has changed in the plugin since submission, or make any other adjustments to facilitate a smooth review. |
Adds native RPZ configuration to the os-bind plugin with a dedicated
settings tab in the GUI.
The DNSBL feature already uses response-policy inside options{}, but
there is no way to configure a standalone RPZ (e.g. a local blocklist
fed by an external updater) without manually editing named.conf, which
is overwritten on every service restart.
New files:
- Rpz.xml / Rpz.php: model mounted at //OPNsense/bind/rpz
- RpzController.php: REST API via ApiMutableModelControllerBase
(GET /api/bind/rpz/get, POST /api/bind/rpz/set)
- forms/rpz.xml: GUI form definition
Modified files:
- GeneralController.php: expose rpzForm to the view
- general.volt: add RPZ tab between DNSBL and ACLs; wire up
mapDataToFormUI and saveAct_rpz click handler
- named.conf template: emit response-policy inside options{} and
the zone declaration when RPZ is enabled and a zone name is set
Configuration fields:
- enabled: on/off toggle
- zone: zone name (file resolved to /usr/local/etc/namedb/primary/<zone>.db)
- policy: nxdomain | nodata | passthru | drop | tcp-only (optional override)
- break_dnssec: allow RPZ rewrites over DNSSEC-signed responses
Tested on OPNsense 25.1 with BIND 9.20 and Hagezi Light blocklist
(137,674 entries). NXDOMAIN confirmed for blocked domains; normal
resolution unaffected.
|
@mimugmail rebased onto current master (the branch was far behind). While doing so I also fixed a latent conflict: RPZ was emitting its own |
c0ec4a5 to
4bbe57f
Compare
Important notices
Before you submit a pull request, we ask you kindly to acknowledge the following:
If AI was used, please disclose:
Describe the problem
The BIND plugin already supports DNSBL-based response-policy zones, but there is no way to configure a standalone RPZ (e.g. a local blocklist maintained by an external update script) without manually editing
named.conf. Becausenamed.confis regenerated by the configd template engine on every service restart and OS update, manual edits do not survive.The
response-policydirective must appear inside theoptions {}block, which means it cannot be injected via a top-levelincludefile fromnamed.conf.d/.Describe the proposed solution
Adds a native RPZ settings tab to the BIND GUI (between DNSBL and ACLs) and wires it through the standard OPNsense MVC/API stack:
models/OPNsense/Bind/Rpz.xml//OPNsense/bind/rpzmodels/OPNsense/Bind/Rpz.phpApi/RpzController.php/api/bind/rpz/get,/api/bind/rpz/set)forms/rpz.xmlGeneralController.phprpzFormto the viewgeneral.voltnamed.conf(template)response-policyinsideoptions {}and zone declarationConfiguration fields
/usr/local/etc/namedb/primary/<zone>.dbnxdomain|nodata|passthru|drop|tcp-only(optional; omit to use zone's own CNAME records)Coexistence with DNSBL
When both DNSBL and RPZ are enabled, two separate
response-policystatements are emitted — one for DNSBL zones and one for the RPZ zone. BIND supports multipleresponse-policystatements.Testing
Tested on OPNsense 25.1 with BIND 9.20:
rpz.localzone and Hagezi Light blocklist (137,674 entries)named-checkconfpasses cleanlyNXDOMAINwithrpz.localin the authority sectionconfigctl bind restartRelated issue
N/A