Commit Graph

11467 Commits

Author SHA1 Message Date
Evan Hunt
dd88a4cdfc reduce MAX_RESTARTS to 11
the number of steps that can be followed in a CNAME chain
before terminating the lookup has been reduced from 16 to 11.
(this is a hard-coded value, but will be made configurable later.)

(cherry picked from commit 05d78671bb)
2024-08-07 15:36:14 -07:00
Nicki Křížek
fc87a96e07 Make hypothesis optional for system tests
Ensure that system tests can be executed without Python hypothesis
package.

(cherry picked from commit e6a7695600)
2024-08-07 11:00:24 +00:00
Ondřej Surý
236de53c52 Use EXIT_SUCCESS and EXIT_FAILURE
Instead of randomly using -1 or 1 as a failure status, properly utilize
the EXIT_FAILURE define that's platform specific (as it should be).

(cherry picked from commit76997983fde02d9c32aa23bda30b65f1ebd4178c)
2024-08-06 15:19:06 +02:00
Ondřej Surý
1a82a85266 Use _exit() in the fatal() function
Since the fatal() isn't a correct but rather abrupt termination of the
program, we want to skip the various atexit() calls because not all
memory might be freed during fatal() call, etc.  Using _exit() instead
of exit() has this effect - the program will end, but no destructors or
atexit routines will be called.

(cherry picked from commit 4bec711fe3)
2024-08-06 14:52:24 +02:00
Ondřej Surý
e494854523 Use LC_ALL to override all system locales
The system tests were overriding the local locale by setting LANG to C.
This does not override the locale in case there are individual LC_<*>
variables like LC_CTYPE explicitly set.

Use LC_ALL=C instead which is the proper way of overriding all currently
set locales.
2024-08-05 09:42:50 +02:00
Yedaya Katsman
1b45e64d3f Remove newlines from dighost errors calls
Not all invocations had it, and this makes it more consistent with
dighost_warning. Also remove the conditional newline when not outputting
yaml

(cherry picked from commit 1dd76fe780)
2024-08-05 03:40:41 +00:00
Yedaya Katsman
87cb888a2d Remove extra newline from +yaml output
The newlines weren't needed for the yaml syntax, and took up space.

(cherry picked from commit 8986dda74a)
2024-08-05 03:40:41 +00:00
Mark Andrews
0dbda6661d Prevent overflow of bufsize
If bufsize overflows we will have an infinite loop.  In practice
this will not happen unless we have made a coding error.  Add an
INSIST to detect this condition.

    181retry:
    182        isc_buffer_allocate(mctx, &b, bufsize);
    183        result = dns_rdata_totext(rdata, NULL, b);
    184        if (result == ISC_R_NOSPACE) {
    185                isc_buffer_free(&b);

    CID 498031: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression bufsize, which is equal to 0, overflows
    the type that receives it, an unsigned integer 32 bits wide.
    186                bufsize *= 2;
    187                goto retry;
    188        }

(cherry picked from commit 20ac13fb23)
2024-08-04 23:52:20 +00:00
Mark Andrews
02cb4823db Prevent overflow of size
If size overflows we will have an infinite loop.  In practice
this will not happen unless we have made a coding error.  Add
an INSIST to detect this condition.

    181        while (!done) {
    182                isc_buffer_allocate(mctx, &b, size);
    183                result = dns_rdata_totext(rdata, NULL, b);
    184                if (result == ISC_R_SUCCESS) {
    185                        printf("%.*s\n", (int)isc_buffer_usedlength(b),
    186                               (char *)isc_buffer_base(b));
    187                        done = true;
    188                } else if (result != ISC_R_NOSPACE) {
    189                        check_result(result, "dns_rdata_totext");
    190                }
    191                isc_buffer_free(&b);

    CID 498025: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    overflow_const: Expression size, which is equal to 0, overflows the type that
    receives it, an unsigned integer 32 bits wide.
    192                size *= 2;
    193        }

(cherry picked from commit e7ef0a60ab)
2024-08-04 23:52:20 +00:00
Štěpán Balážik
4196b92f02 Add a helper for uncompressed length of dnspython's dns.name.Name
This is useful for generating using hypothesis but also for other
cases.

(cherry picked from commit 9584a7bdcd)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
df01e5d788 Move hypothesis strategies to isctest for later reuse
`isctest.hypothesis` seems to be a nice place to have these.

(cherry picked from commit bb1e5cfa09)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
d0288545f3 Disable deadlines for hypothesis tests when running in CI
The times it takes to run tests CI vary significantly enough
that it makes hypothesis test reach their deadlines and fail randomly
marking the tests as flaky.

This commit disables the deadlines when running in CI.

(cherry picked from commit f55cacbbfd)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
2ae0e31138 Test nested wildcard special case in the respective system test
See final remark of RFC 4592 2.2.1. for details.

(cherry picked from commit 9943172566)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
132357101e Expand the wildcard system test with wider use of hypothesis
The queries are now generated more generally (i. e. they have
multiple labels, etc.).

(cherry picked from commit d0cfbd398e)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
f78e41c231 Add hypothesis strategies for generating DNS names and company
The most important being `dns_names` that generates dns.name.Name
objects based on given paramaters.

No guarantees are given when it comes the uniformity of generated
samples, however it plays nicely with the hypothesis' shrinking
algorithm.

Once we use hypothesis more widely (in at least one more test) this file
should be moved for it to be reused easily.

(cherry picked from commit 5d738cd9ed)
2024-08-02 11:22:56 +00:00
Štěpán Balážik
3aac716a46 Extend isctest package with more utility functions
Check for more rcodes and various properties needed in the wildcard
test. Add a `name` module for various dns.name.Name operations (with
`prepend_label` function only now).

Expose `timeout` as a parameter of `query.tcp`/`query.udp`.

(cherry picked from commit e7d46ad8ba)
2024-08-02 11:22:56 +00:00
Mark Andrews
cb180bf4ea Reset 'ret' to zero at start of tests
(cherry picked from commit 2dc2abd00d)
2024-08-02 03:01:48 +00:00
Mark Andrews
80a21e75b8 check 'update-policy 6to4-self' over IPv6
(cherry picked from commit 3b0de4773b)
2024-08-02 00:09:17 +00:00
Mark Andrews
799f677313 check 'update-policy 6to4-self' over IPv4
(cherry picked from commit b28e5ff721)
2024-08-02 00:09:17 +00:00
Mark Andrews
4649e85e3b Test that false positive "success resolving" is not logged
(cherry picked from commit 111e285214)
2024-08-01 15:58:16 +10:00
Mark Andrews
4eb6db47ac Test yaml output with yaml specials
(cherry picked from commit fadf461761)
2024-08-01 03:48:13 +00:00
Mark Andrews
de4a087673 resolver system test didn't record all failures
(cherry picked from commit 5843b29f47)
2024-08-01 12:41:45 +10:00
Mark Andrews
a8d86f0531 Check invalid alpn empty value
(cherry picked from commit fa35c67301)
2024-08-01 01:10:53 +00:00
Mark Andrews
74a8cc9db6 Check invalid alpn produced due to missing double escapes
(cherry picked from commit a49b2a3568)
2024-08-01 01:10:53 +00:00
Aram Sargsyan
6bad06ea2e Update the chain test
Update the CNAME chain test to correspond to the changed behavior,
because now named returns SERVFAIL when hitting the maximum query
restarts limit (e.g. happening when following a long CNAME chain).

In the current test auth will hit the limit and return partial data
with a SERVFAIL code, while the resolver will return no data with
a SERVFAIL code after auth returns SERVFAIL to it.

(cherry picked from commit 7751c7eca6)
2024-07-31 15:14:43 +00:00
Aram Sargsyan
27f6fc915c Test that a long CNAME chain causes SERVFAIL
Also check that the expected partial answer in returned too.

(cherry picked from commit 580f872fe1)
2024-07-31 15:14:43 +00:00
Mark Andrews
3af3ef53a0 Disable post zone verification for manykeys
As the expiration time is now+1 the RRSIG records may expire before
the verification step happens.

(cherry picked from commit 0d69afd764)
2024-07-31 15:04:31 +10:00
Matthijs Mekking
d376d314af Fix kasp system test
In 9.18, 'inline-signing yes;' must also be configured explicitly for
zones using dnssec-policy without a configured 'allow-update' or
'update-policy'.
2024-07-30 15:57:28 +02:00
Matthijs Mekking
8ec554e3de No longer update key lifetime if key is retired
The key lifetime should no longer be adjusted if the key is being
retired earlier, for example because a manual rollover was started.

This would falsely be seen as a dnssec-policy lifetime reconfiguration,
and would adjust the retire/removed time again.

This also means we should update the status output, and the next
rollover scheduled is now calculated using (retire-active) instead of
key lifetime.

(cherry picked from commit 129973ebb0)
2024-07-30 13:38:04 +02:00
Matthijs Mekking
55f79b34b6 Test updating dnssec-policy key lifetime
Check if the key lifetime is updated in the key files. Make sure the
inactive and removed timing metadata are adjusted accordingly.

(cherry picked from commit 2237895bb4)
2024-07-30 10:22:53 +00:00
Matthijs Mekking
6c0380db8a Move dnssec-policy to kasp-fips.conf.in
All dnssec-policy configurations are here, so why not this one?

(cherry picked from commit 93326e3e18)
2024-07-30 10:22:53 +00:00
Matthijs Mekking
1f2faa8470 Fix dig connection timeout argument when using DOH
bin/dig/dighost.c calls isc_nm_httpconnect. The timeout setting
(local_timeout) is passed as the 11th argument, but the function in
lib/isc/netmgr/http.c has the timeout argument as the 11th argument.
The 10th and 11th argument were reversed. This commit fixes that.

Thanks to Nicolas Dehaine for reporting and providing the fix.
2024-07-30 08:52:05 +00:00
Nicki Křížek
ff983ed647 Mark the keyfromlabel&enginepkcs11 tests as xfail
The tests currently fail on debian:bookworm due to a bug in OpenSSL
3.0.13.
2024-07-29 16:55:01 +02:00
Ondřej Surý
8979166d35 Add more tests for adding many RR types to the database
More reclimit tests that test various scenarios adding combinations of
priority and non-priority RR types into the database.
2024-07-01 15:04:43 +02:00
Ondřej Surý
90c7c8078b Make the resolver qtype ANY test order agnostic
Instead of relying on a specific order of the RR types in the databases
pick the first RR type as returned from the cache.

(cherry picked from commit 58f660cf2b)
2024-07-01 13:15:04 +02:00
Aram Sargsyan
227f9aa064 Adapt the upforwd test to the SIG(0) removal
Change the check so that update with SIG(0) is expected to fail.
2024-06-10 19:02:52 +02:00
Petr Špaček
02dffb63a8 Adapt the tsiggss test to the SIG(0) removal
Test that SIG(0) signer is NOT sent to the external socket for
authorization. It MUST NOT be considered a valid signature by
any chance.

Also check that the signer's name does not appear in authsock.pl
output.
2024-06-10 19:02:52 +02:00
Aram Sargsyan
4b1f026ad9 Enable stdout autoflush in authsock.pl
With enabled buffering the output gets lost when the process
receives a TERM signal. Disable the buffering.
2024-06-10 19:02:52 +02:00
Matthijs Mekking
2f5c670ce9 Add new test cases with DNSSEC signing
kasp-max-types-per-name (named2.conf.in):
An unsigned zone with RR type count on a name right below the
configured limit. Then sign the zone using KASP. Adding a RRSIG would
push it over the RR type limit per name. Signing should fail, but
the server should not crash, nor end up in infinite resign-attempt loop.

kasp-max-records-per-type-dnskey (named1.conf.in):
Test with low max-record-per-rrset limit and a DNSSEC policy requiring
more than the limit. Signing should fail.

kasp-max-types-per-name (named1.conf.in):
Each RRSIG(covered type) is counted as an individual RR type. Test the
corner case where a signed zone, which is just below the limit-1,
adds a new type - doing so would trigger signing for the new type and
thus increase the number of "types" by 2, pushing it over the limit
again.

(cherry picked from commit 14e5230f897a178221b606c242b8fbcb357704aa)
2024-06-10 18:51:27 +02:00
Matthijs Mekking
4a0118c16e Check if restart works
(cherry picked from commit 4e69ece8f27f3623a4c7a9100477a5547b94c311)
2024-06-10 18:51:27 +02:00
Matthijs Mekking
6fe1df142b Switch to inline-signing no
(cherry picked from commit 0949221c07fe102ca608899b21f1f5ac5e271953)
2024-06-10 18:51:27 +02:00
Matthijs Mekking
270512949e Add test cases that use DNSSEC signing
Add two new masterformat tests that use signing. In the case of
'under-limit-kasp', the signing will keep the number of records in the
RRset under the limit. In the case of 'on-limit-kasp', the signing
will push the number of records in the RRset over the limit, because
of the added RRSIG record.

(cherry picked from commit 4c677882e66883670990a771337ecbb5206a6faa)
2024-06-10 18:51:27 +02:00
Petr Špaček
5067ab6120 Remove duplicated empty zone files
(cherry picked from commit 1456b4fc7778b851256107dbc79fb67d45f752f5)
2024-06-10 18:51:26 +02:00
Petr Špaček
aa2a1ab919 masterformat: rename zone names to reflect intended meaning
(cherry picked from commit d34bfb1eeaa2f8faab80b1620b992b5495e6f88c)
2024-06-10 18:51:26 +02:00
Petr Špaček
e38a92cef8 Test owner name rename: a b c d e -> <number>-txt
(cherry picked from commit 6ce03f75d1935c2e1991e9c0a01c49b0099a58cb)
2024-06-10 18:51:26 +02:00
Petr Špaček
1a8ea606d9 Test variable rename i->_attempt
(cherry picked from commit 13417eb277cc8a30ee4ddbb6fc02442b0d8e6d3c)
2024-06-10 18:51:26 +02:00
Petr Špaček
ac39dcb397 Test variable rename a->rrcount
(cherry picked from commit 338b45ae713cded921fd3e5494ca38bd59ff9ee8)
2024-06-10 18:51:26 +02:00
Ondřej Surý
4bdd1bf4f3 Add test for not-loading many RRsets per name on a secondary
This tests makes sure the zone with many RRsets per name is not loaded
via XFR on the secondary server.

(cherry picked from commit 4cfeed912a5e7440f04cb088a461ff47305da2e7)
2024-06-10 18:50:06 +02:00
Ondřej Surý
19dc77ac48 Add a test for not caching large number of RRsets
Send a recursive query for a large number of RRsets, which should
fail when using the default max-types-per-name setting of 100, but
succeed when the cap is disabled.

(cherry picked from commit 7e4530f847c8dc541c5e5bf9f790deed520aaa16)
2024-06-10 18:50:06 +02:00
Ondřej Surý
39d3e2a8ec Add a limit to the number of RR types for single name
Previously, the number of RR types for a single owner name was limited
only by the maximum number of the types (64k).  As the data structure
that holds the RR types for the database node is just a linked list, and
there are places where we just walk through the whole list (again and
again), adding a large number of RR types for a single owner named with
would slow down processing of such name (database node).

Add a configurable limit to cap the number of the RR types for a single
owner.  This is enforced at the database (rbtdb, qpzone, qpcache) level
and configured with new max-types-per-name configuration option that
can be configured globally, per-view and per-zone.

(cherry picked from commit 00d16211d6368b99f070c1182d8c76b3798ca1db)
2024-06-10 18:50:06 +02:00