Commit Graph

41840 Commits

Author SHA1 Message Date
Matthijs Mekking
7aaa36f09f Small keymgr improvement
When a key is to be purged, don't run the key state machinery for it.

(cherry picked from commit af54e3dadc)
2024-10-14 10:03:31 +02:00
Matthijs Mekking
80d5b3877a Add additional test case with purged key
Test that if a key to be purged is in the keyring, it does not
prevent the keymgr from running. Normally a key that is in the keyring
should be available again on the next run, but that is not true for
a key that can be purged.

In addition, fix some wait_for_log calls, by adding the missing
'|| ret=1' parts.

(cherry picked from commit a2317425bc)
2024-10-14 10:03:19 +02:00
Matthijs Mekking
24e8e4294a Fix some system test cases
Some test cases were working but for the wrong reasons. These started
to fail when I implemented the first approach for #4763, where the
existence of a DNSKEY together with an empty keyring is suspicious and
would prevent the keymgr from running.

These are:

1. kasp: The multisigner-model2.kasp zone has ZSKs from other providers
   in the zone, but not yet its own keys. Pregenerate signing keys and
   add them to the unsigned zone as well.

2. kasp: The dynamic-signed-inline-signing.kasp zone has a key generated
   and added in the raw version of the zone. But the key file is stored
   outside the key-directory for the given zone. Add '-K keys' to the
   dnssec-keygen command.

(cherry picked from commit d1e263ef13)
2024-10-14 10:03:12 +02:00
Matthijs Mekking
2494275a8e Verify new key files before running keymgr
Prior to running the keymgr, first make sure that existing keys
are present in the new keylist. If not, treat this as an operational
error where the keys are made offline (temporarily), possibly unwanted.

(cherry picked from commit 5fdad05a8a)
2024-10-14 10:03:00 +02:00
Matthijs Mekking
04ae34cff6 Add test for missing key files, don't roll
In this specific case the key files are temporary unavailable, for
example because of an operator error, or a mount failure). In such
cases, BIND should not try to roll over these keys.

(cherry picked from commit a3afbd9d6f)
2024-10-14 07:19:37 +00:00
Artem Boldariev
9aab8cb150 [9.20] fix: dig - always set the default port when doing a UDP query
This change ensures that the port is set before attempting a UDP query. Before that a situation could appear when previous query have completed over a different transport (that uses a dedicated port) and then a UDP query will be attempted over the port of the previous transport.

Backport of !9618.

Merge branch 'artem-debian-bug-1059582-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9619
2024-10-10 19:56:47 +00:00
Artem Boldariev
3585a004b9 dig: always set the default port when doing a UDP query
This commit ensures that the port is set before attempting a UDP
query. Before that a situation could appear when previous query have
completed over a different transport (that uses a dedicated port) and
then a UDP query will be attempted over the port of the previous
transport.

(cherry picked from commit e390ed4421)
2024-10-10 22:13:55 +03:00
Matthijs Mekking
f6696418ef [9.20] chg: doc: Add release note for #4460
This release note was missing due to a malformed Merge Request title.

The text is not copied verbatim, but changed to something more release
note-like.

Backport of MR !9598

Merge branch 'backport-4460-add-missing-release-note-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9615
2024-10-10 12:46:40 +00:00
Matthijs Mekking
69d121df3d Add release note for #4460
This release note was missing due to a malformed Merge Request title.

The text is not copied verbatim, but changed to something more release
note-like.

(cherry picked from commit 5860bafc60)
2024-10-10 11:43:06 +00:00
Matthijs Mekking
29c460a4e5 [9.20] fix: dev: Revert "Improve performance when looking for the closest encloser"
Revert "fix: chg: Improve performance when looking for the closest encloser when returning NSEC3 proofs"

This reverts merge request !9436

Closes #4950

Backport of MR !9611

Merge branch 'backport-revert-78d48f7a-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9613
2024-10-10 11:31:18 +00:00
Matthijs Mekking
d768dd1f5d Revert "fix: chg: Improve performance when looking for the closest encloser when returning NSEC3 proofs"
This reverts merge request !9436

(cherry picked from commit 0396bf98ee)
2024-10-10 09:29:52 +00:00
Arаm Sаrgsyаn
d2ea42e237 [9.20] fix: dev: Fix error path bugs in the manager's "recursing-clients" list management
In two places, after linking the client to the manager's
"recursing-clients" list using the check_recursionquota()
function, the query.c module fails to unlink it on error
paths. Fix the bugs by unlinking the client from the list.

Backport of MR !9586

Merge branch 'backport-aram/unlink-recursing-clients-on-error-paths-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9604
2024-10-09 12:41:06 +00:00
Aram Sargsyan
3b76aa01ba Refactor the way check_recursionquota() is used
Rename check_recursionquota() to acquire_recursionquota(), and
implement a new function called release_recursionquota() to
reverse the action. It helps with decreasing code duplication.

(cherry picked from commit 7bd44a4182)
2024-10-09 11:40:19 +00:00
Aram Sargsyan
dbd308436f Fix error path bugs in the "recursing-clients" list management
In two places, after linking the client to the manager's
"recursing-clients" list using the check_recursionquota()
function, the query.c module fails to unlink it on error
paths. Fix the bugs by unlinking the client from the list.

Also make sure that unlinking happens before detaching the
client's handle, as it is the logically correct order, e.g.
in case if it's the last handle and ns__client_reset_cb()
can be called because of the detachment.

(cherry picked from commit 36c4808903)
2024-10-09 11:40:19 +00:00
Arаm Sаrgsyаn
dd72a5eb8d [9.20] fix: dev: Fix a data race in dns_zone_getxfrintime()
The dns_zone_getxfrintime() function fails to lock the zone before
accessing its 'xfrintime' structure member, which can cause a data
race between soa_query() and the statistics channel. Add the missing
locking/unlocking pair, like it's done in numerous other similar
functions.

Closes #4976

Backport of MR !9591

Merge branch 'backport-4976-zone-xfrintime-data-race-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9601
2024-10-09 11:37:46 +00:00
Aram Sargsyan
407aba8840 Fix a data race in dns_zone_getxfrintime()
The dns_zone_getxfrintime() function fails to lock the zone before
accessing its 'xfrintime' structure member, which can cause a data
race between soa_query() and the statistics channel. Add the missing
locking/unlocking pair, like it's done in numerous other similar
functions.

(cherry picked from commit ab07803465)
2024-10-09 10:34:28 +00:00
Arаm Sаrgsyаn
47a77a3b12 [9.20] fix: dev: Clean up 'nodetach' in ns_client
The 'nodetach' member is a leftover from the times when non-zero
'stale-answer-client-timeout' values were supported, and currently
is always 'false'. Clean up the member and its usage.

Backport of MR !9592

Merge branch 'backport-aram/cleanup-ns-client-nodetach-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9600
2024-10-09 10:14:27 +00:00
Aram Sargsyan
3a5e683075 Clean up 'nodetach' in ns_client
The 'nodetach' member is a leftover from the times when non-zero
'stale-answer-client-timeout' values were supported, and currently
is always 'false'. Clean up the member and its usage.

(cherry picked from commit b8c068835e)
2024-10-09 09:16:21 +00:00
Michal Nowak
c385ae315b chg: doc: Set up version for BIND 9.20.4
Merge branch 'mnowak/set-up-version-for-bind-9.20.4' into 'bind-9.20'

See merge request isc-projects/bind9!9596
2024-10-08 08:40:54 +00:00
Michal Nowak
22f3037d06 Update BIND version to 9.20.4-dev 2024-10-08 10:34:31 +02:00
Ondřej Surý
a6692e793c [9.20] fix: dev: Don't enable REUSEADDR on outgoing UDP sockets
The outgoing UDP sockets enabled `SO_REUSEADDR` that allows sharing of the UDP sockets, but with one big caveat - the socket that was opened the last would get all traffic.  The dispatch code would ignore the invalid responses in the dns_dispatch, but this could lead to unexpected results.

Backport of MR !9569

Merge branch 'backport-ondrej/fix-outgoing-UDP-port-selection-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9583
2024-10-02 13:23:19 +00:00
Ondřej Surý
4b4c550cd8 Don't enable SO_REUSEADDR on outgoing UDP sockets
Currently, the outgoing UDP sockets have enabled
SO_REUSEADDR (SO_REUSEPORT on BSDs) which allows multiple UDP sockets to
bind to the same address+port.  There's one caveat though - only a
single (the last one) socket is going to receive all the incoming
traffic.  This in turn could lead to incoming DNS message matching to
invalid dns_dispatch and getting dropped.

Disable setting the SO_REUSEADDR on the outgoing UDP sockets.  This
needs to be done explicitly because `uv_udp_open()` silently enables the
option on the socket.

(cherry picked from commit eec30c33c2)
2024-10-02 12:16:58 +00:00
Ondřej Surý
e2058ab461 [9.20] fix: usr: Fix assertion failure when receiving DNS responses over TCP
When matching the received Query ID in the TCP connection,
an invalid received Query ID can very rarely cause assertion
failure.

Closes #4952

Backport of MR !9580

Merge branch 'backport-4952-check-whether-QID-is-not-deleted-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9582
2024-10-02 12:07:49 +00:00
Ondřej Surý
b46108b428 Skip TCP dispatch responses that are not ours
When matching the TCP dispatch responses, we should skip the responses
that do not belong to our TCP connection.  This can happen with faulty
upstream server that sends invalid QID back to us.

(cherry picked from commit 4ef316e21e)
2024-10-02 10:45:05 +00:00
Arаm Sаrgsyаn
97fad455d7 [9.20] fix: dev: Don't ignore the local port number in dns_dispatch_add() for TCP
The dns_dispatch_add() function registers the 'resp' entry in
'disp->mgr->qids' hash table with 'resp->port' being 0, but in
tcp_recv_success(), when looking up an entry in the hash table
after a successfully received data the port is used, so if the
local port was set (i.e. it was not 0) it fails to find the
entry and results in an unexpected error.

Set the 'resp->port' to the given local port value extracted from
'disp->local'.

Closes #4969

Backport of MR !9576

Merge branch 'backport-4969-dispatch-tcp-source-port-bug-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9581
2024-10-02 10:44:38 +00:00
Aram Sargsyan
ca966c396a Don't ignore the local port number in dns_dispatch_add() for TCP
The dns_dispatch_add() function registers the 'resp' entry in
'disp->mgr->qids' hash table with 'resp->port' being 0, but in
tcp_recv_success(), when looking up an entry in the hash table
after a successfully received data the port is used, so if the
local port was set (i.e. it was not 0) it fails to find the
entry and results in an unexpected error.

Set the 'resp->port' to the given local port value extracted from
'disp->local'.

(cherry picked from commit d49a8f518a)
2024-10-02 09:53:45 +00:00
Ondřej Surý
19e3cd0cd2 [9.20] chg: dev: Use release memory ordering when incrementing reference counter
As the relaxed memory ordering doesn't ensure any memory
synchronization, it is possible that the increment will succeed even
in the case when it should not - there is a race between
atomic_fetch_sub(..., acq_rel) and atomic_fetch_add(..., relaxed).
Only the result is consistent, but the previous value for both calls
could be same when both calls are executed at the same time.

Backport of MR !9460

Merge branch 'backport-ondrej/use-release-memory-ordering-for-reference-counting-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9567
2024-10-02 07:09:54 +00:00
Ondřej Surý
5701bf9dab Use release memory ordering when incrementing reference counter
As the relaxed memory ordering doesn't ensure any memory
synchronization, it is possible that the increment will succeed even
in the case when it should not - there is a race between
atomic_fetch_sub(..., acq_rel) and atomic_fetch_add(..., relaxed).
Only the result is consistent, but the previous value for both calls
could be same when both calls are executed at the same time.

(cherry picked from commit 88227ea665)
2024-10-02 09:09:35 +02:00
Mark Andrews
aa078bdd37 [9.20] fix: doc: Restore text about sig validity and SOA expire
When `sig-validity-interval` was obsoleted, the text that the signature validity interval should be multiples of the SOA expire interval was removed. Restore this text to the description of the `signatures-validity` option.

Closes #4951

Backport of MR !9566

Merge branch 'backport-4951-document-signatures-validity-soa-expire-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9573
2024-10-02 07:01:05 +00:00
Matthijs Mekking
2267394f0a Update example.com zone SOA expire value
The example.com zone file given in the "Configurations and Zone Files"
chapter has an SOA expire of 3 weeks, which is not a multiple of
the default signatures-validity value. Adjust the SOA expire so that
it is much lower than the signatures-validity default.

(cherry picked from commit 8aa94931c3)
2024-10-02 05:28:22 +00:00
Matthijs Mekking
e25f165bdd Restore text about sig validity and SOA expire
When `sig-validity-interval` was obsoleted, the text that the signature
validity interval should be multiples of the SOA expire interval was
removed. Restore this text to the description of the
`signatures-validity` option.

(cherry picked from commit b09230004b)
2024-10-02 05:28:22 +00:00
Michal Nowak
cd2e369aa8 [9.20] chg: test: Replace dns.query module with isctest.query
The `dns.query.udp` and `dns.query.tcp` methods are [prone to timeouts](https://gitlab.isc.org/isc-projects/bind9/-/jobs/4785053); their `isctest.query` equivalents should be used in system tests instead.

Backport of MR !9560

Merge branch 'backport-mnowak/convert-dns-query-udp-and-tcp-to-isctest-query-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9574
2024-10-01 15:04:13 +00:00
Michal Nowak
8252f8cbc4 Replace dns.query module with isctest.query
(cherry picked from commit dfec69b4a2)
2024-10-01 12:06:40 +00:00
Michal Nowak
b5bdc3ff30 Add isctest.check.notimp()
(cherry picked from commit a2d2d9c0d3)
2024-10-01 12:06:40 +00:00
Michal Nowak
8f5fcf6441 Report expected and last returned rcode on query timeout
Sometimes it's useful to see what was the server returning that did not
match the expected rcode.

(cherry picked from commit 4cb52f072e)
2024-10-01 12:06:40 +00:00
Mark Andrews
72626cf940 [9.20] fix: usr: Fix a bug in the static-stub implementation
Static-stub addresses and addresses from other sources were being
mixed together, resulting in static-stub queries going to addresses
not specified in the configuration, or alternatively, static-stub
addresses being used instead of the correct server addresses.

Closes #4850

Backport of MR !9314

Merge branch 'backport-4850-add-an-additional-class-of-names-to-adb-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9571
2024-10-01 02:07:40 +00:00
Mark Andrews
7e8ffe3d63 Store static-stub addresses seperately in the adb
Static-stub address and addresses from other sources where being
mixed together resulting in static-stub queries going to addresses
not specified in the configuration or alternatively static-stub
addresses being used instead of the real addresses.

(cherry picked from commit b3a2c790f3)
2024-10-01 01:27:55 +00:00
Mark Andrews
cee11c8610 [9.20] new: usr: Log query response status to the query log
Log a query response summary using the new category `responses`.  Logging can be controlled by the option `responselog` and `rndc responselog`.

Closes #459

Backport of MR !9449

Merge branch 'backport-459-log-query-response-status-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9526
2024-09-30 01:14:26 +00:00
Mark Andrews
3c0515b349 Document 'responselog' in the ARM
(cherry picked from commit 452db02c19)
2024-09-30 00:10:47 +00:00
Mark Andrews
39afab41f0 Check responselog behaviour
Extends the resolver system test to to check whether responses are
logged to the query log in addition to the queries.

(cherry picked from commit 61415432ec)
2024-09-30 00:10:47 +00:00
Petr Menšík
59770f281c Move common flags logging to shared functions
Query and response log shares the same flags. Move flags logging out of
log_query to share it with log_response. Use buffer instead of snprintf
to fill flags a bit faster.

Signed-off-by: Petr Menšík <pemensik@redhat.com>
(cherry picked from commit e6b19af2dd)
2024-09-30 00:10:47 +00:00
Petr Menšík
d9d50f6274 Make responselog flags similar to querylog
Remove answer flag from log, log instead count of records for each
message section. Include EDNS version and few flags of response. Add
also status of result.

Still does not include body of responses rrset.

(cherry picked from commit 6f879aba65)
2024-09-30 00:10:47 +00:00
Evan Hunt
b9f4a1b029 Reduce code duplication
combined named_server_togglequerylog() and
named_server_toggleresponselog() into named_server_setortoggle().

(cherry picked from commit c4b7dce376)
2024-09-30 00:10:47 +00:00
Mark Andrews
3968813724 Log the rcode returned to for a query
Log to the querylog the rcode of a previous query using
the identifier 'response:' to diffenciate queries from
responses.

(cherry picked from commit 5fad79c92f)
2024-09-30 00:10:47 +00:00
Arаm Sаrgsyаn
5db2ec0739 [9.20] fix: dev: Add a missing rcu_read_unlock() call on exit path
An exit path in the dns_dispatch_add() function fails to get out of
the RCU critical section when returning early. Add the missing
rcu_read_unlock() call.

Backport of MR !9561

Merge branch 'backport-aram/add-missing-rcu_read_unlock-in-dns_dispatch_add-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9564
2024-09-27 14:29:46 +00:00
Aram Sargsyan
346850954c Add a missing rcu_read_unlock() call on exit path
An exit path in the dns_dispatch_add() function fails to get out of
the RCU critical section when returning early. Add the missing
rcu_read_unlock() call.

(cherry picked from commit 4123d59fbc)
2024-09-27 13:53:31 +00:00
Ondřej Surý
5e6594b1f7 [9.20] dev: Add full Alessio's name to .mailmap to fix some of the older commits
Backport of MR !9557

Merge branch 'backport-ondrej/add-alessio-to-.mailmap-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9558
2024-09-26 11:55:07 +00:00
Ondřej Surý
6444583f65 Add full Alessio's name to .mailmap to fix some of the older commits
(cherry picked from commit 1bc9eb0fc8)
2024-09-26 11:51:08 +00:00
Mark Andrews
dad3fafe9e [9.20] new: usr: Added WALLET type
Add the new record type WALLET (262).  This provides a mapping from a domain name to a cryptographic currency wallet.  Multiple mappings can exist if multiple records exist.

Closes #4947

Backport of MR !9521

Merge branch 'backport-4947-add-wallet-type-to-named-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9554
2024-09-25 12:49:22 +00:00
Mark Andrews
00287db8ed Add examples of WALLET records
(cherry picked from commit 9b358e6e8b)
2024-09-25 12:07:52 +00:00