2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

40440 Commits

Author SHA1 Message Date
Artem Boldariev
07531d102c TLS: detect ISC_R_SHUTTINGDOWN and ISC_R_CANCELED cases properly
In the previous versions of the NM, detecting the case when worker is
shutting down was not that important and actual status code did not
matter much. However, that might be not the case all the time.

This commit makes necessary modifications to the code.
2023-12-06 15:15:25 +02:00
Artem Boldariev
9a7e30b1ca PROXY over TLS: Fix stream-based DNS transports tests support
This commit fixes the infrastructural code of the stream-based DNS
transports to take PROXY over TLS support into account.
2023-12-06 15:15:25 +02:00
Artem Boldariev
9d7343cd7d DoH: add PROXY over TLS support
This commit extends DNS over HTTP(S) transport with PROXY over TLS
support.
2023-12-06 15:15:25 +02:00
Artem Boldariev
eb52015db1 Stream DNS: add PROXY over TLS support
This commit extends Stream DNS with PROXY over TLS support.
2023-12-06 15:15:25 +02:00
Artem Boldariev
999923c423 Fix TLS Stream in accordance with PROXY Stream over TLS support
This commit makes TLS Stream code to take PROXY Stream over TLS
support into account.
2023-12-06 15:15:24 +02:00
Artem Boldariev
e5852bea1c Fix common netmgr unit testing code for PROXY Stream over TLS
This commit fixes common netmgr unit testing code to take PROXY Stream
over TLS support into account.
2023-12-06 15:15:24 +02:00
Artem Boldariev
3d1b6c48ab Add PROXY over TLS support to PROXY Stream
This commit makes it possible to use PROXY Stream not only over TCP,
but also over TLS. That is, now PROXY Stream can work in two modes as
far as TLS is involved:

1. PROXY over (plain) TCP - PROXYv2 headers are sent unencrypted before
TLS handshake messages. That is the main mode as described in the
PROXY protocol specification (as it is clearly stated there), and most
of the software expects PROXYv2 support to be implemented that
way (e.g. HAProxy);

2. PROXY over (encrypted) TLS - PROXYv2 headers are sent after the TLS
handshake has happened. For example, this mode is being used (only ?)
by "dnsdist". As far as I can see, that is, in fact, a deviation from
the spec, but I can certainly see how PROXYv2 could end up being
implemented this way elsewhere.
2023-12-06 15:15:24 +02:00
Artem Boldariev
fee8b0d8d5 Add PROXYv2 related checks to DNS over HTTP(S) unit test suite
This commit extends DNS over HTTP(S) unit test suite with PROXYv2
related checks to ensure that the transport is compatible with that
mode.
2023-12-06 15:15:24 +02:00
Artem Boldariev
eccc3fe0a0 Add PROXYv2 support to DNS over HTTP(S) transport
This commit extends DNS over HTTP(S) transport with PROXYv2 support.
2023-12-06 15:15:24 +02:00
Artem Boldariev
d199265e95 Add PROXYv2 related tests for TLS DNS transport
This commit adds a set of PROXYv2 related tests to ensure that Stream
DNS over TLS supports this mode.
2023-12-06 15:15:24 +02:00
Artem Boldariev
96ba4d2a9a Add PROXYv2 related tests for TCP DNS transport
This commit adds a set of PROXYv2 related tests to ensure that Stream
DNS over TCP supports this mode.
2023-12-06 15:15:24 +02:00
Artem Boldariev
e97903ca14 Add PROXY support to Stream DNS
This commit makes it possible to use Stream DNS on top of PROXY Stream
either directly or indirectly (in the case when TLS is involved).
2023-12-06 15:15:24 +02:00
Artem Boldariev
2020dce326 Extend TLS Stream unit suite with PROXYv2 related tests
This commit adds a set of tests which help to verify that TLS Stream
works as expected on top of PROXY Stream.
2023-12-06 15:15:24 +02:00
Artem Boldariev
4437096ba0 Make it possible to use TLS Stream on top of PROXY Stream
This commit modifies TLS Stream to make it possible to use over PROXY
Stream. That is required to add PROVYv2 support into TLS-based
transports (DNS over HTTP, DNS over TLS).
2023-12-06 15:15:24 +02:00
Artem Boldariev
4330014fce PROXY Stream: add unit test suite
This commit adds a specialised test suite for the PROXY Stream
transport by reusing most of the testing code from other unit tests
for other stream-based transports.
2023-12-06 15:15:24 +02:00
Artem Boldariev
d119d666b3 PROXY Stream transport
This commit adds a new stream-based transport with an interface
compatible with TCP. The transport is built on top of TCP transport
and the new PROXYv2 handling code. Despite being built on top of TCP,
it can be easily extended to work on top of any TCP-like stream-based
transport. The intention of having this transport is to add PROXYv2
support into all existing stream-based DNS transport (DNS over TCP,
DNS over TLS, DNS over HTTP) by making the work on top of this new
transport.

The idea behind the transport is simple after accepting the connection
or connecting to a remote server it enters PROXYv2 handling mode: that
is, it either attempts to read (when accepting the connection) or send
(when establishing a connection) a PROXYv2 header. After that it works
like a mere wrapper on top of the underlying stream-based
transport (TCP).
2023-12-06 15:15:24 +02:00
Artem Boldariev
7d9a8ddc00 Add PROXY header handling unit test suite
The commit adds a fairly comprehensive unit test suite for our new
PROXYv2 handling code. The unit tests suite ensures both the
correctness of the code and ensures that the part responsible for
handling incoming headers is very strict regarding what to accept as
valid.
2023-12-06 15:15:24 +02:00
Artem Boldariev
2c76717881 Add PROXYv2 header utilities
This commit adds a set of utilities for dealing with PROXYv2 headers,
both parsing and generating them. The code has no dependencies from
the networking code and is (for the most part) a "separate library".

The part responsible for handling incoming PROXYv2 headers is
structured as a state machine which accepts data as input and calls a
callback to notify the upper-level code about the data processing
status.

Such a design, among other things, makes it easy to write a thorough
unit test suite for that, as there are fewer dependencies as well as
will not stand in the way of any changes in the networking code.
2023-12-06 15:15:24 +02:00
Matthijs Mekking
2653e668e3 Merge branch '4476-fix-cid-469729' into 'main'
CID 469729: Remove leftover return call

Closes #4476

See merge request isc-projects/bind9!8547
2023-12-06 12:51:24 +00:00
Matthijs Mekking
d08f293f11 CID 469729: Remove leftover return call
This 'return (ret);' call can never be reached and should have been
removed as part of commit 75e0d394dd2147a0b07524521c084a71801e4eee.
2023-12-06 10:51:15 +01:00
Michal Nowak
c4fcdbefc5 Merge branch 'mnowak/drop-openbsd-system-test-job' into 'main'
Drop OpenBSD system test CI job

See merge request isc-projects/bind9!8535
2023-12-05 15:21:57 +00:00
Michal Nowak
27d51d6ab6
Run "make check" in system:gcc:sid:amd64
Following the discontinuation of the OpenBSD system test in CI, transfer
the execution of the system test using the "make check" method to the
Debian "sid" system test CI job.
2023-12-05 16:14:31 +01:00
Michal Nowak
2ab292c169
Drop OpenBSD system test CI job
The system tests on OpenBSD consistently exhibit lower stability
compared to our other CI platforms. Some of these challenges are
intrinsic to the system test itself and require attention. However,
there are OpenBSD issues, which seem to be more widespread on this
platform than others. In our daily CI pipelines, OpenBSD system tests
often bear the brunt of all failed CI jobs.

It's possible that our OpenBSD CI image could be optimized, but we
currently lack the domain-specific knowledge needed to make
improvements.
2023-12-05 16:14:31 +01:00
Matthijs Mekking
e67bbe5c9a Merge branch '4363-lower-max-nsec3-iterations' into 'main'
Lower NSEC3 iteration limit to 50

Closes #4363

See merge request isc-projects/bind9!8515
2023-12-05 14:59:48 +00:00
Matthijs Mekking
a759f7f33c Change max NSEC3 iterations in unit tests to 50
The nsec3 unit test needs to be adjusted to accept a lower maximum value
for NSEC3 iterations.
2023-12-05 14:58:58 +00:00
Matthijs Mekking
294943ba7c Add release note and CHANGES for #4363
This protocol change is definitely worth mentioning.
2023-12-05 14:58:58 +00:00
Matthijs Mekking
abdaa77303 Change max NSEC3 iterations in system tests to 50
The dnssec and nsupdate system tests need to be adjusted to accept
a lower maximum value for NSEC3 iterations.
2023-12-05 14:58:58 +00:00
Matthijs Mekking
ff4201e388 Lower the maximum allowed NSEC3 iterations to 50
BIND 9 will now treat the response as insecure when processing NSEC3
records with iterations larger than 50.

Earlier, we limited the number of iterations to 150 (in #2445).

RFC 9276 says: Because there has been a large growth of open (public)
DNSSEC validating resolvers that are subject to compute resource
constraints when handling requests from anonymous clients, this
document recommends that validating resolvers reduce their iteration
count limits over time. Specifically, validating resolver operators and
validating resolver software implementers are encouraged to continue
evaluating NSEC3 iteration count deployment trends and lower their
acceptable iteration limits over time.

After evaluation, we decided that the next major BIND release should
lower the maximum allowed NSEC3 iterations to 50, which should be
fine for 99,87% of the domain names.
2023-12-05 14:58:58 +00:00
Matthijs Mekking
3c08fbc79f Change NSEC3 iterations to 0 in system tests
The system tests need to be updated because non-zero iterations are no
longer accepted.

The autosign system test changes its iterations from 1 to 0 in one
test case. This requires the hash to be updated.

The checkconf system test needs to change the iterations in the good
configuration files to 0, and in the bad ones to 1 (any non-zero value
would suffice, but we test the corner case here). Also, the expected
failure message is change, so needs to be adjusted.

The nsec3 system test also needs iteration configuration adjustments.
In addition, the test script no longer needs the ITERATIONS environment
variable.

In the process of updating the system tests, I noticed an error
in the dnssec-policy "nsec3-other", where the salt length in one
configuration file is different than in the other (they need to be
the same). Furthermore, the 'rndc signing -nsec3param' test case
is operated on the zone 'nsec-change.kasp', so is moved so that the
tests on the same zone are grouped together.
2023-12-05 14:58:58 +00:00
Matthijs Mekking
75e0d394dd dnssec-policy: refuse to load non-zero iterations
According to RFC 9276, if NSEC3 must be used, then an iterations count
of 0 MUST be used to alleviate computational burdens.
2023-12-05 14:58:58 +00:00
Tom Krizek
336d99f121 Merge branch '4452-pytest-improve-assert-messages' into 'main'
Improve assert messages in pytests

Closes #4452

See merge request isc-projects/bind9!8518
2023-12-05 13:00:07 +00:00
Tom Krizek
5de2b07daa
Refactor statschannel test to use isctest
Use common utility functions in favor of duplicating the code in a
test-specific file.
2023-12-05 13:26:49 +01:00
Tom Krizek
cba5a1d62c
Add system test utility package isctest
Create a utility package for code shared by the python tests. The
utility functions should use reasonable defaults and be split up into
modules according to their functionality.

Ensure assert rewriting is enabled for the modules to get the most
useful output from pytest.
2023-12-05 13:26:49 +01:00
Tom Krizek
f0481c8600
Simplify statsport fixture in statschannel test
The ports fixture provides the required port numbers already and there's
no need to get the port number from environment.
2023-12-05 13:26:49 +01:00
Tom Krizek
a57af8163a
Allow assertion message rewrite in statschannel test
By default, the useful assertion message rewrite is used by pytest for
test modules only. Since another module is imported with shared
functionality, ensure it has pytest's assertion message rewriting
enabled to obtain more debug information in case it fails.
2023-12-05 13:26:49 +01:00
Tom Krizek
fc295b2b5d
Move helper functions in statchannel into single file
Since dnspython is now a required dependency, there's no need to keep
these two helper files separate.
2023-12-05 13:26:49 +01:00
Tom Krizek
767f4670c6
Add assert message to test doth/stress_http_quota.py
This file is executed outside of pytest with pure python, which doesn't
do any AssertionError message rewriting like pytest. Ensure the assert
messages in this file provide a useful debug message.
2023-12-05 13:26:43 +01:00
Mark Andrews
64ef6968f3 Merge branch '4462-crash-on-shutdown-when-dnssec-validation-is-running-ensure-isc_mempool_getallocated-namepoolp' into 'main'
Resolve "Crash on shutdown when DNSSEC validation is running: ENSURE(isc_mempool_getallocated(*namepoolp) == 0) failed"

Closes #4462 and #4384

See merge request isc-projects/bind9!8526
2023-12-04 22:55:50 +00:00
Mark Andrews
7ee20d7d10 Destroy the message before detaching the view
With shared name memory pools (f5af981831ea8a707090c1b09a47c25b75d86b5a)
the message needs to be destroyed before the view is detached which
in turn detaches the resolver which checks that all resources have
been returned.
2023-12-04 22:00:25 +00:00
Mark Andrews
f491845f5a Merge branch '4457-dig-crashes-after-sigint-if-there-are-multiple-queries' into 'main'
Resolve "dig crashes after SIGINT if there are multiple queries"

Closes #4457

See merge request isc-projects/bind9!8527
2023-12-04 21:10:00 +00:00
Mark Andrews
da8a269daf Add CHANGES note for [GL #4457] 2023-12-05 07:31:19 +11:00
Mark Andrews
69f7048c89 Handle ISC_R_SHUTTINGDOWN in dighost.c:recv_done
When dighost.c:recv_done is called with ISC_R_SHUTTINGDOWN cancel
all outstanding lookups as this indicates SIGTERM was recieved.
2023-12-05 07:30:52 +11:00
Michal Nowak
c21fbed5d4 Merge branch '3198-add-rr-record' into 'main'
Add support for recording named with rr

Closes #3198

See merge request isc-projects/bind9!8479
2023-12-04 18:53:07 +00:00
Michał Kępień
422286e9c2
Do not daemonize named instances with custom args
This enables the "logfileconfig" and "rpzextra" system tests to pass
when named is started under the supervision of rr (USE_RR=1).
2023-12-04 18:40:52 +01:00
Michal Nowak
920af590d1
Fix process listing string of rpzextra ns3 server 2023-12-04 18:39:28 +01:00
Michal Nowak
e088e8a992
Add support for recording named runtime with rr
The traces of the named process are stored in the directory
$system_test/nsX/named-Y/.
2023-12-04 18:38:29 +01:00
Ondřej Surý
658d62a6f4
Remove support for running system tests under Valgrind
Valgrind support has been scarcely used.
2023-12-04 18:27:51 +01:00
Michal Nowak
d05c2e7ff4 Merge branch 'mnowak/freebsd-14.0' into 'main'
Add FreeBSD 14.0

See merge request isc-projects/bind9!8520
2023-12-04 15:26:56 +00:00
Michal Nowak
9152fc40a8
Add FreeBSD 14.0 2023-12-04 15:42:24 +01:00
Arаm Sаrgsyаn
acf55e125e Merge branch '1229-dig-no-yaml-output-when-host-is-unreachable' into 'main'
Resolve "No YAML output in dig when host is unreachable"

Closes #1229

See merge request isc-projects/bind9!8501
2023-12-04 10:38:46 +00:00