Bug 1315821 - rndc addzone/delzone unusable due to RPM packaging or missing BIND configuration option
rndc addzone/delzone unusable due to RPM packaging or missing BIND configurat...
Status: ON_QA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: bind (Show other bugs)
All Linux
high Severity high
: rc
: ---
Assigned To: Petr Menšík
: TestOnly
: 1572374 (view as bug list)
Depends On: named_writable_home 1572647
Blocks: 1298243 1420851 1477664 1534569 1549614 1380362 1393869 1465887 1465928
  Show dependency treegraph
Reported: 2016-03-08 12:17 EST by Robert Scheck
Modified: 2018-06-15 10:37 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
bind9.9 new-zones-directory patch (7.61 KB, patch)
2017-03-10 12:15 EST, Petr Menšík
no flags Details | Diff
bind 9.9. new-zones-directory patch with legacy (15.36 KB, patch)
2017-03-22 08:06 EDT, Petr Menšík
no flags Details | Diff
new-zones-directory patch (22.80 KB, patch)
2017-10-05 12:12 EDT, Petr Menšík
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3425391 None None None 2018-04-27 05:19 EDT

  None (edit)
Description Robert Scheck 2016-03-08 12:17:55 EST
Description of problem:
Running "rndc addzone" or "rndc delzone" is unusable due to RPM packaging
or due to a missing BIND configuration option:

According to https://ftp.isc.org/isc/bind/9.8.0-P4/doc/arm/Bv9ARM.ch03.html,
"rndc addzone" generates a configuration file named /var/named/hash.nzf, but
the directory can't be configured. The RPM packaging is, that /var/named is
not writable for named - and the directory to be used for this NZF option
does not seem to be configurable in BIND.

Touching the (predictable) filename with proper permissions helps to add a
new zone, however not while removing it again, thus it is not acceptable as
a workaround to create the file itself with proper permissions, but these
need to be correct on the parent level. Given the default /var/named might
be a bad place, this maybe should get a configuration option?

Version-Release number of selected component (if applicable):

How reproducible:
Everytime, see above and below.

Steps to Reproduce:
1. Install BIND via yum as usual, keep everything on defaults
2. setsebool named_write_master_zones=1
3. Ensure "allow-new-zones" option to be set to "yes"
4. Run "rndc addzone example.com '{ type master; file "example.com.db"; };'"
5. Get the error that the NZF file can't be written

Actual results:
Running rndc addzone/delzone unusable due to RPM packaging or missing BIND
configuration option.

Expected results:
Running rndc addzone/delzone working as expected :)
Comment 1 Robert Scheck 2016-03-08 12:19:56 EST
Cross-filed case 01597035 on the Red Hat customer portal.
Comment 2 Robert Scheck 2016-03-08 12:23:00 EST
Just to clarify: The issue is not the zonefile itself, but the NZF file that
is managed by addzone/delzone.
Comment 4 Tomáš Hozza 2016-04-05 04:57:40 EDT

Thank you for reporting this bug. The fact that /var/named/ is not writable by default by named group is intentional. The reason is to restrict write access only to root and in case the administrator wants to make it writable also to named group, they have to make a conscious decision. You can argue that there is the SELinux variable you have to set. While this is true, Not everybody uses SELinux and therefore the filesystem permissions are used as a general way do restrict the write access only to root.

Some old references on why it is so:

In case you find the documentation provided by Red Hat incomplete I can extend it to discuss also this situation. However I don't consider the current state a Bug, since it is intentional. Also for the reasons described above I'm reluctant to changing the permissions to writable by named group.

Please note that the default configuration shipped by Red Hat configures BIND as a local validating recursive resolver, not as an authoritative server.

So as a first step I thing we can provide better documentation on what needs to be changed for this use case.

As a second step I'll contact upstream and see if they would be willing to have a configuration option for specifying where are the .nzf files created. However this will be considered a Feature request. I'm also not sure if upstream will accept such change.
Comment 5 Robert Scheck 2016-04-05 05:03:13 EDT
Thomas, thanks for your verbose reply. I agree that /var/named/ should be not
writable by default and a configuration option would be better. The raised
issue is not a documentation one. I understand that the default configuration
as shipped with RHEL is different from the usecase, but given it's a BIND, it 
simply can be configured to act as authoritative server. Martin Osvald already 
spent some time with this - no matter if he was in touch with you or not. If
not, please get in touch with him first to avoid double efforts for the same.
Comment 6 Tomáš Hozza 2016-04-05 05:54:28 EDT
Thanks for the reply Robert.

Martin, co you have some draft of the patch? In the customer case I saw that you are working on something.

Thank you in advance.
Comment 10 Robert Scheck 2016-11-09 11:35:16 EST
I am aware about the current ticket status, but I wonder about the patch that
was mentioned, I'm also happy to test something or similar (note, this is just
about technical stuff, not organisational).
Comment 15 Petr Menšík 2017-03-10 12:15 EST
Created attachment 1262015 [details]
bind9.9 new-zones-directory patch

Prepared patch to add new-zones-directory. Reported to ISC as [ISC-Bugs #44853]
Comment 19 Petr Menšík 2017-03-22 08:06 EDT
Created attachment 1265360 [details]
bind 9.9. new-zones-directory patch with legacy

Modified patch that will use files in default directory if they do not exist in new-zones-directory. That should simplify upgrade of default configuration significantly. Provides also basic unit test.
Comment 21 Robert Scheck 2017-04-11 13:43:27 EDT
I got bind-9.9.4-38.el7_3.3.test.x86_64 via GSS for testing. Not sure if
that package contains the latest version of the patch, but after adding

  allow-new-zones yes;

to /etc/named.conf, any restart of BIND (without any zone created etc.)
leads to this (new) log entry:

  Apr 11 19:39:25 tux named[1287]: open: 3bf305731dd26307.nzf: file not found

Further, once I add

  new-zones-directory "/var/named/dynamic";

additionally to /etc/named.conf, any restart of BIND (without any zone created 
etc.) leads to this (new) log entry:

  Apr 11 19:37:18 tux named[1258]: open: ↲
  /var/named/dynamic/3bf305731dd26307.nzf: file not found

Not sure if this is really intended.

Aside from this, "rndc addzone" and "rndc delzone" seems to work as expected.
Comment 25 Petr Menšík 2017-10-04 16:50:56 EDT
Hello, I am sorry for late reply. new-zones-directory was merged upstream in bug https://bugs.isc.org/Public/Bug/Display.html?id=44853

I backported sligtly different version to match upstream more closely.

However logged errors are still present also in latest bind, reported as bug [ISC-Bugs #46186].
Comment 26 Petr Menšík 2017-10-05 12:12 EDT
Created attachment 1334898 [details]
new-zones-directory patch

Upstream version of patch, corrects also logging of errors when allow-new-zones is set to yes, but nzf files are not yet created.
Comment 30 Robert Scheck 2018-02-25 12:06:40 EST
Petr, given [ISC-Bugs #46186] is not public, can you please report here
whether it is resolved or not? If not, could you create a public clone at
gitlab.isc.org, please? Thanks :)
Comment 32 Petr Menšík 2018-04-27 05:19:57 EDT
*** Bug 1572374 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.