Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pdnsutil] Heed default-soa-edit in create-zone #15197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ This value is used when a zone is created without providing a SOA record. @ is r

Use this soa-edit value for all zones if no
:ref:`metadata-soa-edit` metadata value is set.
This value is also used by :doc:`pdnsutil create-zone <manpages/pdnsutil.1>`
unless :ref:`setting-default-soa-content` contains a non-zero serial number.

.. _setting-default-soa-edit-signed:

Expand Down
3 changes: 3 additions & 0 deletions docs/upgrading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ A few changes of behaviour have been implemented in :doc:`pdnsutil <pdnsutil>`.

* The ``add-zone-key`` command used to default to creating a ZSK,
if no key type was given. This default has changed to KSK.
* The ``create-zone`` command will now apply the :ref:`setting-default-soa-edit`
recipe to compute the serial number of the zone, unless the serial number
found in :ref:`setting-default-soa-content` is a non-zero value.

4.8.0 to 4.9.0
--------------
Expand Down
7 changes: 7 additions & 0 deletions pdns/pdnsutil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,13 @@ static int createZone(const DNSName &zone, const DNSName& nsname) {
return EXIT_FAILURE;
}

// Zone is not secured yet, apply default-soa-edit rule to the serial number,
// unless default-soa-content has provided a nonzero value.
if (sd.serial == 0) {
string edit_kind = ::arg()["default-soa-edit"];
sd.serial = calculateEditSOA(sd.serial, edit_kind, zone);
}

rr.content = makeSOAContent(sd)->getZoneRepresentation(true);

cerr<<"Creating empty zone '"<<zone<<"'"<<endl;
Expand Down