Commit graph

35932 commits

Author SHA1 Message Date
Matthijs Mekking
a7aedd5bca Minor fixes in kasp system test
Fix two typos and two grep calls.

(cherry picked from commit 2b34b326fc)
2022-04-29 13:57:26 +02:00
Petr Špaček
f8737d2a1a Merge branch 'feature/main/default-config-print-v9_18' into 'v9_18'
Export built-in default configuration for named binary [v9_18]

See merge request isc-projects/bind9!6233
2022-04-29 08:49:42 +00:00
Petr Menšík
1c04a88a1e
Export built-in default configuration for named binary
It might be useful to display built-in configuration with all its
values. It should make it easier to test what default values has changed
in a new release.

Related: #1326
(cherry picked from commit cf722d18b3)
2022-04-29 10:33:31 +02:00
Mark Andrews
d8146be859 Merge branch 'bug/main/new-zones-dir-null-v9_18' into 'v9_18'
Don't test new-zones-directory argument validity

See merge request isc-projects/bind9!6230
2022-04-29 02:06:12 +00:00
Petr Menšík
02f80b4c75 Additional safety check for negative array index
inet_ntop result should always protect against empty string accepted
without an error. Make additional check to satisfy coverity scans.

(cherry picked from commit 656a0f076f)
2022-04-29 11:46:22 +10:00
Petr Menšík
2cdebaf702 Initialize printed buffer
- var_decl: Declaring variable "tbuf" without initializer
- assign: Assigning: "target.base" = "tbuf", which points to
  uninitialized data
- assign: Assigning: "r.base" = "target.base", which points to
  uninitialized data

I expect it would correctly initialize length always. Add simple
initialization to silent coverity.

(cherry picked from commit 59132bd3ec)
2022-04-29 11:46:22 +10:00
Petr Menšík
ca952e22ff Ensure diff variable is not read uninitialized
Coverity detected issues:
- var_decl: Declaring variable "diff" without initializer.
- uninit_use_in_call: Using uninitialized value "diff.tuples.head" when
  calling "dns_diff_clear".

(cherry picked from commit 67e773c93c)
2022-04-29 11:46:22 +10:00
Petr Menšík
5e635d4c84 Don't test new-zones-directory argument validity
Parser ensures new-zones-directory has qstring parameter before it can
reach this place. dir == NULL then should never happen on any
configuration. Replace silent check with insist.

(cherry picked from commit 0a7d04367a)
2022-04-29 11:46:22 +10:00
Mark Andrews
f1f94d1159 Merge branch '3306-undefined-macros-in-contrib-dlz-modules-wildcard-dlz_wildcard_dynamic-c-v9_18' into 'v9_18'
Define local instances of FALLTHROUGH and UNREACHABLE

See merge request isc-projects/bind9!6228
2022-04-29 01:13:57 +00:00
Mark Andrews
ac5f018d8f Add CHANGES note for [GL #3306]
(cherry picked from commit c57363fb7d)
2022-04-29 10:53:40 +10:00
Mark Andrews
9ced9a6202 Define local instances of FALLTHROUGH and UNREACHABLE
FALLTHOUGH is a copy of how it is defined in <isc/util.h>

UNREACHABLE follows the model used in MacOS /usr/include/c++/v1/cstdlib
to determine if __builtin_ureachable is available

(cherry picked from commit 6d68a22954)
2022-04-29 10:53:12 +10:00
Arаm Sаrgsyаn
3e74a046db Merge branch '3225-catz-member-zone-reset-v9_18' into 'v9_18'
[v9_18] [5/5] Document catalog zones member zone reset by change of unique label

See merge request isc-projects/bind9!6224
2022-04-28 16:58:47 +00:00
Aram Sargsyan
e3839fc3e8 Document catalog zones member zone reset by change of unique label
The DNS catalog zones draft version 5 document requires that catalog
zones consumers must reset the member zone's internal zone state when
its unique label changes (either within the same catalog zone or
during change of ownership performed using the "coo" property).

BIND already behaves like that, and, in fact, doesn't support keeping
the zone state during change of ownership even if the unique label
has been kept the same, because BIND always removes the member zone
and adds it back during unique label renaming or change of ownership.

Document the described behavior and add a log message to inform when
unique label renaming occurs.

Add a system test case with unique label renaming.

(cherry picked from commit 2f2e02ff0c)
2022-04-28 16:10:23 +00:00
Ondřej Surý
982103594c Merge branch '2813-build-named-with-dlz-is-broken-with-MariaDB-10-v9_18' into 'v9_18'
Use MARIADB_BASE_VERSION instead of LIBMARIADB to detect Maria DB [v9.18]

See merge request isc-projects/bind9!6225
2022-04-28 16:06:20 +00:00
Ondřej Surý
cf4e08d9cb Use MARIADB_BASE_VERSION instead of LIBMARIADB to detect Maria DB
It was discovered that MariaDB 10 didn't define LIBMARIADB leading
to compilation errors of MySQL DLZ modules on Debian stretch.

Use MARIADB_BASE_VERSION instead which is defined in all tested MariaDB
versions.

(cherry picked from commit 5835aae694)
2022-04-28 18:05:17 +02:00
Arаm Sаrgsyаn
d04fb79f1f Merge branch '3224-catz-broken-catalog-zones-concept-support-v9_18' into 'v9_18'
[v9_18] [4/5] Introduce the concept of broken catalog zones

See merge request isc-projects/bind9!6214
2022-04-28 13:22:44 +00:00
Aram Sargsyan
2dac9b119a Remove reduntant checks of 'rdclass' in catz.c
We check the `rdclass` to be of type IN in `dns_catz_update_process()`
function, and all the other static functions where similar checks exist
are called after (and in the result of) that function being called,
so they are effectively redundant.

(cherry picked from commit 84d3aba4f3)
2022-04-28 12:49:30 +00:00
Aram Sargsyan
a8f9d4e418 Add new catz system test to check a version property with invalid type
There is already a check for the missing version property case
(catalog-bad1.example), and this new test should result in the same
outcome, but differs in a way that there exists a version record in the
zone, but it is of a wrong type (A instead of the expected TXT).

(cherry picked from commit 5bfe655835)
2022-04-28 12:49:24 +00:00
Aram Sargsyan
7dc8b2f79b Add a system test to check catalog zones with non-IN rdata class fail
According to DNS catalog zones draft version 5 document, the CLASS field
of every RR in a catalog zone MUST be IN.

Add a new check in the catz system test to verify that a non-IN class
catalog zone (in this case CH) fails to load.

BIND does not support having a non-IN class RR in an IN class zone, or
non-IN class zone in an IN class view, so to verify that BIND respects
the mentioned restriction we must try to add a non-IN class catalog
zone and check that it didn't succeed.

The `named` configuration files had to be restructured to put all the
zones inside views, which also resulted in some corresponding changes
in the tests.sh script.

(cherry picked from commit 247ae534a0)
2022-04-28 12:49:17 +00:00
Aram Sargsyan
951d582593 Add a new warning message when processing view configuration
When parsing the configuration file, log a warning message in
configure_view() function when encountering a `catalog-zones`
option in a view with non-IN rdata class.

(cherry picked from commit dfd5a01eba)
2022-04-28 12:49:08 +00:00
Aram Sargsyan
f0bb090afe Add CHANGES note for [GL #3224]
(cherry picked from commit 92d1e1e347)
2022-04-28 12:48:51 +00:00
Aram Sargsyan
6539f73e3a Introduce the concept of broken catalog zones
The DNS catalog zones draft version 5 document describes various
situations when a catalog zones must be considered as "broken" and
not be processed.

Implement those checks in catz.c and add corresponding system tests.

(cherry picked from commit a8228d5f19)
2022-04-28 12:48:41 +00:00
Artem Boldariev
9a11c7a570 Merge branch 'artem-strict-tls-backport-v9_18' into 'v9_18'
Add remote TLS certificate verification support, implement Strict and Mutual TLS authentication in BIND and dig (backport to v9.18)

See merge request isc-projects/bind9!6210
2022-04-28 11:02:32 +00:00
Artem Boldariev
02208acbb5 Dig: do not hang on TLS context creation errors
There was a query_detach() call missing in dig, which could lead to
dig hanging on TLS context creation errors. This commit fixes.

The error was introduced because the Strict TLS implementation was
initially made over an older version of the code, where this extra
query_detach() call was not needed.
2022-04-28 13:39:22 +03:00
Artem Boldariev
4637b72da6 Change X509_STORE_up_ref() shim return value
X509_STORE_up_ref() must return 1 on success, while the previous
implementation would return the references count. This commit fixes
that.
2022-04-28 13:39:22 +03:00
Artem Boldariev
26feac0c61 Implement shim for SSL_CTX_set1_cert_store() (affects Debian 9)
This commit implements a shim for SSL_CTX_set1_cert_store() for
OpenSSL/LibreSSL versions where it is not available.
2022-04-28 13:39:22 +03:00
Artem Boldariev
a86575034c Mention TLS certs verification in the CHANGES and Release Notes
This commit adds points to the CHANGES and the release notes about
supporting remote TLS certificates verification and support for Strict
and Mutual TLS transport connections verification.
2022-04-28 13:39:21 +03:00
Artem Boldariev
8c9532f8cf Update the "Known Issues"
Mention that some old cryptographic library versions lack the
functionality to implement ignoring the Subject field (and thus the
Common Name) when establishing DoT connections.
2022-04-28 13:39:21 +03:00
Artem Boldariev
337943c047 Extend the 'doth' system test with Strict/Mutual TLS checks
This commit extends the 'doth' system test with a set of Strict/Mutual
TLS related checks.

This commit also makes each doth NS instance use its own TLS
certificate that includes FQDN, IPv4, and IPv6 addresses, issued using
a common Certificate Authority, instead of ad-hoc certs.

Extend servers initialisation timeout to 60 seconds to improve the
tests stability in the CI as certain configurations could fail to
initialise on time under load.
2022-04-28 13:39:21 +03:00
Artem Boldariev
d03b4026d5 Add missing plain HTTP options to dig's help output
A couple of dig options were missing in the help output, while been
properly documented and supported. This commit fixes this overlook.
2022-04-28 13:39:21 +03:00
Artem Boldariev
2b3b8f354b Document supported TLS authentication modes
This commit updates the reference manual with short descriptions of
different TLS authentication modes, as mentioned in the RFC 9103,
Section 9.3 (Opportunistic TLS, Strict TLS, Mutual TLS), and mentions
how these authentication modes can be achieved via BIND's
configuration file.
2022-04-28 13:39:21 +03:00
Artem Boldariev
6c05fb09c3 Add support for Strict/Mutual TLS into BIND
This commit adds support for Strict/Mutual TLS into BIND. It does so
by implementing the backing code for 'hostname' and 'ca-file' options
of the 'tls' statement. The commit also updates the documentation
accordingly.
2022-04-28 13:39:21 +03:00
Artem Boldariev
05091f0095 Restore disabled unused 'tls' options: 'ca-file' and 'hostname'
This commit restores the 'tls' options disabled in
78b73d0865.
2022-04-28 13:39:21 +03:00
Artem Boldariev
1f60b32a51 Add support for Strict/Mutual TLS to dig
This commit adds support for Strict/Mutual TLS to dig.

The new command-line options and their behaviour are modelled after
kdig (+tls-ca, +tls-hostname, +tls-certfile, +tls-keyfile) for
compatibility reasons. That is, using +tls-* is sufficient to enable
DoT in dig, implying +tls-ca

If there is no other DNS transport specified via command-line,
specifying any of +tls-* options makes dig use DoT. In this case, its
behaviour is the same as if +tls-ca is specified: that is, the remote
peer's certificate is verified using the platform-specific
intermediate CA certificates store. This behaviour is introduced for
compatibility with kdig.
2022-04-28 13:39:21 +03:00
Artem Boldariev
9b0eb3e5a3 Add ISC_R_TLSBADPEERCERT error code to the TLS related code
This commit adds support for ISC_R_TLSBADPEERCERT error code, which is
supposed to be used to signal for TLS peer certificates verification
in dig and other code.

The support for this error code is added to our TLS and TLS DNS
implementations.

This commit also adds isc_nm_verify_tls_peer_result_string() function
which is supposed to be used to get a textual description of the
reason for getting a ISC_R_TLSBADPEERCERT error.
2022-04-28 13:39:21 +03:00
Artem Boldariev
e2a3ec2ba5 Extend TLS context cache with CA certificates store
This commit adds support for keeping CA certificates stores associated
with TLS contexts. The intention is to keep one reusable store per a
set of related TLS contexts.
2022-04-28 13:39:21 +03:00
Artem Boldariev
6fdc03102a Add foundational functions to implement Strict/Mutual TLS
This commit adds a set of functions that can be used to implement
Strict and Mutual TLS:

* isc_tlsctx_load_client_ca_names();
* isc_tlsctx_load_certificate();
* isc_tls_verify_peer_result_string();
* isc_tlsctx_enable_peer_verification().
2022-04-28 13:39:21 +03:00
Artem Boldariev
b975ee7be4 Add utility functions to manipulate X509 certificate stores
This commit adds a set of high-level utility functions to manipulate
the certificate stores. The stores are needed to implement TLS
certificates verification efficiently.
2022-04-28 13:39:21 +03:00
Matthijs Mekking
cfcbdb6712 Merge branch '2267-extended-errors-stale-data-v9_18' into 'v9_18'
[v9_18] Add stale answer extended errors

See merge request isc-projects/bind9!6209
2022-04-28 09:56:59 +00:00
Matthijs Mekking
7ad1603ac3 Add CHANGES and release notes for #2267
(cherry picked from commit a320f4ed04)
2022-04-28 11:21:28 +02:00
Matthijs Mekking
125603a543 Add stale answer extended errors
Add DNS extended errors 3 (Stale Answer) and 19 (Stale NXDOMAIN Answer)
to responses. Add extra text with the reason why the stale answer was
returned.

To test, we need to change the configuration such that for the first
set of tests the stale-refresh-time window does not interfer with the
expected extended errors.

(cherry picked from commit c66b9abc0b)
2022-04-28 11:21:22 +02:00
Evan Hunt
44a935cbdc Merge branch '3272-shutdown-deadlock-v9_18' into 'v9_18'
prevent a deadlock in the shutdown system test

See merge request isc-projects/bind9!6207
2022-04-28 06:58:38 +00:00
Evan Hunt
d7c2752d3c CHANGES for [GL #3272]
(cherry picked from commit 6bcf3e5c31)
2022-04-27 23:57:18 -07:00
Evan Hunt
af37c6f60c prevent a deadlock in the shutdown system test
The shutdown test sends 'rdnc status' commands in parallel with
'rndc stop' A new rndc connection arriving will reference the ACL
environment to see whether the client is allowed to connect.
Commit c0995bc380 added a mutex lock to ns_interfacemgr_getaclenv(),
but if the new connection arrives while the interfaces are being
purged during shutdown, that lock is already being held. If the
the connection event slips in ahead of one of the netmgr's "stop
listening" events on a worker thread, a deadlock can occur.

The fix is not to hold the interfacemgr lock while shutting down
interfaces; only while actually traversing the interface list to
identify interfaces needing shutdown.

(cherry picked from commit 5c4cf3fcc4)
2022-04-27 23:56:59 -07:00
Evan Hunt
5c97200cfb Merge branch '2969-refactor-fctx_done-v9_18' into 'v9_18'
refactor fctx_done() to set fctx to NULL

See merge request isc-projects/bind9!6202
2022-04-28 01:19:17 +00:00
Evan Hunt
d3728056db CHANGES for [GL #2969]
(cherry picked from commit f8c0cabca1)
2022-04-27 16:12:55 -07:00
Evan Hunt
9296be2130 refactor resume_dsfetch()
clean up resume_dsfetch() so that the fctx reference counting is
saner and easier to follow.

(cherry picked from commit 7b2ea97e46)
2022-04-27 16:12:55 -07:00
Evan Hunt
759e0b030e refactor validated()
minor changes to ensure that fctx reference counting is clear and correct.

(cherry picked from commit d2f407cca3)
2022-04-27 16:12:55 -07:00
Evan Hunt
50ef4a8cae rename maybe_destroy() to maybe_cancel_validators()
the maybe_destroy() function no longer destroys the fctx,
so rename it and update the comments.

(cherry picked from commit 7c5afebcdc)
2022-04-27 16:12:55 -07:00
Evan Hunt
8a90a62d0f refactor fctx_done() to set fctx to NULL
previously fctx_done() detached the fctx but did not clear the pointer
passed into it from the caller.  in some conditions, when rctx_done()
was reached while waiting for a validator to complete, fctx_done()
could be called twice on the same fetch, causing a double detach.

fctx_done() now clears the fctx pointer, to reduce the chances of
such mistakes.

(cherry picked from commit b4592d02a1)
2022-04-27 16:12:55 -07:00