Commit Graph

37378 Commits

Author SHA1 Message Date
Ondřej Surý
afd1908aa3 Merge branch '3270-use-curl-in-statschannel-system-test' into 'main'
Replace raw nc usage in statschannel system test with curl

Closes #3270

See merge request isc-projects/bind9!6946
2022-10-20 12:00:54 +00:00
Ondřej Surý
cd0e5c5784 Replace some raw nc usage in statschannel system test with curl
For tests where the TCP connection might get interrupted abruptly,
replace the nc with curl as the data sent from server to client might
get lost because of abrupt TCP connection.  This happens when the TCP
connection gets closed during sending the large request to the server.

As we already require curl for other system tests, replace the nc usage
in the statschannel test with curl that actually understands the
HTTP/1.1 protocol, so the same connection is reused for sending the
consequtive requests, but without client-side "pipelining".

For the record, the server doesn't support parallel processing of the
pipelined request, so it's a bit misnomer here, because what we are
actually testing is that we process all requests received in a single
TCP read callback.
2022-10-20 12:23:34 +02:00
Michal Nowak
97b9a7eb56 Merge tag 'v9_19_6'
BIND 9.19.6
2022-10-20 11:01:27 +02:00
Evan Hunt
6c8bc44bc4 Merge branch '3247-rpz-ip-cd' into 'main'
ensure RPZ lookups handle CD=1 correctly

Closes #3247

See merge request isc-projects/bind9!6944
2022-10-19 20:11:26 +00:00
Evan Hunt
3676f6394b CHANGES for [GL #3247] 2022-10-19 11:36:11 -07:00
Evan Hunt
575a924b1a add a test with CD=1 query for pending data
this is a regression test for [GL #3247].
2022-10-19 11:36:11 -07:00
Evan Hunt
305a50dbe1 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.
2022-10-19 11:36:11 -07:00
Ondřej Surý
0bcff38391 Merge branch '3270-serialize-statschannel-http-requests' into 'main'
Serialize the HTTP/1.1 statschannel requests

Closes #3270

See merge request isc-projects/bind9!6954
2022-10-19 12:47:06 +00:00
Ondřej Surý
13959781cb Serialize the HTTP/1.1 statschannel requests
The statschannel truncated test still terminates abruptly sometimes and
it doesn't return the answer for the first query.  This might happen
when the second process_request() discovers there's not enough space
before the sending is complete and the connection is terminated before
the client gets the data.

Change the isc_http, so it pauses the reading when it receives the data
and resumes it only after the sending has completed or there's
incomplete request waiting for more data.

This makes the request processing slightly less efficient, but also less
taxing for the server, because previously all requests that has been
received via single TCP read would be processed in the loop and the
sends would be queued after the read callback has processed a full
buffer.
2022-10-19 14:45:36 +02:00
Ondřej Surý
edb0e756bc Merge branch '3612-fix-mem-functions-with-openssl-1.0.2' into 'main'
Fix the non-developer build with OpenSSL 1.0.2

Closes #3612

See merge request isc-projects/bind9!6952
2022-10-19 12:42:20 +00:00
Ondřej Surý
dfaae53b9a Fix the non-developer build with OpenSSL 1.0.2
In non-developer build, a wrong condition prevented the
isc__tls_malloc_ex, isc__tls_realloc_ex and isc__tls_free_ex to be
defined.  This was causing FTBFS on platforms with OpenSSL 1.0.2.
2022-10-19 14:41:10 +02:00
Ondřej Surý
a08a84695a Merge branch '3270-remove-time-requirement-for-statschannel-truncated-test' into 'main'
Remove the time requirement for the statschannel truncated test

Closes #3270

See merge request isc-projects/bind9!6951
2022-10-19 12:35:38 +00:00
Ondřej Surý
0f56a53d66 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.
2022-10-19 14:08:24 +02:00
Tom Krizek
a8c1ac7f92 Merge branch 'tkrizek/system-tests-fixes' into 'main'
Update various system tests and add them to default test suite

See merge request isc-projects/bind9!6942
2022-10-19 11:01:26 +00:00
Tom Krizek
cbd0355328 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.
2022-10-19 12:59:27 +02:00
Tom Krizek
cb0a2ae1dd 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.
2022-10-19 12:59:27 +02:00
Tom Krizek
7495deea3e 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
2022-10-19 12:59:27 +02:00
Tom Krizek
235ae5f344 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).
2022-10-19 12:59:27 +02:00
Tom Krizek
1e7d832342 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.
2022-10-19 12:59:25 +02:00
Michal Nowak
3d968b4a4c Merge branch '3394-cve-2022-2795-test' into 'main'
Add tests for CVE-2022-2795

Closes #3394

See merge request isc-projects/bind9!6945
2022-10-19 10:31:56 +00:00
Michał Kępień
604d8f0b96 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.
2022-10-19 11:53:08 +02:00
Artem Boldariev
64287e4889 Merge branch 'artem-tls-listener-shutdown-accept-crash-fix' into 'main'
[Backport] TLS Stream: handle successful TLS handshake after listener shutdown

See merge request isc-projects/bind9!6938
2022-10-18 15:58:14 +00:00
Artem Boldariev
09dcc914b4 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 18:30:24 +03:00
Michal Nowak
9b8a72735b Merge branch '3493-compression-buffer-reuse-test' into 'main'
[CVE-2022-2881] test for growth of compressed pipelined responses

See merge request isc-projects/bind9!6933
2022-10-18 15:18:54 +00:00
Evan Hunt
3c11fafadf 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.
2022-10-18 17:16:00 +02:00
Matthijs Mekking
c05034b906 Merge branch 'matthijs-fix-dnssec-signing-log-lovel' into 'main'
Change log level when doing rekey

See merge request isc-projects/bind9!6913
2022-10-18 14:25:19 +00:00
Matthijs Mekking
a1d57fc8cb 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.
2022-10-18 16:23:35 +02:00
Petr Špaček
b43f0e0674 Merge branch 'pspacek/cookie-test-no-developer-fixup' into 'main'
Fix cookie system test for builds without --enable-developer

See merge request isc-projects/bind9!6904
2022-10-18 12:22:34 +00:00
Petr Špaček
c3e7bed1ab Fix cookie system test for builds without --enable-developer
The "connecting via TCP" message comes from FCTXTRACE which is not
available on some builds.
2022-10-18 13:54:45 +02:00
Petr Špaček
f2ed208db9 Merge branch 'pspacek/ci-no-developer-mode' into 'main'
Add CI job with --disable-developer

See merge request isc-projects/bind9!6930
2022-10-18 11:51:23 +00:00
Petr Špaček
ddf46056ca 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.
2022-10-18 13:30:16 +02:00
Petr Špaček
d6db5c5335 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.
2022-10-18 13:30:15 +02:00
Ondřej Surý
5e3e76eda9 Merge branch 'ondrej-add-ISC_LIST,LINK_INITIALIZER' into 'main'
Add ISC_{LIST,LINK}_INITIALIZER for designated initializers

See merge request isc-projects/bind9!6928
2022-10-18 11:18:04 +00:00
Ondřej Surý
5e20c2ccfb 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.
2022-10-18 11:36:15 +02:00
Ondřej Surý
cb3c36b8bf 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);
2022-10-18 11:36:15 +02:00
Artem Boldariev
aaa50c5101 Merge branch 'artem-sync-multilayer-stoplistening' into 'main'
Synchronise stop listening operation for multi-layer transports

Closes #3606

See merge request isc-projects/bind9!6917
2022-10-18 09:32:25 +00:00
Artem Boldariev
5ab2c0ebb3 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.
2022-10-18 12:06:00 +03:00
Arаm Sаrgsyаn
55a184c13f Merge branch '3584-placeholder' into 'main'
Add a CHANGES placeholder for [GL #3584]

See merge request isc-projects/bind9!6927
2022-10-18 08:51:46 +00:00
Aram Sargsyan
5d5b3f9d27 Add a CHANGES placeholder for [GL #3584] 2022-10-18 08:28:53 +00:00
Petr Špaček
ad3270b1ee Merge branch 'pspacek/doc-nsupdate-server-gsstsig' into 'main'
Document that nsupdate ignores server command in GSS-TSIG mode

See merge request isc-projects/bind9!6878
2022-10-18 08:12:47 +00:00
Petr Špaček
c8a38d70f0 Document that nsupdate ignores server command in GSS-TSIG mode
This behavior is present since introduction of GSS-TSIG support,
commit 289ae548d5.
2022-10-18 10:12:02 +02:00
Tony Finch
3b285ee9ad Merge branch 'fanf-deduplicate-file-line' into 'main'
De-duplicate __FILE__, __LINE__ plus some error reporting cleanup

See merge request isc-projects/bind9!6914
2022-10-17 13:17:57 +00:00
Tony Finch
2ffb582d2c CHANGES for [GL !6914]
[cleanup]	Less ceremonial UNEXPECTED_ERROR() and FATAL_ERROR()
		reporting macros. [GL !6914]
2022-10-17 13:43:59 +01:00
Tony Finch
26ed03a61e 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.
2022-10-17 13:43:59 +01:00
Tony Finch
a34a2784b1 De-duplicate some calls to strerror_r()
Specifically, when reporting an unexpected or fatal error.
2022-10-17 11:58:26 +01:00
Tony Finch
ec50c58f52 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)
2022-10-17 11:58:26 +01:00
Arаm Sаrgsyаn
cf230dea7a Merge branch 'aram/cfg_print_duration-uninitialized-length' into 'main'
Fix a logical bug in cfg_print_duration()

See merge request isc-projects/bind9!6880
2022-10-17 09:15:13 +00:00
Aram Sargsyan
fddaebb285 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.
2022-10-17 08:45:45 +00:00
Aram Sargsyan
190aab84d7 Add a CHANGES note for [GL !6880] 2022-10-17 08:45:34 +00:00
Aram Sargsyan
dc55f1ebb9 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'.
2022-10-17 08:45:26 +00:00