Commit Graph
38973 Commits
Author SHA1 Message Date
Matthijs MekkingandNicki Křížek 2f5c670ce9 Add new test cases with DNSSEC signing
kasp-max-types-per-name (named2.conf.in):
An unsigned zone with RR type count on a name right below the
configured limit. Then sign the zone using KASP. Adding a RRSIG would
push it over the RR type limit per name. Signing should fail, but
the server should not crash, nor end up in infinite resign-attempt loop.

kasp-max-records-per-type-dnskey (named1.conf.in):
Test with low max-record-per-rrset limit and a DNSSEC policy requiring
more than the limit. Signing should fail.

kasp-max-types-per-name (named1.conf.in):
Each RRSIG(covered type) is counted as an individual RR type. Test the
corner case where a signed zone, which is just below the limit-1,
adds a new type - doing so would trigger signing for the new type and
thus increase the number of "types" by 2, pushing it over the limit
again.

(cherry picked from commit 14e5230f897a178221b606c242b8fbcb357704aa)
2024-06-10 18:51:27 +02:00
Matthijs MekkingandNicki Křížek 4a0118c16e Check if restart works
(cherry picked from commit 4e69ece8f27f3623a4c7a9100477a5547b94c311)
2024-06-10 18:51:27 +02:00
Matthijs MekkingandNicki Křížek 6fe1df142b Switch to inline-signing no
(cherry picked from commit 0949221c07fe102ca608899b21f1f5ac5e271953)
2024-06-10 18:51:27 +02:00
Matthijs MekkingandNicki Křížek 270512949e Add test cases that use DNSSEC signing
Add two new masterformat tests that use signing. In the case of
'under-limit-kasp', the signing will keep the number of records in the
RRset under the limit. In the case of 'on-limit-kasp', the signing
will push the number of records in the RRset over the limit, because
of the added RRSIG record.

(cherry picked from commit 4c677882e66883670990a771337ecbb5206a6faa)
2024-06-10 18:51:27 +02:00
Petr ŠpačekandNicki Křížek 5067ab6120 Remove duplicated empty zone files
(cherry picked from commit 1456b4fc7778b851256107dbc79fb67d45f752f5)
2024-06-10 18:51:26 +02:00
Petr ŠpačekandNicki Křížek aa2a1ab919 masterformat: rename zone names to reflect intended meaning
(cherry picked from commit d34bfb1eeaa2f8faab80b1620b992b5495e6f88c)
2024-06-10 18:51:26 +02:00
Petr ŠpačekandNicki Křížek e38a92cef8 Test owner name rename: a b c d e -> <number>-txt
(cherry picked from commit 6ce03f75d1935c2e1991e9c0a01c49b0099a58cb)
2024-06-10 18:51:26 +02:00
Petr ŠpačekandNicki Křížek 1a8ea606d9 Test variable rename i->_attempt
(cherry picked from commit 13417eb277cc8a30ee4ddbb6fc02442b0d8e6d3c)
2024-06-10 18:51:26 +02:00
Petr ŠpačekandNicki Křížek ac39dcb397 Test variable rename a->rrcount
(cherry picked from commit 338b45ae713cded921fd3e5494ca38bd59ff9ee8)
2024-06-10 18:51:26 +02:00
Evan HuntandNicki Křížek cdff65122e Add CHANGES and release note for [GL #3403]
(cherry picked from commit 54bcbe9a2af6332ce8ffb7190edf40533404c93d)
2024-06-10 18:51:23 +02:00
Ondřej SurýandNicki Křížek 4bdd1bf4f3 Add test for not-loading many RRsets per name on a secondary
This tests makes sure the zone with many RRsets per name is not loaded
via XFR on the secondary server.

(cherry picked from commit 4cfeed912a5e7440f04cb088a461ff47305da2e7)
2024-06-10 18:50:06 +02:00
Ondřej SurýandNicki Křížek 19dc77ac48 Add a test for not caching large number of RRsets
Send a recursive query for a large number of RRsets, which should
fail when using the default max-types-per-name setting of 100, but
succeed when the cap is disabled.

(cherry picked from commit 7e4530f847c8dc541c5e5bf9f790deed520aaa16)
2024-06-10 18:50:06 +02:00
Ondřej SurýandNicki Křížek 39d3e2a8ec Add a limit to the number of RR types for single name
Previously, the number of RR types for a single owner name was limited
only by the maximum number of the types (64k).  As the data structure
that holds the RR types for the database node is just a linked list, and
there are places where we just walk through the whole list (again and
again), adding a large number of RR types for a single owner named with
would slow down processing of such name (database node).

Add a configurable limit to cap the number of the RR types for a single
owner.  This is enforced at the database (rbtdb, qpzone, qpcache) level
and configured with new max-types-per-name configuration option that
can be configured globally, per-view and per-zone.

(cherry picked from commit 00d16211d6368b99f070c1182d8c76b3798ca1db)
2024-06-10 18:50:06 +02:00
Evan HuntandNicki Křížek 197b08009d Add a test for not caching large RRset
Send a recursive query for a large (2500 record) RRset, which should
fail when using the default max-records-per-type setting of 100, but
succeed when the cap is disabled.

(cherry picked from commit 8e3efb4e06ba68cc3f9bc5be2bacb2596bd74cb3)
2024-06-10 18:50:06 +02:00
Ondřej SurýandNicki Křížek b77606d167 Add test for not-loading and not-transfering huge RRSets
Add two new masterformat tests - the 'huge' zone fits within the ns1
limit and loads on the primary ns1 server, but must not transfer to the
ns2 secondary, and the 'uber' zone should not even load on the primary
ns1 server.

(cherry picked from commit cee9ad81db6e5a1167b311e5c2f42cf65ba457cd)
2024-06-10 18:50:05 +02:00
Ondřej SurýandNicki Křížek e699ef939e Add a limit to the number of RRs in RRSets
Previously, the number of RRs in the RRSets were internally unlimited.
As the data structure that holds the RRs is just a linked list, and
there are places where we just walk through all of the RRs, adding an
RRSet with huge number of RRs inside would slow down processing of said
RRSets.

Add a configurable limit to cap the number of the RRs in a single RRSet.
This is enforced at the database (rbtdb, qpzone, qpcache) level and
configured with new max-records-per-type configuration option that can
be configured globally, per-view and per-zone.

(cherry picked from commit 3fbd21f69a1bcbd26c4c00920e7b0a419e8762fc)
2024-06-10 18:50:03 +02:00
Nicki Křížek 3492c0deda Merge branch '4481-security-tcp-flood-9.18' into 'v9.18.28-release'
[9.18] [CVE-2024-0760] Throttle reading from TCP if the sends are not getting through

See merge request isc-private/bind9!641
2024-06-10 16:47:06 +00:00
Ondřej SurýandNicki Křížek 41eb89503c Add CHANGES and release note for [GL #4481]
(cherry picked from commit 3e4babc58e1ed169a25ae9083f8f3c7d3e8389a3)
2024-06-10 18:44:52 +02:00
Ondřej SurýandNicki Křížek 964891a794 Limit the number of DNS message processed from a single TCP read
The single TCP read can create as much as 64k divided by the minimum
size of the DNS message.  This can clog the processing thread and trash
the memory allocator because we need to do as much as ~20k allocations in
a single UV loop tick.

Limit the number of the DNS messages processed in a single UV loop tick
to just single DNS message and limit the number of the outstanding DNS
messages back to 23.  This effectively limits the number of pipelined
DNS messages to that number (this is the limit we already had before).

This reverts commit 780a89012d.
2024-06-10 18:43:46 +02:00
Ondřej SurýandNicki Křížek 0b1d70ed2a Remove the extra memory context with own arena for sending
(cherry picked from commit 8d4cc41c291f8a77a723ae8e62533538b3632d50)
2024-06-10 18:43:46 +02:00
Ondřej SurýandNicki Křížek 3f6b7f57a6 Replace the tcp_buffers memory pool with static per-loop buffer
As a single thread can process only one TCP send at the time, we don't
really need a memory pool for the TCP buffers, but it's enough to have
a single per-loop (client manager) static buffer that's being used to
assemble the DNS message and then it gets copied into own sending
buffer.

In the future, this should get optimized by exposing the uv_try API
from the network manager, and first try to send the message directly
and allocate the sending buffer only if we need to send the data
asynchronously.

(cherry picked from commit 297cc840fbaf34b9dfa1d02d88a023cd5bf5dc4a)
2024-06-10 18:43:46 +02:00
Aram SargsyanandNicki Křížek 4e70342142 ns_client: reuse TCP send buffers
Constantly allocating, reallocating and deallocating 64K TCP send
buffers by 'ns_client' instances takes too much CPU time.

There is an existing mechanism to reuse the ns_clent_t structure
associated with the handle using 'isc_nmhandle_getdata/_setdata'
(see ns_client_request()), but it doesn't work with TCP, because
every time ns_client_request() is called it gets a new handle even
for the same TCP connection, see the comments in
streamdns_on_complete_dnsmessage().

To solve the problem, we introduce an array of available (unused)
TCP buffers stored in ns_clientmgr_t structure so that a 'client'
working via TCP can have a chance to reuse one (if there is one)
instead of allocating a new one every time.
2024-06-10 18:43:45 +02:00
Ondřej SurýandNicki Křížek c6f13f12cd Throttle reading from TCP if the sends are not getting through
When TCP client would not read the DNS message sent to them, the TCP
sends inside named would accumulate and cause degradation of the
service.  Throttle the reading from the TCP socket when we accumulate
enough DNS data to be sent.  Currently this is limited in a way that a
single largest possible DNS message can fit into the buffer.

(cherry picked from commit 26006f7b44474819fac2a76dc6cd6f69f0d76828)
2024-06-10 18:43:44 +02:00
Nicki Křížek 139ff18da9 Merge branch '4473-fix-doh-intermittent-crash-v9.18' into 'v9.18.28-release'
[9.18] DoH: Avoid potential data races in our DoH implementation related to to HTTP/2 session object management and endpoints set object management

See merge request isc-private/bind9!701
2024-06-10 16:41:28 +00:00
Artem BoldarievandNicki Křížek a98607d2ce Modify release notes [GL #4473]
Mention that an intermittent BIND process termination in DoH code has
been fixed.
2024-06-10 18:37:56 +02:00
Artem BoldarievandNicki Křížek 8132f4c020 Modify CHANGES [GL #4473]
Mention that an intermittent BIND process termination in DoH code has
been fixed.

(cherry picked from commit 773a8108f307b4f6cc7776050d85432295b13a4d)
2024-06-10 18:36:17 +02:00
Artem BoldarievandNicki Křížek 998522e68e Keep the endpoints set reference within an HTTP/2 socket
This commit ensures that an HTTP endpoints set reference is stored in
a socket object associated with an HTTP/2 stream instead of
referencing the global set stored inside a listener.

This helps to prevent an issue like follows:

1. BIND is configured to serve DoH clients;
2. A client is connected and one or more HTTP/2 stream is
created. Internal pointers are now pointing to the data on the
associated HTTP endpoints set;
3. BIND is reconfigured - the new endpoints set object is created and
promoted to all listeners;
4. The old pointers to the HTTP endpoints set data are now invalid.

Instead referencing a global object that is updated on
re-configurations we now store a local reference which prevents the
endpoints set objects to go out of scope prematurely.

(cherry picked from commit b9b5d0c01a3a546c4a6a8b3bff8ae9dd31fee224)
2024-06-10 18:35:18 +02:00
Artem BoldarievandNicki Křížek b601a5b781 DoH: avoid potential use after free for HTTP/2 session objects
It was reported that HTTP/2 session might get closed or even deleted
before all async. processing has been completed.

This commit addresses that: now we are avoiding using the object when
we do not need it or specifically check if the pointers used are not
'NULL' and by ensuring that there is at least one reference to the
session object while we are doing incoming data processing.

This commit makes the code more resilient to such issues in the
future.

(cherry picked from commit 0cca550dff403c6100b7c0da8f252e7967765ba7)
2024-06-10 18:35:16 +02:00
Nicki Křížek 3be849bfab Merge branch '4661-confidential-clear-dns-fetchopt-trystale-ontimeout' into 'v9.18.28-release'
Prevent passing DNS_EVENT_TRYSTALE events to resume_dslookup()

See merge request isc-private/bind9!678
2024-06-10 16:34:02 +00:00
Mark AndrewsandNicki Křížek 6c740fa78b Add release note for [GL #4661] 2024-06-10 18:28:53 +02:00
Mark AndrewsandNicki Křížek dbc06313a6 Add CHANGES not for [GL #4661] 2024-06-10 18:28:44 +02:00
Mark AndrewsandMichał Kępień 6455527830 Clear DNS_FETCHOPT_TRYSTALE_ONTIMEOUT
When calling dns_resolver_createfetch in resolver.c with a callback
of resume_dslookup, clear DNS_FETCHOPT_TRYSTALE_ONTIMEOUT from
options as DNS_EVENT_TRYSTALE is not an expected event type and
triggers a REQUIRE.
2024-06-06 07:48:49 +02:00
Mark Andrews 2c05f40eae Merge branch '2744-warning-checkhints-unable-to-get-root-ns-rrset-from-cache-not-found-9.18' into 'bind-9.18'
[9.18] Resolve "warning: checkhints: unable to get root NS rrset from cache: not found"

See merge request isc-projects/bind9!9080
2024-06-04 13:11:18 +00:00
Mark Andrews 455c262649 Add CHANGES entry for [GL #2744]
(cherry picked from commit 5be6ceebc4)
2024-06-04 12:42:05 +00:00
Mark Andrews 13be6cd991 Pass a memory context in to dns_cache_create
(cherry picked from commit 87e3b9dbf3)
2024-06-04 12:42:05 +00:00
Mark Andrews 26ad166a05 Use a new memory context when flushing the cache
When the cache's memory context was in over memory state when the
cache was flushed it resulted in LRU cleaning removing newly entered
data in the new cache straight away until the old cache had been
destroyed enough to take it out of over memory state.  When flushing
the cache create a new memory context for the new db to prevent this.

(cherry picked from commit 5e77edd074)
2024-06-04 12:42:05 +00:00
Mark Andrews 2c5a13008f Merge branch '4736-isc_r_hostdown-was-not-being-handled-by-resolver-c-9.18' into 'bind-9.18'
[9.18] Resolve "ISC_R_HOSTDOWN was not being handled by resolver.c"

See merge request isc-projects/bind9!9088
2024-06-04 08:10:59 +00:00
Mark Andrews c22b590dc3 Add CHANGES note for [GL #4736]
(cherry picked from commit 71cfa8dfba)
2024-06-04 07:38:40 +00:00
Mark Andrews d3f708ba56 Update resquery_senddone handling of ISC_R_TIMEDOUT
Treat timed out as an address specific error.

(cherry picked from commit 56c3dcc5d7)
2024-06-04 07:38:40 +00:00
Mark Andrews 99d2b4079f Update resquery_senddone handling of ISC_R_CONNECTIONRESET
Treat connection reset as an address specific error.

(cherry picked from commit 4e3dd85b8d)
2024-06-04 07:38:40 +00:00
Mark Andrews e87a5e7bff Handle ISC_R_HOSTDOWN and ISC_R_NETDOWN in resolver.c
These error codes should be treated like other unreachable error
codes.

(cherry picked from commit 180b1e7939)
2024-06-04 07:38:40 +00:00
Mark Andrews df99aac72c Merge branch '3472-ipv4-only-mode-not-respected-for-zone-transfers-9.18' into 'bind-9.18'
[9.18] Resolve "IPv4-only mode not respected for zone transfers"

See merge request isc-projects/bind9!9085
2024-06-03 23:59:36 +00:00
Mark Andrews f1d2b0e5fd Add CHANGES note for [GL #6288]
(cherry picked from commit 3834e433f7)
2024-06-03 13:52:37 +00:00
Mark Andrews 69dde597b9 Don't do DS checks over disabled address families
(cherry picked from commit 05472e63e8)
2024-06-03 13:52:37 +00:00
Mark Andrews 542e891287 Don't forward UPDATE messages over disabled address families
(cherry picked from commit d026dbe536)
2024-06-03 13:52:37 +00:00
Mark Andrews c6a207c710 Don't send NOTIFY over disabled address families
(cherry picked from commit 5d99625515)
2024-06-03 13:52:37 +00:00
Mark Andrews 4be2caa345 Check that no primaries is logged with -4 or -6
When in -4 mode check that "IPv6 disabled and no IPv4 primaries"
is logged and when in -6 mode check that "IPv4 disabled and no IPv6
primaries" is logged.

(cherry picked from commit 07cdf3e945)
2024-06-03 13:52:37 +00:00
Mark Andrews 96754276a7 Report non-effective primaries
When named is started with -4 or -6 and the primaries for a zone
do not have an IPv4 or IPv6 address respectively issue a log message.

(cherry picked from commit 2cd4303249)
2024-06-03 13:52:37 +00:00
Mark Andrews 7a9ac0491f Zone transfers should honour -4 and -6 options
Check if the address family has been disabled when transferring
zones.

(cherry picked from commit ecdde04e63)
2024-06-03 13:52:37 +00:00
Mark Andrews e0af62deac Add helper function isc_sockaddr_disabled
(cherry picked from commit 9be1873ef3)
2024-06-03 13:52:37 +00:00