Commit Graph
36903 Commits
Author SHA1 Message Date
Matthijs Mekking be33035f26 Merge branch 'matthijs-fix-dnssec-signing-log-lovel-v9_18' into 'v9_18'
[v9_18] Change log level when doing rekey

See merge request isc-projects/bind9!6939
2022-10-20 08:20:49 +00:00
Matthijs Mekking 6af9d0088b Change log level when doing rekey
This log happens when BIND checks the parental-agents if the DS has
been published. But if you don't have parental-agents set up, the list
of keys to check will be empty and the result will be ISC_R_NOTFOUND.
This is not an error, so change the log level to debug in this case.

(cherry picked from commit a1d57fc8cb)
2022-10-20 10:20:14 +02:00
Evan Hunt 8138ab4611 Merge branch '3247-rpz-ip-cd-v9_18' into 'v9_18'
ensure RPZ lookups handle CD=1 correctly

See merge request isc-projects/bind9!6957
2022-10-19 20:38:34 +00:00
Evan Hunt 777aa045fc CHANGES for [GL #3247]
(cherry picked from commit 3676f6394b)
2022-10-19 13:12:52 -07:00
Evan Hunt 5c44d63979 add a test with CD=1 query for pending data
this is a regression test for [GL #3247].

(cherry picked from commit 575a924b1a)
2022-10-19 13:12:32 -07:00
Evan Hunt 2cc8874c90 ensure RPZ lookups handle CD=1 correctly
RPZ rewrites called dns_db_findext() without passing through the
client database options; as as result, if the client set CD=1,
DNS_DBFIND_PENDINGOK was not used as it should have been, and
cache lookups failed, resulting in failure of the rewrite.

(cherry picked from commit 305a50dbe1)
2022-10-19 13:12:31 -07:00
Tom Krizek ff5823fa12 Merge branch 'tkrizek/system-tests-fixes-v9_18' into 'v9_18'
Update various system tests and add them to default test suite [v9_18]

See merge request isc-projects/bind9!6949
2022-10-19 14:58:13 +00:00
Tom Krizek ba7ea2dfac Remove generated controls.conf file from system tests
The controls.conf file shouldn't be used directly without templating it
first. Remove this no longer used hard-coded file to avoid confusion.

(cherry picked from commit cbd0355328)
2022-10-19 15:32:46 +02:00
Tom Krizek 5db5f20985 Revive dupsigs system test
Correctly source conf.sh in dupsigs test scripts (fix issue introduced
by 093af1c00a).

Update dupsigs test for dnssec-dnskey-kskonly default. Since v9.17.20,
the dnssec-dnskey-kskonly is set to yes. Update the test to not expect
the additional RRSIG with ZSK for DNSKEY.

Speed up the test from 20 minutes to 2.5 minutes and make it part of the
default test suite executed in CI.
- decrease number of records to sign from 2000 to 500
- decrease the signing interval by a factor of 6
- shorten the final part of the test after last signing (since nothing
  new happens there)

Finally, clarify misleading comments about (in)sufficient time for zone
re-signing. The time used in the test is in fact sufficient for the
re-signing to happen. If it wasn't, the previous ZSK would end up being
deleted while its signatures would still be present, which is a
situation where duplicate signatures can still happen.

(cherry picked from commit cb0a2ae1dd)
2022-10-19 15:32:44 +02:00
Tom Krizek ef0eadf864 Revive the stress system test
Ensure the port numbers are dynamically filled in with copy_setports.

Clarify test fail condition.

Make the stress test part of the default test suite since it doesn't
seem to run too long or interfere with other tests any more (the
original note claiming so is more than 20 years old).

Related !6883

(cherry picked from commit 7495deea3e)
2022-10-19 15:32:44 +02:00
Tom Krizek bd8262dc35 Revive dialup system test
Properly template the port number in config files with copy_setports.

The test takes two minutes on my machine which doesn't seem like a
proper justification to exclude it from the test suite, especially
considering we run these tests in parallel nowadays. The resource usage
doesn't seems significantly increased so it shouldn't interfere with
other system tests.

There also exists a precedent for longer running system tests that are
already part of the default system test suite (e.g. serve-stale takes
almost three minutes on the same machine).

(cherry picked from commit 235ae5f344)
2022-10-19 15:32:44 +02:00
Tom Krizek 25d2d7e46e Make digdelv test work in different network envs
When a target server is unreachable, the varying network conditions may
cause different ICMP message (or no message). The host unreachable
message was discovered when attempting to run the test locally while
connected to a VPN network which handles all traffic.

Extend the dig output check with "host unreachable" message to avoid a
false negative test result in certain network environments.

(cherry picked from commit 1e7d832342)
2022-10-19 15:32:44 +02:00
Ondřej Surý 10a43eba02 Merge branch '3270-remove-time-requirement-for-statschannel-truncated-test-v9_18' into 'v9_18'
Remove the time requirement for the statschannel truncated test [v9.18]

See merge request isc-projects/bind9!6953
2022-10-19 13:31:23 +00:00
Ondřej Surý 6261ada8c2 Remove the time requirement for the statschannel truncated test
The 5 seconds requirement to finish the 'pipelined with truncated
stream' was causing spurious failures in the CI because the job runners
might be very busy and sending 128k of data might simply take some time.

Remove the time requirement altogether, there's actually no reason why
the test SHOULD or even MUST finish under 5 seconds.

(cherry picked from commit 0f56a53d66)
2022-10-19 15:30:44 +02:00
Michal Nowak 6a3d92a98c Merge branch '3394-cve-2022-2795-test-v9_18' into 'v9_18'
[v9_18] Add tests for CVE-2022-2795

See merge request isc-projects/bind9!6948
2022-10-19 13:05:22 +00:00
Michał KępieńandMichal Nowak 9c2714e27f Add tests for CVE-2022-2795
Add a test ensuring that the amount of work fctx_getaddresses() performs
for any encountered delegation is limited: delegate example.net to a set
of 1,000 name servers in the redirect.com zone, the names of which all
resolve to IP addresses that nothing listens on, and query for a name in
the example.net domain, checking the number of times the findname()
function gets executed in the process; fail if that count is excessively
large.

Since the size of the referral response sent by ans3 is about 20 kB, it
cannot be sent back over UDP (EMSGSIZE) on some operating systems in
their default configuration (e.g. FreeBSD - see the
net.inet.udp.maxdgram sysctl).  To enable reliable reproduction of
CVE-2022-2795 (retry patterns vary across BIND 9 versions) and avoid
false positives at the same time (thread scheduling - and therefore the
number of fetch context restarts - vary across operating systems and
across test runs), extend bin/tests/system/resolver/ans3/ans.pl so that
it also listens on TCP and make "ns1" in the "resolver" system test
always use TCP when communicating with "ans3".

Also add a test (foo.bar.sub.tld1/TXT) that ensures the new limitations
imposed on the resolution process by the mitigation for CVE-2022-2795 do
not prevent valid, glueless delegation chains from working properly.

(cherry picked from commit 604d8f0b96)
2022-10-19 12:36:20 +02:00
Michal Nowak 09ea1f9b3b Merge branch '3493-compression-buffer-reuse-test-v9_18' into 'v9_18'
[CVE-2022-2881] test for growth of compressed pipelined responses

See merge request isc-projects/bind9!6941
2022-10-19 08:19:06 +00:00
Evan HuntandMichal Nowak b42dfd01f1 test for growth of compressed pipelined responses
add a test to compare the Content-Length of successive compressed
messages on a single HTTP connection that should contain the same
data; fail if the size grows by more than 100 bytes from one query
to the next.

(cherry picked from commit 3c11fafadf)
2022-10-18 17:28:45 +02:00
Artem Boldariev 49c8d04c65 Merge branch 'artem-sync-multilayer-stoplistening-v9-18' into 'v9_18'
Backport to v9.18] Synchronise stop listening operation for multi-layer transports

See merge request isc-projects/bind9!6932
2022-10-18 14:24:24 +00:00
Artem Boldariev a6f14565b4 TLS Stream: handle successful TLS handshake after listener shutdown
It was possible that accept callback can be called after listener
shutdown. In such a case the callback pointer equals NULL, leading to
segmentation fault. This commit fixes that.
2022-10-18 16:40:08 +03:00
Artem Boldariev c62994e6a4 Synchronise stop listening operation for multi-layer transports
This commit introduces a primitive isc__nmsocket_stop() which performs
shutting down on a multilayered socket ensuring the proper order of
the operations.

The shared data within the socket object can be destroyed after the
call completed, as it is guaranteed to not be used from within the
context of other worker threads.

(cherry picked from commit 5ab2c0ebb3)
2022-10-18 16:40:08 +03:00
Petr Špaček 7a992cb948 Merge branch 'pspacek/ci-no-developer-mode-v9_18' into 'v9_18'
Add CI job with --disable-developer [v9_18]

See merge request isc-projects/bind9!6931
2022-10-18 13:15:49 +00:00
Petr Špaček 9a132f9e2b Allow system tests to run under root user when inside CI
https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
says variable CI_SERVER="yes" is available in all versions of Gitlab.

(cherry picked from commit ddf46056ca)
2022-10-18 15:14:54 +02:00
Petr Špaček 4f4556941c Build gcc:oraclelinux9:amd64 CI jobs with --disable-developer
Purpose of this is to guard against tests which rely on querytrace or
other optional features enabled by --enable-developer switch.

(cherry picked from commit d6db5c5335)
2022-10-18 15:14:54 +02:00
Ondřej Surý bc1acfdccb Merge branch 'ondrej-add-ISC_LIST,LINK_INITIALIZER-v9_18' into 'v9_18'
Add ISC_{LIST,LINK}_INITIALIZER for designated initializers [v9.18]

See merge request isc-projects/bind9!6934
2022-10-18 12:56:42 +00:00
Ondřej Surý 6525ebc777 Replace (void *)-1 with ISC_LINK_TOMBSTONE
Instead of having "arbitrary" (void *)-1 to define non-linked, add a
ISC_LINK_TOMBSTONE(type) macro that replaces the "magic" value with a
define.

(cherry picked from commit 5e20c2ccfb)
2022-10-18 14:30:43 +02:00
Ondřej Surý 8efe60d423 Add ISC_{LIST,LINK}_INITIALIZER for designated initializers
Since we are using designated initializers, we were missing initializers
for ISC_LIST and ISC_LINK, add them, so you can do

    *foo = (foo_t){ .list = ISC_LIST_INITIALIZER };

Instead of:

    *foo = (foo_t){ 0 };
    ISC_LIST_INIT(foo->list);

(cherry picked from commit cb3c36b8bf)
2022-10-18 14:30:43 +02:00
Arаm Sаrgsyаn c6270cefb2 Merge branch '3584-ns_statscounter_recursclients-bug-v9_18' into 'v9_18'
[v9_18] Fix ns_statscounter_recursclients counting bug

See merge request isc-projects/bind9!6876
2022-10-18 10:36:55 +00:00
Aram Sargsyan d83642b3ac Add a release note for [GL #3584] 2022-10-18 08:54:20 +00:00
Aram Sargsyan 5b1ef41897 Add a CHANGES note for [GL #3584] 2022-10-18 08:54:11 +00:00
Aram Sargsyan 82991451b4 Fix ns_statscounter_recursclients counting bug
The incrementing and decrementing of 'ns_statscounter_recursclients'
were not properly balanced: for example, it would be incremented for
a prefetch query but not decremented if the query failed.

This commit ensures that the recursion quota and the recursive clients
counter are always in sync with each other.
2022-10-18 08:54:04 +00:00
Petr Špaček 954ce9fcff Merge branch 'pspacek/doc-nsupdate-server-gsstsig-v9_18' into 'v9_18'
Document that nsupdate ignores server command in GSS-TSIG mode [v9_18]

See merge request isc-projects/bind9!6925
2022-10-18 08:17:15 +00:00
Petr Špaček dbb7856038 Document that nsupdate ignores server command in GSS-TSIG mode
This behavior is present since introduction of GSS-TSIG support,
commit 289ae548d5.

(cherry picked from commit c8a38d70f0)
2022-10-18 10:13:30 +02:00
Tony Finch 684b5e536d Merge branch 'fanf-deduplicate-file-line-v9_18' into 'v9_18'
De-duplicate __FILE__, __LINE__ plus some error reporting cleanup (backport to v9_18)

See merge request isc-projects/bind9!6922
2022-10-17 17:27:04 +00:00
Tony Finch 6adb0c32ea CHANGES for [GL !6914]
[cleanup]	Less ceremonial UNEXPECTED_ERROR() and FATAL_ERROR()
		reporting macros. [GL !6914]

(cherry picked from commit 2ffb582d2c)
2022-10-17 16:08:28 +01:00
Tony FinchandTony Finch b48c73d802 Remove redundant #include <isc/strerr.h>
Most uses are now internal to <isc/util.h>
2022-10-17 16:08:28 +01:00
Tony Finch 96b6bae5bc Include the function name when reporting unexpected errors
I.e. print the name of the function in BIND that called the system
function that returned an error. Since it was useful for pthreads
code, it seems worthwhile doing so everywhere.

(cherry picked from commit 26ed03a61e)
2022-10-17 16:00:27 +01:00
Tony Finch 8dfc078ea3 De-duplicate some calls to strerror_r()
Specifically, when reporting an unexpected or fatal error.

(cherry picked from commit a34a2784b1)
2022-10-17 16:00:27 +01:00
Tony Finch f273fdfc12 De-duplicate __FILE__, __LINE__
Mostly generated automatically with the following semantic patch,
except where coccinelle was confused by #ifdef in lib/isc/net.c

@@ expression list args; @@
- UNEXPECTED_ERROR(__FILE__, __LINE__, args)
+ UNEXPECTED_ERROR(args)
@@ expression list args; @@
- FATAL_ERROR(__FILE__, __LINE__, args)
+ FATAL_ERROR(args)

(cherry picked from commit ec50c58f52)
2022-10-17 16:00:26 +01:00
Arаm Sаrgsyаn 79a7fb6cb5 Merge branch 'aram/cfg_print_duration-uninitialized-length-v9_18' into 'v9_18'
[v9_18] Fix a logical bug in cfg_print_duration()

See merge request isc-projects/bind9!6920
2022-10-17 09:56:59 +00:00
Aram Sargsyan 24aa154b67 Handle large numbers when parsing/printing a duration
The isccfg_duration_fromtext() function is truncating large numbers
to 32 bits instead of capping or rejecting them, i.e. 64424509445,
which is 0xf00000005, gets parsed as 32-bit value 5 (0x00000005).

Fail parsing a duration if any of its components is bigger than
32 bits. Using those kind of big numbers has no practical use case
for a duration.

The isccfg_duration_toseconds() function can overflow the 32 bit
seconds variable when calculating the duration from its component
parts.

To avoid that, use 64-bit calculation and return UINT32_MAX if the
calculated value is bigger than UINT32_MAX. Again, a number this big
has no practical use case anyway.

The buffer for the generated duration string is limited to 64 bytes,
which, in theory, is smaller than the longest possible generated
duration string.

Use 80 bytes instead, calculated by the '7 x (10 + 1) + 3' formula,
where '7' is the count of the duration's parts (year, month, etc.), '10'
is their maximum length when printed as a decimal number, '1' is their
indicator character (Y, M, etc.), and 3 is two more indicators (P and T)
and the terminating NUL character.

(cherry picked from commit fddaebb285)
2022-10-17 08:54:10 +00:00
Aram Sargsyan 9a318fbc1e Add a CHANGES note for [GL !6880]
(cherry picked from commit 190aab84d7)
2022-10-17 08:53:49 +00:00
Aram Sargsyan e3fa77f577 Fix an off-by-one error in cfg_print_duration()
The cfg_print_duration() checks added previously in the 'duration_test'
unit test uncovered a bug in cfg_print_duration().

When calculating the current 'str' pointer of the generated text in the
buffer 'buf', it erroneously adds 1 byte to compensate for that part's
indicator character. For example, to add 12 minutes, it needs to add
2 + 1 = 3 characters, where 2 is the length of "12", and 1 is the length
of "M" (for minute). The mistake was that the length of the indicator
is already included in 'durationlen[i]', so there is no need to
calculate it again.

In the result of this mistake the current pointer can advance further
than needed and end up after the zero-byte instead of right on it, which
essentially cuts off any further generated text. For example, for a
5 minutes and 30 seconds duration, instead of having this:

    'P', 'T', '5', 'M', '3', '0', 'S', '\0'

The function generates this:

    'P', 'T', '5', 'M', '\0', '3', '0', 'S', '\0'

Fix the bug by adding to 'str' just 'durationlen[i]' instead of
'durationlen[i] + 1'.

(cherry picked from commit dc55f1ebb9)
2022-10-17 08:52:33 +00:00
Aram Sargsyan 98481e0a0a Test cfg_print_duration() in duration_test.c
Currently the 'duration_test' unit test checks only the
cfg_obj_asduration() function.

Extend the test so it checks also the reverse operation using the
cfg_print_duration() function, which is used in named-checkconf.

(cherry picked from commit 39290bb7cd)
2022-10-17 08:52:26 +00:00
Aram Sargsyan b6978ccbe3 Fix a logical bug in cfg_print_duration()
The cfg_print_duration() function prints a ISO 8601 duration value
converted from an array of integers, where the parts of the date and
time are stored.

durationlen[6], which holds the "seconds" part of the duration, has
a special case in cfg_print_duration() to ensure that when there are
no values in the duration, the result still can be printed as "PT0S",
instead of just "P", so it can be a valid ISO 8601 duration value.

There is a logical error in one of the two special case code paths,
when it checks that no value from the "date" part is defined, and no
"hour" or "minute" from the "time" part are defined.

Because of the error, durationlen[6] can be used uninitialized, in
which case the second parameter passed to snprintf() (which is the
maximum allowed length) can contain a garbage value.

This can not be exploited because the buffer is still big enough to
hold the maximum possible amount of characters generated by the "%u%c"
format string.

Fix the logical bug, and initialize the 'durationlen' array to zeros
to be a little safer from other similar errors.

(cherry picked from commit 9440910187)
2022-10-17 08:52:20 +00:00
Ondřej Surý e33fdd5c05 Merge branch 'mnowak/fix-grep-3.8-warnings-v9_18' into 'v9_18'
Fix GNU Grep 3.8 warnings [v9_18]

See merge request isc-projects/bind9!6918
2022-10-17 07:56:21 +00:00
Michal NowakandOndřej Surý 1751a9e191 Add CI check for Grep warnings
(cherry picked from commit 759e8a6671)
2022-10-17 09:10:29 +02:00
Michal NowakandOndřej Surý a7e2cc5dec Replace fgrep and egrep with grep -F/-E
GNU Grep 3.8 reports the following warnings:

    egrep: warning: egrep is obsolescent; using grep -E
    fgrep: warning: fgrep is obsolescent; using grep -F

(cherry picked from commit 212c4de043)
2022-10-17 09:10:29 +02:00
Michal NowakandOndřej Surý 55a866355b Remove stray backslashes
GNU Grep 3.8 reports several instances of stray backslashes in matching
patterns:

    grep: warning: stray \ before /
    grep: warning: stray \ before :

(cherry picked from commit 65e91ef5e6)
2022-10-17 09:10:29 +02:00
Tom Krizek da566ca54c Merge branch 'tkrizek/remove-system-test-delzone-v9_18' into 'v9_18'
Remove system test delzone [v9_18]

See merge request isc-projects/bind9!6911
2022-10-14 15:16:34 +00:00