Commit Graph

39280 Commits

Author SHA1 Message Date
Aram Sargsyan
6f1f5fc307 Fix a data race between the dns_zone and dns_catz modules
The dns_zone_catz_enable_db() and dns_zone_catz_disable_db()
functions can race with similar operations in the catz module
because there is no synchronization between the threads.

Add catz functions which use the view's catalog zones' lock
when registering/unregistering the database update notify callback,
and use those functions in the dns_zone module, instead of doing it
directly.
2023-06-15 08:49:20 +00:00
Tony Finch
68cfbd2bd1 Merge branch '4134-zonefile-erofs' into 'main'
Translate POSIX errorcode EROFS to ISC_R_NOPERM

Closes #4134

See merge request isc-projects/bind9!8017
2023-06-14 12:44:54 +00:00
Tony Finch
82401f0f0e CHANGES note for [GL #4134]
[cleanup]	Report "permission denied" instead of "unexpected error"
		when trying to update a zone file is on a read-only file
		system. Thanks to Midnight Veil. [GL #4134]
2023-06-14 13:13:39 +01:00
Midnight Veil
dd6acc1cac Translate POSIX errorcode EROFS to ISC_R_NOPERM
Report "permission denied" instead of "unexpected error"
when trying to update a zone file on a read-only file system.
2023-06-14 13:12:45 +01:00
Mark Andrews
06bbe6a2db Merge branch '4021-tsan-error-view-adb-detached-too-early' into 'main'
Resolve "TSAN error: view->adb detached too early."

Closes #4021

See merge request isc-projects/bind9!8016
2023-06-14 10:36:08 +00:00
Mark Andrews
0da3370642 Add CHANGES note for [GL #4021] 2023-06-14 19:22:00 +10:00
Mark Andrews
971f49b3ad Use RCU for view->adb access
view->adb may be referenced while the view is shutting down as the
zone uses a weak reference to the view and examines view->adb but
dns_view_detach call dns_adb_detach to clear view->adb.
2023-06-14 19:21:28 +10:00
Evan Hunt
984decc563 Merge branch 'each-tsig-refactoring' into 'main'
TSIG/TKEY refactoring

See merge request isc-projects/bind9!7828
2023-06-14 08:14:47 +00:00
Evan Hunt
885c132f4a improve code flow
the code in dns_tkey_processquery() was unnecessarily hard to follow.
2023-06-14 08:14:38 +00:00
Evan Hunt
f4084ff543 minor tkey-related fixups
- style fixes and general tidying-up in tkey.c
- remove the unused 'intoken' parameter from dns_tkey_buildgssquery()
- remove an unnecessary call to dns_tkeyctx_create() in ns_server_create()
  (the TKEY context that was created there would soon be destroyed and
  another one created when the configuration was loaded).
2023-06-14 08:14:38 +00:00
Evan Hunt
96e8b0e782 rename 'ret' to 'result'
purely to assuage my desire for consistency across modules,
result variables have been renamed to 'result' as they are
throughout most of BIND. there are no other changes.
2023-06-14 08:14:38 +00:00
Evan Hunt
6105a7d360 convert TSIG keyring storage from RBT to hash table
since it is not necessary to find partial matches when looking
up names in a TSIG keyring, we can use a hash table instead of
an RBT to store them.

the tsigkey object now stores the key name as a dns_fixedname
rather than allocating memory for it.

the `name` parameter to dns_tsigkeyring_add() has been removed;
it was unneeded since the tsigkey object already contains a copy
of the name.

the opportunistic cleanup_ring() function has been removed;
it was only slowing down lookups.
2023-06-14 08:14:38 +00:00
Evan Hunt
e64b44a5cb remove dns__tsig_algallocated()
this function was no longer needed, because the algorithm name is no
longer copied into the tsigkey object by dns_tsigkey_createfromkey();
it's always just a pointer to a statically defined name.
2023-06-14 08:14:38 +00:00
Evan Hunt
f2d5782e89 get_key_struct() can no longer fail
remove checks for NULL return values.
2023-06-14 08:14:38 +00:00
Evan Hunt
ffacf0aec6 use algorithm number instead of name to create TSIG keys
the prior practice of passing a dns_name containing the
expanded name of an algorithm to dns_tsigkey_create() and
dns_tsigkey_createfromkey() is unnecessarily cumbersome;
we can now pass the algorithm number instead.
2023-06-14 08:14:38 +00:00
Evan Hunt
a6e187a8d5 further dns_tsigkey API tweaks
- remove the 'ring' parameter from dns_tsigkey_createfromkey(),
  and use dns_tsigkeyring_add() to add key objects to a keyring instead.
- add a magic number to dns_tsigkeyring_t
- change dns_tsigkeyring_dumpanddetach() to dns_tsigkeyring_dump();
  we now call dns_tsigkeyring_detach() separately.
- remove 'maxgenerated' from dns_tsigkeyring_t since it never changes.
2023-06-14 08:14:38 +00:00
Evan Hunt
404a13b4dd clean up reference counting in dns_tsigkey
the reference counter in dns_tsigkey was being computed differently
depending on whether there was a keyring or not. this is prone to
error.
2023-06-14 08:14:38 +00:00
Evan Hunt
6fa8524bba use ISC_REFCOUNT_IMPL for dns_tsigkey and dns_tsigkeyring
use the ISC_REFCOUNT attach/detach implementation in dns/tsig.c
so that detailed tracing can be used during refactoring.

dns_tsig_keyring_t has been renamed dns_tsigkeyring_t so the type
and the attach/detach function names will match.
2023-06-14 08:14:38 +00:00
Evan Hunt
b1db1c1475 minor tsig.c cleanups
- style cleanups.
- simplify the function parameters to dns_tsigkey_create():
  + remove 'restored' and 'generated', they're only ever set to false.
  + remove 'creator' because it's only ever set to NULL.
  + remove 'inception' and 'expiry' because they're only ever set to
    (0, 0) or (now, now), and either way, this means "never expire".
  + remove 'ring' because we can just use dns_tsigkeyring_add() instead.
- rename dns_keyring_restore() to dns_tsigkeyring_restore() to match the
  rest of the functions operating on dns_tsigkeyring objects.
2023-06-14 08:14:38 +00:00
Matthijs Mekking
dc71aab358 Merge branch '4141-find-zone_keys' into 'main'
Update find_zone_keys for dynamic update

Closes #4141

See merge request isc-projects/bind9!8029
2023-06-14 08:05:55 +00:00
Matthijs Mekking
e59c6a5adc Update findzonekeys function name in log message
The "dns_dnssec_findzonekeys2" log message is a leftover from when that
was the name of the function. Rename to match the current name of the
function.
2023-06-14 09:08:56 +02:00
Matthijs Mekking
5cf91728d1 Add dynamic update prepub and doubleksk test case
Add two test cases for zones that use auto-dnssec, but not
inline-signing, and make sure that the change for find_zone_keys()
do not affect introducing a new key that is intended for signing.

See note https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/7638#note_355944
2023-06-14 09:08:56 +02:00
Matthijs Mekking
5c9a7ffbdb Add CHANGES for find_zone_keys() function update
Probably a useful point in history.
2023-06-14 09:08:56 +02:00
Matthijs Mekking
88e5bc0687 Update find_zone_keys for dynamic update
The find_zone_keys() function was not working properly for
inline-signed zones. It only worked if the DNSKEY records were also
published in the unsigned version of the zone. But this is not the
case when you use dnssec-policy, the DNSKEY records will only occur
in the signed version of the zone. Therefor, when looking for keys
to sign the zone, only the newly added keys in the dynamic update
were found (which could be zero), ignoring existing keys.

Also, if a DNSKEY was added, it would try to sign the zone with just
this new key, and this would only work if the key files for that key
were imported into the key-directory.

This is a design error, because the goal is to sign the zone with the
keys for which we actually have key files for. So instead of looking
for DNSKEY records to then search for the matching key files, call
dns_dnssec_findmatchingkeys() which just looks for the keys we have
on disk for the given zone. It will also set the correct DNSSEC
signing hints.
2023-06-14 09:08:56 +02:00
Matthijs Mekking
cda1ae69ac Add log check in multisigner system test
When we add DNSKEY records via dynamic update, this should no longer
trigger signing the zone with these keys. This currently happens when
'find_zone_keys()' looks up the keys by inspecting the DNSKEY RRset,
then attempting to read the corresponding key files.

Add checks that inspect the logs whether an attempt to read the key
files for the newly added keys was done (and failed because these files
are not available).
2023-06-14 09:08:56 +02:00
Tom Krizek
2633732fb1 Merge branch 'tkrizek/remove-trailing-whitespace' into 'main'
Remove trailing whitespace from all text files

See merge request isc-projects/bind9!8012
2023-06-13 13:31:32 +00:00
Tom Krizek
034a32a4f3 Add utility script to detect trailing whitespace
Run the script in CI as well to ensure we don't accidentally add
trailing whitespace again.
2023-06-13 15:06:38 +02:00
Tom Krizek
03e981ed2c Ignore trailing whitespace removal commit in git blame 2023-06-13 15:06:38 +02:00
Tom Krizek
5893debf46 Remove trailing whitespace from all text files
I've used the following command to remove the trailing whitespace for
all tracked text files:

git grep -Il '' | xargs sed -i 's/[ \t]*$//'
2023-06-13 15:05:40 +02:00
Arаm Sаrgsyаn
589752fc69 Merge branch '4136-catz-db-update-notify-bug' into 'main'
Fix catz db update callback registration logic error

Closes #4136

See merge request isc-projects/bind9!8025
2023-06-13 13:01:05 +00:00
Aram Sargsyan
23f609ba59 Add a CHANGES note for [GL #4136] 2023-06-13 12:58:13 +00:00
Aram Sargsyan
998765fea5 Fix catz db update callback registration logic error
When a catalog zone is updated using AXFR, the zone database is changed,
so it is required to unregister the update notification callback from
the old database, and register it for the new one.

Currently, here is the order of the steps happening in such scenario:

1. The zone.c:zone_startload() function registers the notify callback
   on the new database using dns_zone_catz_enable_db()
2. The callback, when called, notices that the new 'db' is different
   than 'catz->db', and unregisters the old callback for 'catz->db',
   marks that it's unregistered by setting 'catz->db_registered' to
   false, then it schedules an update if it isn't already scheduled.
3. The offloaded update process, after completing its job, notices that
   'catz->db_registered' is false, and (re)registers the update callback
   for the current database it is working on. There is no harm here even
   if it was registered also on step 1, and we can't skip it, because
   this function can also be called "artificially" during a
   reconfiguration, and in that case the registration step is required
   here.

A problem arises when before step 1 an update process was already
in a running state, operating on the old database, and finishing its
work only after step 2. As described in step 3, dns__catz_update_cb()
notices that 'catz->db_registered' is false and registers the callback
on the current database it is working on, which, at that state, is
already obsolete and unused by the zone. When it detaches the database,
the function which is responsible for its cleanup (e.g. free_rbtdb())
asserts because there is a registered update notify callback there.

To fix the problem, instead of delaying the (re)registration to step 3,
make sure that the new callback is registered and 'catz->db_registered'
is accordingly marked on step 2.
2023-06-13 12:58:13 +00:00
Tom Krizek
b94e500d3d Merge branch '4117-serve-stale-check' into 'main'
Avoid false positive in serve-stale system test check

Closes #4117

See merge request isc-projects/bind9!8026
2023-06-13 12:10:25 +00:00
Tom Krizek
dd7bcd2855 Avoid false positive in serve-stale system test check
The purpose of the check is to verify the server has survived the
previous barrage of queries. This is done by sending a query and
checking we get a NOERROR response back.

Previously, that query could've been affected by a servfail cache - the
server would return a SERVFAIL answer, thus failing the check, despite
being up and running. Use version.bind txt ch query to avoid the
interference of servfail cache.
2023-06-13 10:52:01 +02:00
Michal Nowak
c1879b54c3 Merge branch 'mnowak/set-up-version-and-release-notes-for-bind-9.19.15' into 'main'
Set up version and release notes for BIND 9.19.15

See merge request isc-projects/bind9!8021
2023-06-12 15:12:13 +00:00
Michal Nowak
a04301f936 Set up release notes for BIND 9.19.15 2023-06-12 16:12:40 +02:00
Michal Nowak
8f6e77aee9 Update BIND version to 9.19.15-dev 2023-06-12 16:12:27 +02:00
Arаm Sаrgsyаn
282c5605b6 Merge branch '4105-QryDropped-stats-counter-documentation-update' into 'main'
QryDropped stats counter documentation update

Closes #4105

See merge request isc-projects/bind9!8006
2023-06-07 14:00:50 +00:00
Aram Sargsyan
27c30fe8a4 QryDropped stats counter documentation update
Document which dropped queries are calculated by the QryDropped
statistics counter.
2023-06-07 13:06:58 +00:00
Michal Nowak
e15455f848 Merge branch 'mnowak/placeholder-for-issue-4055' into 'main'
Add CHANGES placeholder for [GL #4055]

See merge request isc-projects/bind9!8010
2023-06-07 11:42:58 +00:00
Michal Nowak
0856c08ae9 Add CHANGES placeholder for [GL #4055] 2023-06-07 13:39:12 +02:00
Michal Nowak
490b7bd352 Merge branch 'mnowak/placeholder-for-issue-4089' into 'main'
Add CHANGES placeholder for [GL #4089]

See merge request isc-projects/bind9!8009
2023-06-07 11:18:10 +00:00
Michal Nowak
a2b3c2a386 Add CHANGES placeholder for [GL #4089] 2023-06-07 13:07:51 +02:00
Michal Nowak
fd606a8ea8 Merge branch 'mnowak/placeholder-for-issue-3835' into 'main'
Add CHANGES placeholder for [GL #3835]

See merge request isc-projects/bind9!8008
2023-06-07 09:00:42 +00:00
Michal Nowak
e6ed763bf3 Add CHANGES placeholder for [GL #3835] 2023-06-07 10:47:37 +02:00
Ondřej Surý
5bca79da1a Merge branch '4115-fix-extra-dns_validator-detach' into 'main'
Fix extra detach when dns_validator create_fetch() detects deadlock

Closes #4115

See merge request isc-projects/bind9!8003
2023-06-06 17:34:22 +00:00
Ondřej Surý
1d03cac78a Add CHANGES note for [GL #4115] 2023-06-06 19:04:17 +02:00
Ondřej Surý
696506e164 Fix extra detach when dns_validator create_fetch() detects deadlock
When create_fetch() in the dns_validator unit detects deadlock, it
returns DNS_R_NOVALIDSIG, but it didn't attach to the validator.  The
other condition to returning result != ISC_R_SUCCESS would be error from
dns_resolver_createfetch().  The caller (in two places out of three)
would detect the error condition and always detach from the validator.

Move the dns_validator_detach() on dns_resolver_createfetch() error
condition to create_fetch() function and cleanup the extra detaches in
seek_dnskey() and get_dsset().
2023-06-06 19:04:17 +02:00
Ondřej Surý
fbab2dd45f Merge branch '4038-resize-send-buffers-to-avoid-excessive-memory-allocation' into 'main'
Use appropriately sized send buffers for DNS messages over TCP

Closes #4038

See merge request isc-projects/bind9!8004
2023-06-06 11:41:44 +00:00
Ondřej Surý
dff9a56f07 Merge branch 'ondrej/print-library-versions' into 'main'
Print the libuv, liburcu and OpenSSL versions from configure script

See merge request isc-projects/bind9!7998
2023-06-06 11:40:51 +00:00