os-bind: Apply silently loses newly added static records on dynamic zones (allowrndcupdate)

Open
#5,931 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
php

Research direction

Start by tracing the BIND reconfigure action that reloads the OPNsense/Bind template and restarts named, then inspect the zone model and generated master-file path described in the report. Check how dynamic zones with allowrndcupdate are handled during Apply and compare that with ISC's documented dynamic-zone edit cycle. Done when a static record remains in the master file and answers after Apply on a zone with dynamic updates.

Written by the indexing model from the issue text.

Description

incomplete

Bug summary

Adding a static record to a dynamic zone (one with Allow RNDC update / allowrndcupdate enabled, e.g. receiving Kea DDNS updates via RFC 2136) through the GUI and pressing Apply results in the new record being silently lost. The GUI reports success, but the record never answers.

Root cause (verified on os-bind 1.34_4, OPNsense 26.7)

The reconfigure action performs, in order:

  1. template reload OPNsense/Bind → regenerates the zone master file from the model (contains only static records),
  2. configctl bind restart → rc.d/named restart.

On stop, named flushes its in-memory zone state (old statics + dynamic journal content, without the new record) over the freshly generated master file. On start, named loads that dumped file. The newly added static record is gone.

If the zone is not dirty (no dynamic updates since load, e.g. zones without DDNS) named does not dump, the generated file survives, and Apply works — which is why this only hits dynamic zones.

Steps to reproduce

  1. Create a primary zone, enable Allow RNDC update (allowrndcupdate), have a DHCP server (Kea) register dynamic records via RFC 2136 so the zone has a journal and is "dirty".
  2. GUI → Services → BIND → Records → add a new static A record → Apply.
  3. Query the new name (e.g. dig @<firewall> newrecord.<zone>) → NXDOMAIN / no answer.
  4. The record is also absent from the master file on disk (/usr/local/etc/namedb/primary/<zone>.db) after Apply.

Expected: record persists and answers after Apply.

Suggested fix

For zones with allowrndcupdate enabled, the reconfigure should follow ISC's documented edit cycle for dynamic zones before regenerating templates: rndc freeze <zone> → regenerate → rndc reload/rndc thaw (or at minimum rndc sync -clean before the template reload), so the dumped state cannot overwrite the freshly generated master file.

Workarounds in the meantime

  • Apply twice (second Apply loads the record because the zone is no longer dirty in that window — racy if new DDNS updates arrive in between), or
  • keep DHCP-registered names in a separate zone.

Environment

  • OPNsense 26.7 (FreeBSD 15.1-RELEASE-p6)
  • os-bind 1.34_4
  • BIND 9.20.30
  • Kea DHCP (core) doing RFC 2136 DDNS into the affected zone

Reported by: Daniel Ortiz [email protected]

Dominant language
PHP
Stars
1.2k
Forks
926
Avg merge
1d 10h
Merged PRs (30d)
25

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opnsense/plugins

All issues in opnsense/plugins

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.