39487 Commits

Author SHA1 Message Date
Nicki Křížek
6fc161b582 Update BIND version for release v9.18.33 2025-01-20 14:35:25 +01:00
Nicki Křížek
12805f9184 new: doc: Prepare documentation for BIND 9.18.33
Merge branch 'andoni/prepare-documentation-for-bind-9.18.33' into 'v9.18.33-release'

See merge request isc-private/bind9!774
2025-01-20 13:32:58 +00:00
Andoni Duarte Pintado
bee47c986f Tweak and reword release notes 2025-01-18 06:07:18 +01:00
Andoni Duarte Pintado
bcff826fba Fix broken option reference in the ARM 2025-01-18 06:07:18 +01:00
Andoni Duarte Pintado
152684faf7 Prepare release notes for BIND 9.18.33 2025-01-16 16:39:21 +01:00
Andoni Duarte Pintado
d48290afe5 Generate changelog for BIND 9.18.33 2025-01-16 16:38:10 +01:00
Andoni Duarte
e733e62414 [9.18] [CVE-2024-12705] sec: usr: DNS-over-HTTP(s) flooding fixes
Fix DNS-over-HTTP(S) implementation issues that arise under heavy
query load. Optimize resource usage for :iscman:`named` instances
that accept queries over DNS-over-HTTP(S).

Previously, :iscman:`named` would process all incoming HTTP/2 data
at once, which could overwhelm the server, especially when dealing
with clients that send requests but don't wait for responses. That
has been fixed. Now, :iscman:`named` handles HTTP/2 data in smaller
chunks and throttles reading until the remote side reads the
response data. It also throttles clients that send too many requests
at once.

Additionally, :iscman:`named` now carefully processes data sent by
some clients, which can be considered "flooding." It logs these
clients and drops connections from them.
:gl:`#4795`

In some cases, :iscman:`named` could leave DNS-over-HTTP(S)
connections in the `CLOSE_WAIT` state indefinitely. That also has
been fixed. ISC would like to thank JF Billaud for thoroughly
investigating the issue and verifying the fix.
:gl:`#5083`

See https://gitlab.isc.org/isc-projects/bind9/-/issues/4795

Closes https://gitlab.isc.org/isc-projects/bind9/-/issues/5083

Backport of !732.

Merge branch 'artem-improve-doh-resource-usage-9.18' into 'v9.18.33-release'

See merge request isc-private/bind9!763
2025-01-15 16:03:28 +00:00
Artem Boldariev
550b692343 DoH: reduce excessive bad request logging
We started using isc_nm_bad_request() more actively throughout
codebase. In the case of HTTP/2 it can lead to a large count of
useless "Bad Request" messages in the BIND log, as often we attempt to
send such request over effectively finished HTTP/2 sessions.

This commit fixes that.

(cherry picked from commit 937b5f8349)
2025-01-15 16:50:13 +01:00
Artem Boldariev
796708775d DoH: introduce manual read timer control
This commit introduces manual read timer control as used by StreamDNS
and its underlying transports. Before that, DoH code would rely on the
timer control provided by TCP, which would reset the timer any time
some data arrived. Now, the timer is restarted only when a full DNS
message is processed in line with other DNS transports.

That change is required because we should not stop the timer when
reading from the network is paused due to throttling. We need a way to
drop timed-out clients, particularly those who refuse to read the data
we send.

(cherry picked from commit 609a41517b)
2025-01-15 16:49:32 +01:00
Artem Boldariev
ee42514be2 DoH: floodding clients detection
This commit adds logic to make code better protected against clients
that send valid HTTP/2 data that is useless from a DNS server
perspective.

Firstly, it adds logic that protects against clients who send too
little useful (=DNS) data. We achieve that by adding a check that
eventually detects such clients with a nonfavorable useful to
processed data ratio after the initial grace period. The grace period
is limited to processing 128 KiB of data, which should be enough for
sending the largest possible DNS message in a GET request and then
some. This is the main safety belt that would detect even flooding
clients that initially behave well in order to fool the checks server.

Secondly, in addition to the above, we introduce additional checks to
detect outright misbehaving clients earlier:

The code will treat clients that open too many streams (50) without
sending any data for processing as flooding ones; The clients that
managed to send 1.5 KiB of data without opening a single stream or
submitting at least some DNS data will be treated as flooding ones.
Of course, the behaviour described above is nothing else but
heuristical checks, so they can never be perfect. At the same time,
they should be reasonable enough not to drop any valid clients,
realatively easy to implement, and have negligible computational
overhead.

(cherry picked from commit 3425e4b1d0)
2025-01-15 16:49:23 +01:00
Artem Boldariev
11a2956dce DoH: process data chunk by chunk instead of all at once
Initially, our DNS-over-HTTP(S) implementation would try to process as
much incoming data from the network as possible. However, that might
be undesirable as we might create too many streams (each effectively
backed by a ns_client_t object). That is too forgiving as it might
overwhelm the server and trash its memory allocator, causing high CPU
and memory usage.

Instead of doing that, we resort to processing incoming data using a
chunk-by-chunk processing strategy. That is, we split data into small
chunks (currently 256 bytes) and process each of them
asynchronously. However, we can process more than one chunk at
once (up to 4 currently), given that the number of HTTP/2 streams has
not increased while processing a chunk.

That alone is not enough, though. In addition to the above, we should
limit the number of active streams: these streams for which we have
received a request and started processing it (the ones for which a
read callback was called), as it is perfectly fine to have more opened
streams than active ones. In the case we have reached or surpassed the
limit of active streams, we stop reading AND processing the data from
the remote peer. The number of active streams is effectively decreased
only when responses associated with the active streams are sent to the
remote peer.

Overall, this strategy is very similar to the one used for other
stream-based DNS transports like TCP and TLS.

(cherry picked from commit 9846f395ad)
2025-01-15 16:47:21 +01:00
Artem Boldariev
125bfd71d3 Add isc__nm_async_run()
This commit adds isc__nm_async_run() which is very similar to
isc_async_run() in newer versions of BIND: it allows calling a
callback asynchronously.

Potentially, it can be used to replace some other async operations in
other networking code, in particular the delayed I/O calls in TLS a
TCP DNS transports to name a few and remove quiet a lot of code, but
it we are unlikely to do that for the strictly maintenance only
branch, so it is protected with DoH-related #ifdefs.

It is implemented in a "universal" way mainly because doing it in the
specific code requires the same amount of code and is not simpler.
2025-01-15 16:43:47 +01:00
Artem Boldariev
13d521fa5f Implement TLS manual read timer control functionality
This commit adds a manual TLS read timer control mode which is
supposed to override automatic resetting of the timer when any data is
received.

It both depends and complements similar functionality in TCP.
2025-01-15 15:34:43 +00:00
Artem Boldariev
a67b325542 Implement TCP manual read timer control functionality
This commit adds a manual TCP read timer control mode which is
supposed to override automatic resetting of the timer when any data is
received. That can be accomplished by
`isc__nmhandle_set_manual_timer()`.

This functionality is supposed to be used by multilevel networking
transports which require finer grained control over the read
timer (TLS Stream, DoH).

The commit is essentially an implementation of the functionality from
newer versions of BIND.
2025-01-15 15:34:43 +00:00
Andoni Duarte
c6e6a7af8a [9.18] [CVE-2024-11187] sec: usr: Limit the additional processing for large RDATA sets
When answering queries, don't add data to the additional section if the answer has more than 13 names in the RDATA. This limits the number of lookups into the database(s) during a single client query, reducing query processing load.

Backport of MR !750

See isc-projects/bind9#5034

Merge branch '5034-security-limit-additional-9.18' into 'v9.18.33-release'

See merge request isc-private/bind9!759
2025-01-15 13:27:08 +00:00
Ondřej Surý
fa7b7973e3 Limit the additional processing for large RDATA sets
When answering queries, don't add data to the additional section if
the answer has more than 13 names in the RDATA.  This limits the
number of lookups into the database(s) during a single client query,
reducing query processing load.

Also, don't append any additional data to type=ANY queries. The
answer to ANY is already big enough.

(cherry picked from commit a1982cf1bb)
2025-01-15 14:13:45 +01:00
Ondřej Surý
cd48dcb0f8 Isolate using the -T noaa flag only for part of the resolver test
Instead of running the whole resolver/ns4 server with -T noaa flag,
use it only for the part where it is actually needed.  The -T noaa
could interfere with other parts of the test because the answers don't
have the authoritative-answer bit set, and we could have false
positives (or false negatives) in the test because the authoritative
server doesn't follow the DNS protocol for all the tests in the resolver
system test.

(cherry picked from commit e51d4d3b88)
2025-01-15 14:13:17 +01:00
Nicki Křížek
a3fe766fe9 [9.18] new: ci: Add shotgun perf test of DoH GET to CI
Add performance tests of DoH using the GET protocol to nightly pipelines.

Backport of MR !9926

Merge branch 'backport-nicki/ci-shotgun-doh-get-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9940
2025-01-08 14:13:04 +00:00
Nicki Křížek
934b57040f Add shotgun perf test of DoH GET to CI
(cherry picked from commit 32c5f24713)
2025-01-08 13:46:54 +00:00
Arаm Sаrgsyаn
f68e60b3dc fix: dev: Fix a bug in isc_rwlock_trylock()
When isc_rwlock_trylock() fails to get a read lock because another
writer was faster, it should wake up other waiting writers in case
there are no other readers, but the current code forgets about
the currently active writer when evaluating 'cntflag'.

Unset the WRITER_ACTIVE bit in 'cntflag' before checking to see if
there are other readers, otherwise the waiting writers, if they exist,
might not wake up.

Closes #5121

Merge branch 'aram/isc_rwlock_trylock-bugfix-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9937
2025-01-08 10:29:14 +00:00
Aram Sargsyan
73b6d9e9e5 Fix a bug in isc_rwlock_trylock()
When isc_rwlock_trylock() fails to get a read lock because another
writer was faster, it should wake up other waiting writers in case
there are no other readers, but the current code forgets about
the currently active writer when evaluating 'cntflag'.

Unset the WRITER_ACTIVE bit in 'cntflag' before checking to see if
there are other readers, otherwise the waiting writers, if they exist,
might not wake up.
2025-01-07 13:30:26 +00:00
Michal Nowak
333834e764 [9.18] fix: test: Various coccinelle fixes
Backport of MR !9836

Merge branch 'backport-mnowak/cocci-more-set-if-not-null-changes-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9917
2024-12-13 15:34:11 +00:00
Michal Nowak
6db006af23 Drop superfluous isc_mem_get() NULL check
coccinelle v1.1 trips over a superfluous isc_mem_get() NULL check in
tests/libtest/ns.c and reports the following failure in CI:

    EXN: Failure("rule starting on line 26: already tagged token:\nC code context\nFile \"./tests/libtest/ns.c\", line 350, column 1, charpos = 7939\n  around = 'if',\n  whole content = \tif (qctx != NULL) {") in ./tests/libtest/ns.c

(cherry picked from commit cf76851c75)
2024-12-13 14:54:48 +01:00
Andoni Duarte Pintado
1d3f2cf624 Merge tag 'v9.18.32' into bind-9.18 2024-12-13 10:41:07 +01:00
Mark Andrews
fdbefcd64f [9.18] fix: test: Fix "checking startup notify rate limit" failure
Fix the loop terminating condition to get consistent sample sizes and increase the minimum number of samples from 20 to 40.

Closes #5091

Backport of MR !9894

Merge branch 'backport-5091-investigate-checking-startup-notify-rate-limit-failure-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9910
2024-12-13 01:40:04 +00:00
Mark Andrews
9fa4bd1c1b Fix startup notify rate test
The terminating conditions for the startup notify test would
occasionally get ~20 records or get +10 seconds of records due to
a bad terminating condition.  Additionally 20 samples lead to test
failures.  Fix the terminating condition to use the correct conditional
(-eq -> -ge) and increase the minimum number of log entries to
average over to 22.

(cherry picked from commit 46388d07a2)
2024-12-13 12:06:33 +11:00
Mark Andrews
7333218a2c [9.18] fix: test: tests/irs/resconf_test.c is missing check callbacks
Closes #5088

Backport of MR !9884

Merge branch 'backport-5088-tests-irs-resconf_test-c-is-missing-check-callbacks-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9908
2024-12-12 23:58:26 +00:00
Mark Andrews
40c616f303 Check that nameservers are parsed correctly
Add checks that the expected nameservers where actuall addes when
parsing resolv.conf.

(cherry picked from commit c38eb87158)
2024-12-13 10:27:22 +11:00
Nicki Křížek
95a159561f [9.18] chg: doc: Update CONTRIBUTING.md and developer docs
Include the recent changes such as:
- changes to running system tests
- gitlab development workflow
- changelog and release note process

Closes #5045

Backport of MR !9784

Merge branch 'backport-5045-update-contributing-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9903
2024-12-12 17:13:39 +00:00
Nicki Křížek
5db64b5898 Update CONTRIBUTING.md and developer doc
Include the recent changes such as:
- changes to running system tests
- gitlab development workflow
- changelog and release note process

(cherry picked from commit 39485c1f70)
2024-12-12 17:40:50 +01:00
Michal Nowak
41302f8535 [9.18] fix: test: Wait for "all zones loaded" after rndc reload in "database" test
After the rndc reload command finished, we might have queried the
database zone sooner than it was reloaded because rndc reloads zones
asynchronously if no specific zone was provided. We should wait for "all
zones loaded" in the ns1 log to be sure.

Closes #5075

Backport of MR !9829

Merge branch 'backport-5075-database-rndc-reload-ensure-all-zones-loaded-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9901
2024-12-12 12:51:46 +00:00
Michal Nowak
5825e79375 Wait for "all zones loaded" after rndc reload in "database" test
After the rndc reload command finished, we might have queried the
database zone sooner than it was reloaded because rndc reloads zones
asynchronously if no specific zone was provided. We should wait for "all
zones loaded" in the ns1 log to be sure.

(cherry picked from commit 0bdd03db66)
2024-12-12 12:09:35 +00:00
Evan Hunt
3f95283d76 [9.18] fix: nil: update style guideline to reflect current practice
The style guide now mentions clang-format, doesn't parenthesize return values, and no longer calls for backward compatibility in public function names.

Backport of MR !9892

Merge branch 'backport-each-style-update-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9897
2024-12-11 15:53:26 +00:00
Evan Hunt
bd904e8808 update style guideline to reflect current practice
It now mentions clang-format, doesn't parenthesize return values,
and no longer calls for backward compatibility in public function names.

(cherry picked from commit 9f7314eaa4)
2024-12-11 03:40:02 +00:00
Michal Nowak
e28a85fc03 [9.18] fix: test: Add rr-related common test artifacts
Backport of MR !9830

Merge branch 'backport-mnowak/add-rr-related-common-artifacts-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9890
2024-12-10 18:22:55 +00:00
Michal Nowak
ab5309164b Add rr-related common test artifacts
(cherry picked from commit c607237b77)
2024-12-10 18:51:21 +01:00
Michal Nowak
ef5abda0db [9.18] fix: ci: Set cross-version-config-tests to allow_failure in CI
Address failing cross-version-config-tests job.

Closes #5087

Backport of MR !9833

Merge branch 'backport-mnowak/cross-version-config-tests-allow-fail-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9887
2024-12-10 10:22:16 +00:00
Michal Nowak
86db625ffd Set cross-version-config-tests to allow_failure in CI
The December releases suffer from the ns2/managed1.conf file not being
in the mkeys extra_artifacts. This manifests only when pytest is run
with the --setup-only option, which is the case in the
cross-version-config-tests CI job. The original issue is fixed in !9815,
but the fix will be effective only when subsequent releases are out.

(cherry picked from commit 97a9d7287c)
2024-12-10 11:09:58 +01:00
Mark Andrews
3e70fbf69d [9.18] chg: test: Use a different burst name to identify test queries
This allows easier identification of which burst is which in
named.run.

Backport of MR !9881

Merge branch 'backport-marka-use-different-burst-name-for-forensics-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9883
2024-12-10 06:43:23 +00:00
Mark Andrews
2bef516b1c Use a different burst name to identify test queries
This allows easier identification of which burst is which in
named.run.

(cherry picked from commit e02d66b279)
2024-12-10 05:56:28 +00:00
Mark Andrews
2c5db4b038 [9.18] fix: test: Fix static stub subtest description
This subtest exercises static stub behaviour when server-addresses has an address.  This was misidentified in the description.

Closes !9799

Backport of MR !9799

Merge branch 'backport-marka-fix-stub-subtest-description-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9880
2024-12-10 04:36:32 +00:00
Mark Andrews
e7a16f2e6e Fix static stub subtest description
(cherry picked from commit f173a01454)
2024-12-10 03:37:26 +00:00
Mark Andrews
75ae186fa1 [9.18] fix: usr: Unknown directive in resolv.conf not handled properly
The line after an unknown directive in resolv.conf could accidentally be skipped, potentially affecting dig, host, nslookup, nsupdate, or delv. This has been fixed.

Closes #5084

Backport of MR !9865

Merge branch 'backport-5084-plain-unknown-keyword-in-resolv-conf-not-handled-propely-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9878
2024-12-10 03:36:40 +00:00
Mark Andrews
ea43609f45 Extend resconf_test
Update to the new unit test framework.

Add a test for an unknown directive without any arguments.

Add test for an unknown directive without arguments, followed
by a search directive.

(cherry picked from commit c44c4fcbfb)
2024-12-10 14:01:23 +11:00
Mark Andrews
841269601c Fix parsing of unknown directives in resolv.conf
Only call eatline() to skip to the next line if we're not
already at the end of a line when parsing an unknown directive.
We were accidentally skipping the next line when there was only
a single unknown directive on the current line.

(cherry picked from commit eb78ad2080)
2024-12-10 00:49:11 +00:00
Michal Nowak
4e768eba17 [9.18] new: test: Add Fedora 41
Prereq: isc-projects/images!345

Backport of MR !9612

Merge branch 'backport-mnowak/fedora-41-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9876
2024-12-09 18:00:12 +00:00
Michal Nowak
a3064a9f92 Add Fedora 41
(cherry picked from commit 66fddf812f)
2024-12-09 17:20:36 +00:00
Michal Nowak
e8ba695fbb [9.18] new: test: Add Alpine Linux 3.21
Prereq: isc-projects/images!359

Backport of MR !9872

Merge branch 'backport-mnowak/alpine-3.21-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9874
2024-12-09 17:17:39 +00:00
Michal Nowak
d23489d7d3 Add Alpine Linux 3.21
(cherry picked from commit 6340454ea7)
2024-12-09 16:26:35 +00:00
Michal Nowak
4528a41417 [9.18] new: ci: Add FreeBSD 14.2
Backport of MR !9838

Merge branch 'backport-mnowak/freebsd-14.2-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9870
2024-12-09 13:42:25 +00:00