Commit graph

12110 commits

Author SHA1 Message Date
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
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
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
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
Mark Andrews
00287db8ed Add examples of WALLET records
(cherry picked from commit 9b358e6e8b)
2024-09-25 12:07:52 +00:00
Mark Andrews
c6045acc41 Add the new record type WALLET (262)
This provides a mapping from a domain name to a cryptographic
currency wallet and is a clone of TXT.

(cherry picked from commit b919b9b4f3)
2024-09-25 12:07:52 +00:00
Aram Sargsyan
cc038054e1 Test 'rndc dumpdb' with an unwritable dump-file
Check that with a preexisting dump file without a write permission
no actual dump happens, and rndc returns an error result.

Also add a couple of missing entries in the cleaning script.

(cherry picked from commit 63bddd7192)
2024-09-25 09:11:49 +00:00
Aram Sargsyan
782a570052 Do not ignore named_server_dumpdb() result code
The named_server_dumpdb() function, which is called when a 'rndc dumpdb'
command is issued, returns a 'isc_result_t' result code and it has been
always ignored since its introduction in
eb8713ed94, where it was still called
ns_server_dumpdb(). The orignal reasoning is not preserved, but it could
have been also a simple copy-paste mistake, as there are commands, which
return 'void' and require manually setting 'result = ISC_R_SUCCESS;', as
it was done here. Anyway, named will now return the actual result, and
'rndc' will report an error, when the 'dumpdb' command fails.

(cherry picked from commit 8b866ba8a0)
2024-09-25 09:11:49 +00:00
Mark Andrews
2952f8339d Check read value in upforwd/ans4
The ans4 server wasn't shutting down cleanly sometimes.  Check that
read returns the expected value for the message length or exit read
loop.

(cherry picked from commit 21baad0a8f)
2024-09-24 07:29:29 +00:00
Michal Nowak
e7dd232320 Print correct udp/tcp function name in generic_query()
(cherry picked from commit 1c637e96d1)
2024-09-23 15:40:40 +00:00
Michal Nowak
69b116b788 Downgrade "timeout" and "attempts" arguments in shutdown
The shutdown system test sends queries when named is shutting down, not
in an attempt to get answers but to destabilize the server into a crash.
With isctest.query.udp() defaulting to try up to ten times with a
ten-second timeout to get a response we don't care about from a likely
terminated server, we make the test run much longer than needed because
of retries and long timeouts.

(cherry picked from commit 463ab2f3f5)
2024-09-23 15:40:39 +00:00
Aram Sargsyan
80dad234ba Add a statistics channel check in the forward system test
Check that the fix in the previous commit works and that the
'ServerQuota' counter in the statistics channel is still unset
after a SERVFAIL result in a 'forward only' zone.

(cherry picked from commit 81b3c5d908)
2024-09-16 09:31:38 +00:00
Mark Andrews
b33727a202 Remove 'statslock' from dnssec-signzone
Silence Coverity CID 468757 and 468767 (DATA RACE read not locked)
by converting dnssec-signzone to use atomics for statistics counters
rather than using a lock.  This should be marginally faster than
using the lock as well when statistics are requested.

(cherry picked from commit 473cbd4e87)
2024-09-16 02:52:38 +00:00
Michal Nowak
944fc02f83 Extract dns.rcode compatibility code to isctest.compat
(cherry picked from commit 8b55d0709d)
2024-09-12 11:17:52 +00:00
Michal Nowak
c8c8b36e44 Turn off deadline for wildcard tests
Tests that query BIND need much longer deadline to account for retries,
the default 200ms won't work.

(cherry picked from commit d2e0043ec3)
2024-09-12 11:17:52 +00:00
Michal Nowak
937d7f30eb Extract "custom" named instances support to isctest.run module
(cherry picked from commit 2cec1de43b)
2024-09-12 11:17:52 +00:00
Michal Nowak
531567b0a1 Rework query functions to retry by default
(cherry picked from commit 5929ba0f54)
2024-09-12 11:17:52 +00:00
Michal Nowak
555f42754e Replace dns.resolver module in system tests
(cherry picked from commit bfe338b965)
2024-09-12 11:17:52 +00:00
Mark Andrews
c52a9a5731 Only configure statistics-channels if supported
(cherry picked from commit d0c8c6d7ef)
2024-09-12 03:27:38 +00:00
Mark Andrews
b3c0eb9bac Don't create the HTTP server if libxml and libjson-c are unavailable
(cherry picked from commit 31650d9440)
2024-09-12 03:27:38 +00:00
Mark Andrews
592ca7dc19 Don't return the style sheet unless libxml2 is supported
If not statistics are available we don't want the style sheet
returned.

(cherry picked from commit ed81b3ae93)
2024-09-12 03:27:38 +00:00
Mark Andrews
bacc945989 Properly detect when libxml2 or json-c is not available
(cherry picked from commit 7de939609b)
2024-09-11 23:06:55 +00:00
JINMEI Tatuya
33dd3fbca2 allow IXFR-to-AXFR fallback on DNS_R_TOOMANYRECORDS
This change allows fallback from an IXFR failure to AXFR when the
reason is DNS_R_TOOMANYRECORDS. This is because this error condition
could be temporary only in an intermediate version of IXFR
transactions and it's possible that the latest version of the zone
doesn't have that condition. In such a case, the secondary would never
be able to update the zone (even if it could) without this fallback.

This fallback behavior is particularly useful with the recently
introduced max-records-per-type and max-types-per-name options:
the primary may not have these limitations and may temporarily
introduce "too many" records, breaking IXFR. If the primary side
subsequently deletes these records, this fallback will help recover
the zone transfer failure automatically; without it, the secondary
side would first need to increase the limit, which requires more
operational overhead and has its own adverse effect.

This change also fixes a minor glitch that DNS_R_TOOMANYRECORDS wasn't
logged in xfrin_fail.

(cherry picked from commit 7289090683)
2024-09-10 12:39:36 +00:00
Ondřej Surý
5255843f9b Follow the number of CPU set by taskset/cpuset
Administrators may wish to constrain the set of cores that BIND 9 runs
on via the 'taskset', 'cpuset' or 'numactl' programs (or equivalent on
other O/S), for example to achieve higher (or more stable) performance
by more closely associating threads with individual NIC rx queues. If
the admin has used taskset, it follows that BIND ought to
automatically use the given number of CPUs rather than the system wide
count.

Co-Authored-By: Ray Bellis <ray@isc.org>
(cherry picked from commit 5a2df8caf5)
2024-09-03 13:52:10 +00:00
Mark Andrews
b30bff7dee Return partial match when requested
Return partial match from dns_db_find/dns_db_find when requested
to short circuit the closest encloser discover process.  Most of the
time this will be the actual closest encloser but may not be when
there yet to be committed / cleaned up versions of the zone with
names below the actual closest encloser.

(cherry picked from commit d42ea08f16)
2024-08-29 21:40:16 +00:00
Evan Hunt
93729a294a Delay release of root privileges until after configuring controls
On systems where root access is needed to configure privileged
ports, we don't want to fully relinquish root privileges until
after the control channel (which typically runs on port 953) has
been established.

named_os_changeuser() now takes a boolean argument 'permanent'.
This allows us to switch the effective userid temporarily with
named_os_changeuser(false) and restore it with named_os_restoreuser(),
before permanently dropping privileges with named_os_changeuser(true).

(cherry picked from commit d57fa148af)
2024-08-29 18:11:58 +00:00
Michal Nowak
f3b54c6688 Bump max-recursion-queries to 100 in resolver system test
With max-recursion-queries set to 50 the resolver system test was
unstable in the "checking query resolution for a domain with a valid
glueless delegation chain" check as ns1 replied with SERVFAIL.

(cherry picked from commit 8e0244d300)
2024-08-29 14:41:48 +00:00
Mark Andrews
20632b9f44 Add bad dnssec-policy range variants test examples
(cherry picked from commit bb653d37e0)
2024-08-23 08:05:16 +10:00
Mark Andrews
fab6d0e021 Add a multi-signer where the key tag range changes
(cherry picked from commit 62469afe71)
2024-08-23 08:05:16 +10:00
Mark Andrews
3ec77a2f92 Use key tag ranges when generating multisigner keys
(cherry picked from commit 266530d473)
2024-08-23 08:05:16 +10:00
Mark Andrews
6e51d5b04b Check that dnssec-keygen honours key tag ranges
(cherry picked from commit d165466125)
2024-08-23 08:05:16 +10:00
Mark Andrews
4c980c2a51 Add good dnssec-policy tag-range variants test examples
(cherry picked from commit e7decd7a65)
2024-08-23 08:05:16 +10:00
Mark Andrews
e3dedfb981 Add optional range directive to keys in dnssec-policy
(cherry picked from commit c5bc0a1805)
2024-08-23 08:05:16 +10:00
Mark Andrews
57c7c5452a Document -M tag_min:tag_max
A new argument has been added to dnssec-keygen and dnssec-keyfromlabel
to restrict the tag value of key generated / imported to a particular
range.  This is intended to be used by multi-signers.

Co-authored-by: Suzanne Goldlust <sgoldlust@isc.org>
(cherry picked from commit 0c347fb321)
2024-08-23 07:44:11 +10:00
Mark Andrews
79f9a10eb6 Add restrict key tag range support
to dnssec-keygen and dnssec-keyfromlabel.

(cherry picked from commit 329e5eee9b)
2024-08-23 07:42:21 +10:00
Matthijs Mekking
b7bc6abdfe Adjust kasp system test to get keys which signed
If there is a keytag conflict between keys with different algorithms,
we need to supply what key algorithm is used so we can get the right
public key.

For clarity, print the algorithm on the found keys after 'check_keys'.

(cherry picked from commit 7bb6d82505)
2024-08-22 12:58:00 +00:00
Matthijs Mekking
f516e461fd Implement SKR import
When 'rndc skr import' is called, read the file contents and store the
data in the zone's skr structure.

(cherry picked from commit 037382c4a5)
2024-08-22 10:17:08 +00:00
Matthijs Mekking
908bf753f9 Test rndc skr import
Test importing a Signed Key Response. Files should be loaded and once
loaded the correct bundle should be used. Alsoe test cases where the
bundle is not the first bundle in the SKR.

(cherry picked from commit afe093258c)
2024-08-22 10:17:08 +00:00
Matthijs Mekking
0fd246ac26 Add option to kasp.sh check_keys to retain found keys
This will come in handy when we are testing offline-ksk where first
we check for ZSKs and then the KSK.

(cherry picked from commit ecd2b79106)
2024-08-22 10:17:08 +00:00
Matthijs Mekking
07de3d8466 Implement dummy 'rndc skr -import' command
Add the code and documentation required to provide KSR import using
rndc.  This is just the command, and the feature is at this point in
time still not implemented.

(cherry picked from commit edbb219fda)
2024-08-22 10:17:08 +00:00
Matthijs Mekking
1813b7877c Add a common setup script for ksr
The previous setup.sh has been moved to ns1/setup.sh, we need a common
setup script to invoke ns1/setup.sh.

(cherry picked from commit 748d98e387)
2024-08-22 10:17:08 +00:00
Matthijs Mekking
ad7366853e Update ksr system test to include server
Prepare the system test for tests that require a server to import
created SKR files. This means the test script needs adjustments to
take into account the directory test files are located.

In addition, the check_keys function is renamed to ksr_check_keys
because the name clashes with check_keys from kasp.sh. It also has an
extra parameter added, offset, that can be used to check ksr files that
are created in the past or future.

(cherry picked from commit 367154c1de)
2024-08-22 10:17:08 +00:00
Matthijs Mekking
40bd74b182 Add offline-ksk option
Add a new configuration option to enable Offline KSK key management.

Offline KSK cannot work with CSK because it splits how keys with the
KSK and ZSK role operate. Therefore, one key cannot have both roles.
Add a configuration check to ensure this.

(cherry picked from commit 0598381236)
2024-08-22 10:17:08 +00:00
Ondřej Surý
46069fe5c7 Use clang-format-19 to update formatting
This is purely result of running:

    git-clang-format-19 --binary clang-format-19 origin/main

(cherry picked from commit 7b756350f5)
2024-08-22 08:16:03 +00:00
Nicki Křížek
ac11357466 Merge tag 'v9.20.1' into bind-9.20 2024-08-21 16:32:33 +02:00
Aram Sargsyan
3fc322f07c Print the full path of the working directory in startup log messages
named now prints its initial working directory during startup and the
changed working directory when loading or reloading its configuration
file if it has a valid 'directory' option defined.

(cherry picked from commit fd8e1d161f)
2024-08-21 08:23:48 +00:00
Ondřej Surý
1a657766c3 Use seteuid()/setegid() instead of setreseuid()/setresgid()
It looks like that all supported systems now have support for
_POSIX_SAVED_IDS, so it's safe to use setegid() and setegid() because
those will not change saved used/group IDs.

(cherry picked from commit ab517fc6e4)
2024-08-20 17:36:27 +00:00