Commit graph

5737 commits

Author SHA1 Message Date
Matthijs Mekking
72d3551355 rollover-algo-ksk-zsk: From setup.sh to pytest bootstrap
Symlink ns1 and ns2 to rollover/ns1 and rollover/ns2.
Symlink ns3/template.db.j2.manual to rollover/ns3/template.db.j2.manual.

The RSASHA256 keys are generated with dnssec-keygen, without a policy
provided. Thus we have to fake the lifetime for these keys.

Signing has to be done without the -z option, because the KSK should
not sign all records in case of a KSK/ZSK split. Update the signing
code to allow for extra options when signing with CSK only.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
3a6ed195fa rollover-algo-csk: From setup.sh to pytest bootstrap
Symlink ns1 and ns2 to rollover/ns1 and rollover/ns2.
Symlink ns3/template.db.j2.manual to rollover/ns3/template.db.j2.manual.

Since the bootstrapping is done before the templates are rendered
automatically, replace @DEFAULT_ALGORITHM@ in ns3/csk2.conf.j2 to
ecdsa256 and rename to ns3/csk2.conf.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
f31514e658 rollover: From setup.sh to pytest bootstrap
Introduce rollover/setup.py for all setup related test code.

Introduce rollover/ns1 and rollover/ns2 to create a chain of trust to
all rollover related test zones. The tld zones in rollover/ns2 contain
a DSYNC record that at a later time will be used for testing Generalized
DNS Notifications.

Write a python version of private_type_record so we can put such
records in the zone via jinja2 templating.
2025-12-19 11:47:49 +01:00
Matthijs Mekking
e620b29e35 Move ns6 to ns3 in rollover tests
There is no difference, so we are going to make it consistent. This will
make it easier to add a chain of trust for these zones (to be done in
a future commit).
2025-12-19 11:41:07 +01:00
Michal Nowak
21295bc188
Add ans6 blackhole server to notify system test 2025-12-18 15:27:17 +01:00
Štěpán Balážik
db212153d9 Use new AsyncDnsServer features in xfer system test
Use `prepare_new_response()`, `default_aa` and `default_rcode`.
2025-12-18 13:13:59 +01:00
Štěpán Balážik
f5f84a649b Use new AsyncDnsServer features in cookie system test
Take advantage of `default_aa`, `default_rcode` and `keyring` arguments.
2025-12-18 13:13:59 +01:00
Štěpán Balážik
5384998ccd Allow ResponseHandlers to roll back changes made to a response
Previously, this was only possible by making a new response by calling
make_response on qctx.query. This however ignored the `default_aa` and
`default_rcode` parameters of AsyncDnsServer.

Add prepare_new_response and save_initialized_response methods to
QueryContext.
2025-12-18 13:13:59 +01:00
Štěpán Balážik
de266fff4c Add TSIG keyring support to AsyncDnsServer
Previously, ResponseHandlers had to reparse the queries themselves if
they wanted to use TSIG. This led to `default_aa` and `default_rcode`
information being lost from the newly created messages.

Add support for TSIG keyrings to the AsyncDnsServer class directly.
2025-12-18 13:13:59 +01:00
Štěpán Balážik
8c2a72143c Remove dnspython<2.0.0 compatibility hacks from custom servers
isctest.asyncserver requires dnspython 2+ now.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
5761de5531 Import dnspython modules explicitly in custom servers
Previously, the server relied on the modules being imported by the
isctest.asyncserver module. This is fragile and confuses tooling.

Clean up stray imports in the process.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
d593af3a5f Allow adding multiple ResponseHandlers at once
Change this at call sites as well.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
e4de7eb4f9 Use default_rcode for AsyncDnsServer where applicable
Rule of thumb: If a RCode is set unconditionally in all
ResponseHandlers, set it in the server constructor.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
c7d84dc86a Set default_aa for AsyncDnsServer instances where suitable
Rule of thumb: If all ResponseHandlers said authoritative=True, it
should be default_aa=True instead.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
6e684d44e0 Allow users of AsyncDnsServer to set AA bit for all responses
Previously, all responses had to be set as authoritative explicitly
using DnsResponseSend(..., authoritative=True). After using this,
it became obvious that this is obnoxious.

Add an optional keyword-only parameter to AsyncDnsServer that sets the
default value of the AA bit on outgoing responses.

Make all the other parameters keyword-only as well.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
a0970f3d04 Refactor ControllableAsyncDnsServer setup
When this class was introduced, the constructor of its base class had no
parameters. This was changed in the meantime and these parameters were
not accessible by users of the subclass.

Don't override the constructor.
Move command setup to methods.
Move subclass-specific storage to cached properties.
Take instances of Command instead of the classes themselves for
symmetry with install_response_handler.
2025-12-18 13:03:14 +01:00
Colin Vidal
d07deba615 update SERVFAIL cache test
An existing SERVFAIL cache test is updated as it initially checks there
are no EDE (the first SERVFAIL) then immediately re-does the same query,
(still SERVFAIL), and expect the CACHED_ERROR EDE.

However, the configuration used for this test to generate a SERVFAIL is
a broken DNSSEC configuration, where the DNSKEY is not the expected one
(it's a ZSK instead of a KZK). As a result, the first attempt also now
raise an EDE (MISSING_DNSKEY).
2025-12-17 09:43:13 +01:00
Colin Vidal
e856afa3b5 add system tests covering EDE 9
The authoritative server on "missing-dnskey." zone is ns2, the zone is
initially signed normally, but then the DNSKEY are pulled out from the
signed generated zone file. As a consequence, a quering the resolver ns4
returns a SERVFAIL with EDE9 as the chain of trust is broken: the DS is
prsent in the parent zone (the root zone in ns1), but the DNSKEY is
missing from the zone.

A similar is "wrong-dnskey.", but here the zone is signed correctly,
but the DS points to a different DNSKEY. Hence no supported matching
DNSKEY record could be found for the child.
2025-12-17 09:43:13 +01:00
Mark Andrews
96e6a22627 Exclude f.f.f.f.ip6.arpa names from test_sythreverse_refused_v6
f.f.f.f.ip6.arpa is a configured zone so refused responses
are not expected.
2025-12-16 13:15:37 +11:00
Michal Nowak
ce23dd4dd3
Add TSAN report and core file globs to expected artifacts 2025-12-15 19:42:50 +01:00
Evan Hunt
92919609c4 Check delegation response to ANY query
If mandatory glue is present, it should be returned when the query
type is ANY.
2025-12-11 10:41:05 -08:00
Matthijs Mekking
5e704bbb59 Add NSEC3 optout large delegation zone test case
This test signs a large delegation with mostly insecure delegations
with NSEC3 optout. Once the NSEC3PARAM record is published, run
dnssec-verify to ensure the zone is correctly signed.
2025-12-10 14:18:52 +01:00
Nicki Křížek
8f326a7af7 Fix a timing issue in notify test
There are a total of 22 notifies required before the start of the test:
20 for each x1..x20 and two for x21, as it has a couple of servers.
2025-12-09 14:23:17 +01:00
Nicki Křížek
51ab74db10 Remove obsolete copy_setports
This function is no longer needed and jinja2 templates are universally
used instead.
2025-12-09 14:23:17 +01:00
Nicki Křížek
bf694d0628 Use jinja2 templates in kasp test
- ns3 had fips/rsasha1 config variants. These were refactored similarly
  to the way they're handled in nsec3 test.
- ns3 special character zone contains @, which is interpreted by jinja2.
  To avoid, {% raw %} directive was added
- ns6 contained unused policies and named2.conf, these were removed
2025-12-09 14:23:17 +01:00
Nicki Křížek
a8713fdcf8 Use jinja2 templates in serve-stale test
The ns1 named.conf files were sufficiently similar to allow for
de-duplication. No attempt to de-duplicate ns3 was made due to
significant differences among the config files.
2025-12-09 14:23:17 +01:00
Nicki Křížek
6114444007 Use jinja2 templates in catz test
- Use a common ns2/named.conf.j2 template for all the "#TN"
  replacements. Instead of commenting out with sed, render the template
  differently into ns/namedX.conf using variables.
- Keep the final ns2/named7.conf.j2 (formerly ns2/named2.conf.in) as a
  separate template for readability due to significant differences.
2025-12-09 14:23:17 +01:00
Nicki Křížek
c93733263a Use jinja2 templates in rpz test
- The ns3/named.conf.j2 uses has a "#BAD" section that is only included
  after restart. Turn it into ns3/named2.conf.
- Since the original config is then restored, keep a copy of it as
  ns3/named1.conf using a symlink, causing it to be rendered twice.
- Use jinja2 templates for test* files to render the port number instead
  of calling copy_setports in load_db().
2025-12-09 14:23:17 +01:00
Nicki Křížek
efc302b0ad Use jinja2 templates in staticstub test
- Instead of strings to be replaced by sed, use proper jinja templates.
- ns3/named1.conf.j2 is basically a copy of the default config, because
  it needs to be restored later in the test.
2025-12-09 14:23:17 +01:00
Nicki Křížek
c46208ffdb Use jinja2 templates in resolver test
- Move ns1/named.conf.j2 to ns1/named2.conf.j2 and adjust the python
  test to render this template.
- Convert remaining .in files to .j2 and handle the multiple configs.
2025-12-09 14:23:17 +01:00
Nicki Křížek
2592f0d961 Use jinja2 templates in views test
- Rename named.conf.j2 to named3.conf.j2 and adjust the python test to
  render this template.
- Handle the n2 and ns3 multiple configs as in other similar cases
  (ns2/named1.conf.in was moved to ns2/named.conf.j2).
2025-12-09 14:23:17 +01:00
Nicki Křížek
1da733a015 Use jinja2 templates in legacy test
The test uses a second named2.conf template. It only differs by using
dnssec-validation yes. Render both named configs and swap them when
needed.
2025-12-09 14:23:17 +01:00
Nicki Křížek
cb88d1eda6 Use jinja2 templates in statistics test
- Merge ns*/statistics-channels.conf.in config snippets into
  conditionally rendered section in ns*/named.conf.j2 files.
- Turn ns2/named.conf.in into ns2/named1.conf.j2 because it is used
  later in the test to restore the original config.
- Symlink the ns2/named.conf.j2 ns2/named1.conf.j2 to pick a starting
  config.
2025-12-09 14:23:17 +01:00
Nicki Křížek
719c656d2b Use jinja2 templates in synthfromdnssec test
- Merge ns*/statistics-channels.conf.in config snippets into
  conditionally rendered section in ns*/named.conf.j2 files.
2025-12-09 14:23:14 +01:00
Nicki Křížek
8db37ac31c Use jinja2 templates in tsig test
- Rename ns1/named-fips.conf.in to ns1/named.conf.j2.
- Move MD5-specific stuff into ns1/named-md5.conf.j2 and include it
  conditionally.
2025-12-09 14:23:14 +01:00
Nicki Křížek
16e9ac4710 Use jinja2 templates in rpzrecurse test
- Change ns2 header into jinja2 template.
- Keep the various ns2 config files as non-templates, same for the
  named.default.conf to be consistent.
- Symlink the ns2/named.default.conf as a jinja2 template to pick a
  starting config. It is rendered as a template to avoid an error when
  the test would overwrite a git-tracked file.
- Use jinja2 templates for the ns3 files, keep named1.conf around
  because it's needed later in the test to restore the config. Symlink
  it to `ns3/named.conf.j2` to select a default config.
2025-12-09 14:23:14 +01:00
Nicki Křížek
54c95d6966 Use jinja2 templates in nsupdate test
- Merge ns1/tls.options.in into ns1/named.conf.j2 and render it
  conditionally. Also conditionally include the additional
  ns1/tls.conf.j2 which is always rendered.
- Use multiple templates for ns7 and replace the copy_setports.
- Use jinja2 template for verylarge.in as well.
2025-12-09 14:23:14 +01:00
Nicki Křížek
9fc446b6f5 Use jinja2 templates in notify test
- Merge options-tls.conf into named.conf in ns2 and ns4 and render it
  conditionally. Also conditionally include the additional
  named-tls.conf which is always rendered.
2025-12-09 14:23:14 +01:00
Nicki Křížek
8e525f2154 Use jinja2 templates in forward test
- Merge options-tls.conf into named.conf in ns2 and ns4 and render it
  conditionally. Also conditionally include the additional
  named-tls.conf which is always rendered.
- Use multiple templates for ns3 and ns9 and replace the copy_setports.
- In ns3/named2.conf, use "root2.db" directly rather than replacing it
  with "sed" later.
2025-12-09 14:23:14 +01:00
Nicki Křížek
3f953266fb Use jinja2 templates in logfileconf test
- Replace all named*.in files with jinja2 templates.
- Rename the config files to named.*.conf convention.
- Rename named.plain.in to named.plain.conf.j2 and symlink it as te
  default config.
- Rename named.plainconf.in to named.plainlog.conf.j2 (there is a slight
  difference from named.plain, despite the similar name)
2025-12-09 14:23:14 +01:00
Nicki Křížek
7f3b0afb09 Use jinja2 templates in runtime test
- Replace named-altX.conf.in with namedX.conf.j2 to stick with the same
  naming convention across the entire code base. Note than due to
  named1.conf being the first (default) config, the numbers for the altX
  are incremented.
- Turn alt9 into named7 to stick with the same number sequence. Adjust
  the related file names accordingly.
2025-12-09 14:23:14 +01:00
Nicki Křížek
b23301ec55 Use jinja2 templates in checkzone test
Render the bad-tsig.db file using jinja2 template to get rid of
copy_setports.

Since the zone is using @ character, use the raw directive to avoid
interpreting it as a variable start.
2025-12-09 14:23:14 +01:00
Nicki Křížek
13bd0d689a Use jinja2 templates in autosign test
- Include ns3/nsec-only.conf conditionally and always render it.
2025-12-09 14:23:14 +01:00
Nicki Křížek
1aa2f7249a Use jinja2 templates in tsiggss
- The ns1/named.conf.j2 contains "@" which is a special jinja character,
  use the raw directive to escape it.
2025-12-09 14:23:14 +01:00
Nicki Křížek
0f37603b1a Use jinja2 templates in transport-change test
- Replace named*.conf.in files with jinja2 templates.
- When applying the files use plain cp command to copy the rendered
  files.
2025-12-09 14:23:14 +01:00
Nicki Křížek
9d3279a542 Replace .in with .j2 templates for cases with namedX.conf
The following tests use multiple named configs. Previously, these have
been rendered with copy_setports in tests.sh when needed. Transform
these into jinja2 templates and render them during setup. In the tests,
the copy_setports invocations can be then replaced with a simple cp.
2025-12-09 14:23:14 +01:00
Nicki Křížek
fc10cb686d Replace .in with .j2 templates for simple copy_setports cases
Use jinja2 templates instead of *.in templates for named.conf and remove
the copy_setports invocations from setup.sh which are no longer needed.
2025-12-09 14:23:14 +01:00
Nicki Křížek
d6d6db52e3 Allow any named*.conf file as a system test artifact
This allows rendering multiple named*.conf files using the jinja2
template engine at test start and then simply copying the required
config to named.conf as needed.
2025-12-09 14:23:14 +01:00
Michal Nowak
ed33f44829 dns.name module does not have minversion attribute
The dns module does have it.
2025-12-09 11:17:20 +01:00
Aram Sargsyan
2622140482 Add a check to the catz test to confirm that the issue is fixed
Use a member zone with a long list of primaries with long key
names to trigger the issue that was fixed by the previous commit.
2025-12-09 18:09:45 +11:00
Nicki Křížek
19af19b31c Add FEATURE_* environment variables to system tests
The purpose of these variables is to be able to detect feature support
without calling feature-test. This becomes useful when detecting feature
support in jinja2 templates.
2025-12-08 18:07:41 +01:00
Nicki Křížek
2bb840bbc7 Remove unused dlz-filesystem feature check
There isn't any system test that uses this feature check.
2025-12-08 18:07:41 +01:00
Nicki Křížek
789e40bd4c Remove unused ipv6only feature check
There isn't any system test that uses this feature check.
2025-12-08 18:07:41 +01:00
Nicki Křížek
f33e2b6d87 Refactor NamedInstance.rndc() to use EnvCmd() interface
To unify the command handling, utilize EnvCmd() to handle rndc commands:

1. Remove isctest.rndc abstractions. They were intended for an upcoming
   python-only implementation. A couple of years later, it doesn't seem
   to be coming any time soon, so let's stick with the interface that
   makes sense today, i.e. use the same command handling interface
   everywhere.
2. Remove the specialized rndc.log in favor of the generic logging
   already implemented by isctest.run.cmd(). I believe the cause of the
   many rndc(log=False) invocations was that nobody wanted this extra
   file. Yet, logging everything by default makes sense for debugging,
   unless there's a good reason not to. In almost all cases, logging was
   switched to the default (enabled).
3. With the NamedInstance.rndc() call now returning CmdResult rather
   than combined stdout+stderr string, adjust all the invocations to use
   `.out` or `.err` as necessary.
4. Replace some manual rndc invocation and its base argument
   construction with the standardized nsX.rndc() call.
5. In cases where rndc is expected to fail, utilize
   raise_on_exception=False and check the `.rc` from the result, rather
   than handling an exception.
6. In addzone/tests_rndc_deadlock.py, refactor the test slightly to
   avoid using EnvCmd() entirely to avoid spamming the logs. This test
   calls rndc in a loop from multiple threads and such test case is an
   exception which doesn't warrant changing the `isctest.run.cmd()`
   implementation.
2025-12-08 14:57:47 +01:00
Nicki Křížek
ff613a72d7 Add generic isctest.run.EnvCmd helper to pytest
A generic helper that calls the environment-specified binaries in a
developer-friendly manner, i.e. passing arguments as strings rather than
having to split them first.

The isctest.run.cmd() remains as the basis which provides a clean and
robust interface, while the isctest.run.EnvCmd() can be used as a
convenient wrapper for tests, or when there are some shared default
parameters.

The isctest.run.Dig() is superseded with the isctest.run.EnvCmd(). In
the future, we might revisit adding Dig() or command-specific helpers
again, but it probably only makes sense if they offer command-aware
attributes / methods, rather than just being shortcuts to
isctest.run.EnvCmd().
2025-12-08 14:57:47 +01:00
Nicki Křížek
a8bf53411d Add pylint check for re.compile() alias
Ensure that Re() is used consistently across our code base.
2025-12-08 14:57:47 +01:00
Nicki Křížek
9bad9491a1 Improve file handling in ksr test
Refactor the file handling to write to a file directly when calling
isctest.run.cmd().

Refactor the existing code to use CmdResult rather than out and err
separately.
2025-12-08 14:57:47 +01:00
Nicki Křížek
4b6a86b029 Use Text with Grep support in isctest.run.cmd()
When commands are executed using the isctest.run.cmd() command, allow
the output to be Grep-able like logs and text files.
2025-12-08 14:57:47 +01:00
Nicki Křížek
7743bab5fc Refactor LogFile into TextFile with Grep support
Add a new Grep-like interface which can be used for searching for
regular expressions in files. Replace the prior LogFile used for named
logs with the new TextFile interface.
2025-12-08 14:57:47 +01:00
Nicki Křížek
be6bae2a75 Move text-related operations into isctest.text module
Add a new module for working with text and keep the isctest.log.watchlog
module focused on its purpose. Move LogFile and LineReader into the new
module. Add compile_pattern() helper which will be useful in subsequent
commits.
2025-12-08 14:57:47 +01:00
Nicki Křížek
ac7127d620 Use Re() for creating regular expressions
It's a fairly common pattern to use regular expression in our tests.
Instead of using the fairly verbose re.compile(), import that function
as Re() instead to allow for more brevity in the test syntax.
2025-12-08 14:57:47 +01:00
Nicki Křížek
ac998da3f6 Use CmdResult to decode stdout/stderr from isctest.run.cmd()
Avoid repeating the .decode("utf-8") snippet when processing command
output and provide a helper instead, which leads to more concise code.
2025-12-08 14:57:47 +01:00
Nicki Křížek
ac2be27f8f Utilize nsX.rndc() helper
Remove the duplicated code and replace it with nsX.rndc() call.
2025-12-08 13:29:40 +01:00
Colin Vidal
0b9da992a5 add tests for EDE 13 support
Add system test covering EDE 13 being added in the response in case of
SERVFAIL cache hits.
2025-12-05 23:28:29 +01:00
Matthijs Mekking
14a243a81d Fix statschannel system test
The manykeys test case relies on keys being removed. Make sure the
zone is fully signed with the keys that will stay, so the other keys
may be removed safely.

This means the expected number of signatures generated and refreshed
will change. The CDS and CDNSKEY RRset also need to be signed now.

Configure the test case with sig-signing-signatures 100, large enough
that the entire zone is processed in a single step.
2025-12-05 12:14:14 +01:00
Matthijs Mekking
a8339be0f8 Fix nsec3 system test
The nsec3 system test has a couple of cases where the configured policy
changes the algorithm, effectively triggering an algorithm rollover. Fix
those cases to start in a valid DNSSEC state. Then fix the expected key
states, no longer should the old algorithm be removed immediately.
2025-12-05 12:14:14 +01:00
Matthijs Mekking
c756b8a505 Fix autosign system test
When creating keys, set Publish and Activate times so that keys will
be initialized as omnipresent. This way we start with a safe DNSSEC
state. In most cases at least, because some tests depend on special
key timings.

The ttl[1-4].example cases have become incorrect. With dnssec-policy
we require the TTL to match the dnskey-ttl from the policy.

The delzsk.example will have a ZSK removed from the zone. It also
requires that the DNSKEY RRset is already published. This means
that for the existing keys the, no longer "is now published"
messages will be logged.

The nsec-only.example and reconf.example zones are fixed to have a
correct matching policy.

This all means the expected count of log messages changes slightly.
2025-12-05 12:14:14 +01:00
Matthijs Mekking
67ea0e656b Fix views system test
This test case enables DNSSEC and has a mismatch in policy. Fix the
policy so that it matches the existing key set, and adjust the
expected answer count because no longer a new key is generated.
2025-12-05 12:14:14 +01:00
Matthijs Mekking
149ca5d46a Rollover test case for rumoured zone signatures
Test a manual rollover when zone signatures have not become omnipresent
yet. This should not immediately remove the predecessor key.
2025-12-05 12:14:14 +01:00
Colin Vidal
77e0104cf4 shrunk cfgobj down to 48bytes
Make all non-scalar properties of `cfg_obj_t` allocated values, which
ensures the union size is the width of one pointer. Also reorder the
fields inside `cfg_obj_t` to avoid alignment padding that would increase
the size. As a result, a `cfg_obj_t` instance is now 48 bytes on a
64-bit platform.

Add a static assertion to avoid increasing the size of the struct by
mistake.

The function `parse_sockaddrsub` was taking advantage of the fact that
both sockaddr and sockaddrtls were in the same position, and used to
initialize the sockaddr field independently if this was a -tls one or
not. This doesn't work anymore now that all fields are allocated,
so it has been slightly rewritten to take both cases into account
separately.
2025-12-05 08:59:53 +01:00
Colin Vidal
f7b64e2e87 cfg_parse_ API doesn't need memory context
Because the parser now uses global memory context, the cfg_parse_* API
doesn't take a memory context anymore.
2025-12-04 16:09:40 +01:00
Evan Hunt
d4ebea1037 use a standard CLEANUP macro
CLEANUP is a macro similar to CHECK but unconditional, jumping
to cleanup even if the result is ISC_R_SUCCESS. It is now used
in place of DST_RET, CLEANUP_WITH, and CHECK(<non-success constant>).
2025-12-03 13:45:43 -08:00
Evan Hunt
6b33b7fc77 switch to RETERR where it wasn't being used
replace all instances of the pattern:

        result = <statement>
        if (result != ISC_R_SUCCESS) {
                return result;
        }

with:

        RETERR(<statement>);
2025-12-03 13:45:43 -08:00
Evan Hunt
38e94cc7da switch to CHECK where it wasn't being used
replace all instances of the pattern:

        result = <statement>
        if (result != ISC_R_SUCCESS) {
                goto cleanup;
        }

with:

        CHECK(<statement>);
2025-12-03 13:45:42 -08:00
Evan Hunt
52bba5cc34 standardize CHECK and RETERR macros
previously, there were over 40 separate definitions of CHECK macros, of
which most used "goto cleanup", and the rest "goto failure" or "goto
out". there were another 10 definitions of RETERR, of which most were
identical to CHECK, but some simply returned a result code instead of
jumping to a cleanup label.

this has now been standardized throughout the code base: RETERR is for
returning an error code in the case of an error, and CHECK is for jumping
to a cleanup tag, which is now always called "cleanup". both macros are
defined in isc/util.h.
2025-12-03 13:26:28 -08:00
Colin Vidal
6998fe42e3 test for RRSIG provided as soon as they are found
Add a system test which checks that a server authoritative on zone which
is not fully signed (here, it is missing the DNSKEY records as well as the
RRSIG on the RR `b`) still return the RRSIG associated with an RR if
provided in the zone.
2025-12-03 15:49:47 +01:00
Mark Andrews
472cade02b check that dig +showtruncated works 2025-12-02 09:34:13 +11:00
Matthijs Mekking
c17ac42608 Wait for log zone_needdump is more reliable
In some cases we wait for the log message "sending notifies" before
proceeding with the test case. Notifies are rate limited. They are not
sent on every change to the zone. The "zone_needdump" messages happen on
every change.
2025-12-01 13:17:42 +00:00
Matthijs Mekking
ef33272181 Update kasp based system tests to new output
In addition fix some test bugs where we actually were testing against
the wrong policy name.
2025-11-28 15:32:17 +01:00
Matthijs Mekking
a91f13cae8 dnskey is now a property of Key class
After a rebase, the dnskey() invocations need to be adjusted to
accomodate for !11201 (0bf20f8d).
2025-11-28 14:30:31 +00:00
Matthijs Mekking
11578aa219 Update misleading comments in multisigner test
We are not actually retrieving these records from the other provider,
they are available as key files to us and we are using those files
to send a dynamic update to the server.
2025-11-28 14:30:31 +00:00
Matthijs Mekking
61d1209c31 Remove common kasp shell script
No system test is using the common kasp shell script test anymore, so we
can remove it.
2025-11-28 14:30:31 +00:00
Matthijs Mekking
97b38a1fbc Clean up shell script remnants
All the cases in this system test have been converted to pytest, so
we can clean up the shell script remnants.
2025-11-28 14:30:31 +00:00
Matthijs Mekking
c96f896482 Convert model2.secondary test to pytest
This test is similar to model2.multisigner, but now the two providers
are both secondary, both using the same hidden primary. The DNSKEY,
CDNSKEY, and CDS records need to be published at the hidden primary,
ns5, the zone is transferred to both secondaries, ns3 and ns4.

To avoid intermittent test failures, we wait for the line
"zone {zone}/IN (signed): serial {serial2} (unsigned {serial1})" in
the secondary server logs. This is a signal that the unsigned zone
with serial <serial1> has a signed version ready with serial <serial2>.

To speed up the test, disable 'notify-delay'.
2025-11-28 14:30:31 +00:00
Matthijs Mekking
fdf8a171c5 Update multisigner system test to set primary
When testing multi-signer as bump-in-the-wire (upcoming test), we want
to be able to do dynamically updates to a hidden primary. Update the
test functions such that we can set a specific primary server.
2025-11-28 14:30:31 +00:00
Matthijs Mekking
9ae449afd1 Make test code flexible for more providers
The initial test code only allowed for one additional provider. Update
the test function such that more extra keys can be tested.
2025-11-28 14:30:31 +00:00
Matthijs Mekking
773ce8d99b Convert model2.multisigner test to pytest
This converts the model2.multisigner tests from the multisigner system
test to pytest based code. Crappy shell test functions such as
'zsks_are_published', 'records_published' and others are replaced with
the standard test code from isctest.kasp and by setting 'private=False'
and 'legacy=True' on the keys from the other providers so we don't do
any key file testing.
2025-11-28 14:30:31 +00:00
Ondřej Surý
772ef27fe6
Fix missing field 'merge' initializer for the new cfg_clausedef_t
In !11121, a .merge member was added to cfg_clausedef_t.  This caused
a build failure with -Werror,-Wmissing-field-initializers enabled.
Add the missing initializer and set them all to NULL to match the
intent.
2025-11-28 13:50:54 +01:00
Nicki Křížek
b1ffc80f26 Remove obsolete dnspython prerequisite checks
dnspython has been mandatory to run system test for quite a while.
Remove all extraneous checks for this module from prereq.sh scipts.
2025-11-28 11:24:11 +01:00
Nicki Křížek
156b213d62 Remove extraneous prerequisite script for timeouts test
The timeouts test already checks for dnspython>=2.0.0 in
test_tcp_timeouts.py and the prereq.sh file is not needed.
2025-11-28 11:24:11 +01:00
Nicki Křížek
fe92341fd3 Remove obsolete checks for PYTHON executable
Python has been required to run the system test suite for quite a while.
Remove the dated checks inside system tests which are no longer needed.
2025-11-28 11:24:11 +01:00
Colin Vidal
4bc435ab10 add checkconf test for named remote-servers
Add checkconf system test to cover usage of `remote-servers` with a
named server-list and a `key` and/or a `tls` option.
2025-11-28 09:10:54 +01:00
Colin Vidal
32a4aa95ae test named remote-servers key usage
Even though `remote-servers` now allows using named server-list with `key`
(or `tls`), the `key` or `tls` is not used, in the context of a named
server-list, when configuring the server.

For instance,

   remote-servers foo { 10.53.0.5; };
   also-notify { foo key fookey; };

won't use `fookey`.

Add a system test highlighting the problem.
2025-11-28 09:10:53 +01:00
Ondřej Surý
ed460c50b7
Change the QNAME minimization algorithm to follow the standard
In !9155, the QNAME minimization was changed to not leak the query type
to the parent name server.  This violates RFC 9156 Section 3, step (3)
and it is not necessary.  It also breaks some (weird) authoritative DNS
setups, especially when CNAMEs are involved.  Also there is really no
privacy leak with query type.
2025-11-27 16:47:29 +01:00
Nicki Křížek
2f2be20547 Mock DSDigest for compatibility with older dnspython
DSDigest class isn't available prior to dnspython 2.0.0 and prior to Add
an isctest.compat.DSDigest compatibility hack to support those versions.
2025-11-27 14:02:49 +01:00
Nicki Křížek
f6cb154b65 Add a template for TA and generate it from isctest.kasp.Key
Add isctest.kasp.Key.into_ta() method which convert the key into DS /
DNSKEY trust anchor for BIND config. Add a shared template
trusted.conf.j2 which can be linked to in tests to create the trust
anchor configuration from trust anchor data returned from bootstrap()
function.

This is basically a python replacement for the keyfile_to_static_ds (and
friends) from the conf.sh shell framework.
2025-11-27 14:02:49 +01:00
Nicki Křížek
0bf20f8d68 Parse DNSKEY into a dnspython type in isctest.kasp.Key.dnskey
Previously, a DNSKEY string from keyfile was returned. This made the
function brittle for further processing, as the string would have to be
split up, concatenated, and TTL could be missing, making string indices
context-dependent.

Parse the DNSKEY rrset into a proper dnspython object and return it.
This makes the output more predictable and reliable, as all the
neccessary parsing is done by dnspython.
2025-11-27 14:02:49 +01:00
Mark Andrews
98e4204db9 Check nsstats statistics in bind9.xml 2025-11-25 13:26:50 +11:00
Matthijs Mekking
be3e4c83d0 Test retransfer with NSEC3 policy
If the primary has been updated, but the secondary has not been
notified, the journal will go out of date. An 'rndc retransfer' causes
the zone to force an AXFR, removing and rebuilding zone and journal
files.

This test reproduces a bug that in such scenario, an NSEC3 signed zone
falls back to NSEC.
2025-11-24 10:21:33 +01:00
Colin Vidal
68fda6a035 do not log "no root hints for view '_bind'"
The "no root hints for view X" message must not be shown for the default
_bind/CH view. However, it is shown since 27c4f68dcc (part of effective
configuration changes).

The reason is that since 27c4f68dcc, `configure_views()` now processes
a single list of views, which contains both builtin and user views as
they are both part of the effective configuration. Those changes omitted
the `need_hints` bool that disabled the warning for the builtin view.
This commit silences the log message again.
2025-11-21 14:21:44 -08:00
Matthijs Mekking
ba211de912 Wait longer before keymgr is done
To check if the key managing for a zone is done, we check a log message.
On some machines, with many zones this may take some time.

Increate the timeout to a minute. Note that most zones will continue
their test case much faster, but with many zones there may be some
straggling.
2025-11-21 14:20:58 +01:00
Matthijs Mekking
8cfccb9eac Wait until zones are signed before reconfig
In order to make the tests run reliable, first make sure the key
managing for all the zones has finished before doing running the
reconfig command.
2025-11-21 14:20:58 +01:00
Nicki Křížek
66e4146a88 Only render required zones in config for nsec3 tests
When all zones are configured, regardless of whether the test module
actually uses them, it makes debugging the logs needlessly more
complicated, as there is a bunch of stuff going on that is completely
unrelated to the test.

Define a list of tested zones in each test module and only render the
named.conf with those zones defined.
2025-11-21 14:20:58 +01:00
Matthijs Mekking
9ee62467a6 Move nsec3-change.kasp test to separate module
This zone has a specific corner case to be tested during the setup.
Move it to a separate module so it is less convoluted.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
7762b2391e Move check_nsec3_case to common code
With the nsec and nsec3 test cases being nearly identical for all
modules, these can be be unified and moved to common.py.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
29816eb621 Clean up shell tests remnants
Now that all tests are covered by pytest, we can remove the remnants
of the shell test script.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
3f5d295e29 Rewrite nsec3 system test to pytest (4/4)
Convert the final nsec3 system test case that deals with empty
non-terminals. This is a regression test case for GL #5108.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
f98f6ee3d6 Rewrite nsec3 system test to pytest (3/4)
This converts two test cases:

1. A zone that previously failed to load is now fixed. Make sure the
   zone is signed correctly with the right NSEC3 parameters.

2. Test case to ensure the salt is the same after a restart, i.e. no
   re-salting takes place. Previously we only tested with salt length
   0, this commit adds a test case for salt length 8 as well.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
2c7190609b Rewrite nsec3 system test to pytest (2/4)
This converts the nsec3 system test cases after to reconfiguring the
name server.

Two extra test for nsec3-change.kasp is updated. It depends on the
zone being updated, and a reconfig. This test code is moved to
tests_nsec3_reconfig.py.

Furthermore, an additional 'rndc signing -nsec3param' error test
case has been added.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
ba1ffe56e4 Improve check_auth_nsec3 salt checking
Since we know the salt after checking the NSEC3PARAM, we might as well
check the NSEC3 records on the NXDOMAIN response that the salt matches.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
85eea3db37 Move parts into a common module
Some constants and test functionality are the same for test cases
prior and after reconfiguration. Move these into a common module.
2025-11-21 13:50:13 +01:00
Matthijs Mekking
4a404dd806 Convert "in"-style templates to jinja
Change the named.conf templating to make use of jinja template
rendering. The ns2 server is trivial. The ns3 server configuration
structure has changed:

The common configuration is moved out of named-fips.conf.

The main named.conf file is in named.conf.j2. It always includes the
common part, named-common.conf.j2, and the FIPS part,
named-fips.conf.j2.

The named-fips.conf.j2 and named-rsasha1.conf.j2 templates are
rendered differently depending on the reconfiged status. Mainly the
dnssec-policy for zones are different after reconfiguration, but there
are some other changes to, for example some zones change their
inline-signing setting.

Some zones only exist prior or after the configuration.

Finally, this is a bit hackish: If RSASHA1 is supported, named.conf
includes "named-rsasha1.conf", otherwise it includes the deliberately
empty "named-rsasha0.conf".
2025-11-21 09:38:47 +01:00
Matthijs Mekking
e81cc1520a Rewrite nsec3 system test to pytest (1/4)
This converts all the nsec3 system test cases prior to reconfiguring the
name server. There are two main classes, one that tests the zone is
correctly signed with NSEC, the other with NSEC3.

Two extra tests for nsec3-dynamic-update-inline.kasp and
nsec3-change.kasp are also rewritten. For the former, we need to
change the 'nsupdate' definition to be able to set the expected RCODE.
2025-11-21 09:38:47 +01:00
Evan Hunt
f9340fc152 add a test for allow-recursion/allow-query-cache inheritance
allow-recursion is set to "none" in the options block and to
"any" in the view.  allow-query-cache in the view should inherit
the "any", not the "none". (currently this test does not pass.)
2025-11-20 11:24:11 -08:00
Ondřej Surý
1b90d2ffdb
Reduce the number of outgoing queries
The dns_resolver mode of operation is to resolve all the domains as it
iterates the DNS tree to fill up the cache as quickly as possible.

This commit reduces the number of outgoing queries by reducing the
number of remote fetches started for the nameserver addresses resolution
via dns_adb_createfind() to a smaller number per depth of the recursion
since the delegation point (3 2 1 0) - where 0 means only create fetch
on demand if we don't have any addresses yet.
2025-11-20 13:31:11 +01:00
Mark Andrews
ae484d4501 AMTRELAY type 0 presentation format handling was wrong
RFC 8777 specifies a placeholder value of "." for the gateway field
when the gateway type is 0 (no gateway).
2025-11-20 18:28:32 +11:00
Colin Vidal
7427f45a84 harden configloading system test
The configloading system script attempts multiple `rndc
{reconfig,reload}` commands without ensuring the system left
exclusive mode; which normally raise an RNDC error as the server is
currently reloading already. This used to work because the request was
enqueued while the server was in exclusive mode, and was processed
after the server `reload_status` was reset to `NAMED_RELOAD_DONE`.

Due to the fact the exclusive mode is not retaken after
`apply_configuration()` by `load_zones()`, the scheduling of
pending tasks is changed and, regularly, the RNDC command sent by the
test is processed before `NAMED_RELOAD_DONE` is set. This is the same
kind of issue the views system tests had, solved by
`4b2dcb3128fbd5af4609a5a73aeeee1f93bde237`

Fix the problem by waiting for a log line matching the end of
the reloading phase.
2025-11-18 12:16:14 +01:00
Colin Vidal
5c038c2fa2 enforces bounds of prefetch statement
The prefetch statement now enforces its bounds. The configuration
(including `named-checkconf`) now fails if the trigger (first value) is
above 10, or if the eligibility (second optional value) isn't at least
six seconds more than the trigger value.
2025-11-18 10:19:15 +01:00
Colin Vidal
fd49c95070 enforces that catalog-zone can't be used in non IN views
Catalog-zones can't be used in view which are not from the IN class.
This is now enforced as the server won't load (instead of loading
without the catalog-zone). This configuration error is now also caught
by `named-checkconf`.
2025-11-18 10:08:42 +01:00
Nicki Křížek
f9858e4739 Use new EDE helper in existing system tests
Previously, hasattr("extended_errors") was used as a check to detect a
mimumum required dnspython version in order to only perform the EDE
check if a new-enough dnspython was present. This is now abstracted into
isctest.check.ede().

In order to support dnspython<2.2.0, use isctest.compat.EDECode rather
than using dns.edns.EDECode directly.
2025-11-10 15:41:51 +01:00
Nicki Křížek
61b3b415d5 Add isctest.check.ede() helper for pytest
Add a utility function to check for EDE options present in the DNS
message. The primary benefit of this helper function is that it
handles the compatibility issues with different dnspython versions
and the actual test code doesn't have to deal with that any more.

Rather than using the convenience .extended_errors() method
introduced in dnspython 2.7.0, iterate over the options and find
EDEOption types, which is supported from 2.2.0 onwards.

To work around the issue of using dns.edns.EDECode to specify EDE codes
in our tests, create an isctest.compat.EDECode wrapper. This can be used
even with dnspython versions prior to 2.2.0 and will simply result in
no-op, since EDE isn't supported in the older dnspython anyway.
2025-11-10 15:41:51 +01:00
Colin Vidal
e50edc9090 rewrite views/addzone in loop system test
A part of the `views` system test attempts to add multiples zones in a
loop, and after each zone being added, reconfig the server.

However, the test didn't take into account the fact that the server
might take a bit more time to reload than the script to move to the next
iteration, and in some case the test was re-requesting the server reload
when it was still reloading.

Since `b49f83a3`, `named` explicitly fails to reload when a load/reload
is pending, which is (unless proved otherwise) the reason of the test
was now randomly failing.

That part of the test is now waiting for the server log message saying
the server has added the new zone and is running. Also, that part of the
test has been rewrote in Python.
2025-11-07 15:07:56 +01:00
Colin Vidal
11a4df7ec5 split ede24 system test into separate modules
Because ede24 system tests require stopping/restarting server, there is
always the risk that the test ends (with a failure) with server in an
wrong and impredictible state. This would make the other tests to fail
in a strange way as well.

To avoid this problem, split the test into different modules, so if a
module fails, the other module is not impacted as it uses separate
server instances.
2025-11-06 15:13:29 +01:00
Colin Vidal
611a556a6c harden ede24 system test
There was a random failure of ede24 system test. While this is still a
bit speculative, the two reasons were:

- in the case of `test_ede24_noloaded` the test might attempt to early
  (before the zone actually transfered on the secondary server) to query
  ns2.

- still in the case of `test_ede24_noloaded`, even after waiting for
  transfer succeed logs, if the CI machine is slow, the zone could be
  expired before the request checking the secondary zone works because
  the expiration time of the zone was very short (1s). Moving this
  expiration time to 3 seconds should be enough (while not making the
  test execution too much longer when waiting for the zone expiration).

- in the case of `test_ede24_expired`, the zone expired flag is flipped
  and the log message is printed immediately after. However, it is
  possible that because the flag is set using a relaxed atomic
  operation, another thread process the query and gets the previous
  (non-expired) value of the flag. In order to workaround this, the
  test now also expects another log written after the zone expiration
  (stop timers) on the next UV tick.
2025-11-06 15:11:45 +01:00
Štěpán Balážik
35923a952e Fix NSEC3HASH system test on jammy
a94aab9440 removed importorskip call from
isctest.name on which the functionality of this test relied.

Add an explicit importorskip call to the test.
2025-11-05 10:51:26 +01:00
Ondřej Surý
488d7bfc75
Add a system test with one good and one bad algorithm
The case where there would be one supported algorithm and one already
unsupported (like RSAMD5 or RSASHA1) was missing.
2025-11-04 19:53:25 +01:00
Štěpán Balážik
072a82a6c5 Require dnspython>2.0.0 in system tests using asyncserver
Maintaining compatibility with pre-2.0.0 dnspython became cumbersome
leading to failure in nightly CI jobs which are the only ones that run
with dnspython this old.

Abort all AsyncServer instances when running with old dnspython. Add an
importor skip for all system tests using isctest.asyncserver.
2025-11-04 16:57:59 +01:00
Štěpán Balážik
a94aab9440 Don't use pytest.importorskip in isctest.name
They can be used outside of test modules (like ans.py custom servers)
which leads to pytest.outcomes.Skipped being raised in weird places and
skipping of tests which don't need dnspython this new.

Remove pytest.importskip from top scope in isctest.name, only run the
check when ZoneAnalyzer is used.
2025-11-04 16:57:59 +01:00
Colin Vidal
a18cac7917 "named-checkconf -b" dumps built-in config
`named-checkconf` now supports the command line switch `-b`,  which
prints the default built-in configuration used by `named`.

When `-b` is in use, other options are ignored.
2025-11-04 09:26:33 +01:00
Aram Sargsyan
0e8c547e5b Test dig with a IPv4 source address and a IPv4+IPv6 server
Check that dig doesn't exit with an assertion failure when a IPv4
source address is defined after defining a server address which has
both IPv4 and IPv6 addresses (in this case, @localhost).
2025-11-03 19:37:09 +00:00
Colin Vidal
082e1aa834 add tests for EDE 24 support
Add system test covering EDE 24 being added in the response in both
common cases: when the server has not loaded the DB of a zone and when
the zone has expired (secondary).
2025-11-03 17:34:25 +01:00
Colin Vidal
eb06487568 add system test for rndc showconf
Add system tests covering the rndc showconf command. It doesn't
attempt to check the whole effective configuration (as any change to the
builtin configuration would break it) but instead ensures that some parts
of the user config are present, as well as some parts of the builtin
config as well.

It also checks that the effective config (in this context of running
named instance) is about static configuration: a newly added zone is not
visible in the effective configuration.
2025-10-29 23:49:49 +01:00
Colin Vidal
bd2c9594ba add system test for named-checkconf -e
Add a system test checking the command line switch -e of
named-checkconf. The test doesn't care about the whole output of the
effective configuration (in particular to avoid breaking the test for
each default statement that would change) but instead just ensure the
effective configuration is actually returned by checking the presence of
the _bind chaos builtin view as well a user provided view and option
change.
2025-10-29 23:49:25 +01:00
Colin Vidal
7ff1b7ef21 introduce default config builtin-root-anchors
Since the effective configuration tree is a "merged" configuration tree
from the user and the default configurations, the effective configuration
provides a unique configuration tree used by apply_confiuration() to
configure the server.

However, there is one specific case where the configuration code needs
to differentiate whether the configuration originally came from the
default or the user configuration: the trust-anchors. This is because
the default trust-anchors _have_ to be those for the root zone, and the
one provided by the user can be for any zone. A check enforces this.

In order to keep this difference visible from the configuration code,
with a unique configuration tree, we now introduce a default-only
`builtin-trust-anchors` statement which holds the builtin root
trust-anchors. It can't be used from the user configuration (this would
raise an error), hence it is not documented.
2025-10-29 13:55:47 -07:00
Colin Vidal
2cd04e0bd0 fix serve-stale system test after moving defconfig
The serve-stale system test relies on sed accessing the source
file that hard-codes the default configuration. Since it moved from
bin/named/config.c into bin/include/defaultconfig.h, the test needs
the path updated.
2025-10-29 13:55:04 -07:00
Štěpán Balážik
2ba3726207 Use isctest.asyncserver in the "statistics" test
Reimplement the custom server using the asyncserver Python module.

Behavior change: The new server doesn't copy CD and DO flags and a
client cookie to responses.
2025-10-29 18:09:52 +01:00
Michał Kępień
a556199c7b Add a response handler matching on specific QNAMEs
Add a new ResponseHandler subclass, QnameHandler, which enables
conveniently matching specific QNAMEs (without also matching their
subdomains like DomainHandler does).
2025-10-29 18:09:52 +01:00
Štěpán Balážik
848b721d1d Allow users of AsyncDnsServer to set a default RCODE
This is mostly for cases where no zone is set up and all response stubs
come to response handler with REFUSED as RCODE.

This commit allows to override the RCODE before QueryContext is passed
to response handlers.
2025-10-29 18:09:25 +01:00
Štěpán Balážik
02c2f76e30 Use isctest.asyncserver in the "cookie" test
Replace the custom DNS servers in the "cookie" system test with new code
based on the isctest.asyncserver module. The convoluted test logic is
split into multiple response handlers which are shared between the two
servers.

Behavior change: returned SOA records have the zone name set properly.
2025-10-29 16:26:15 +01:00
Štěpán Balážik
1faf5c47a5 Use isctest.asyncserver in the "rpzrecurse" test
Replace the custom server with new implementation using the
AsyncDnsServer class.

Behavior changes:
- DNS cookie is not copied to the responses.
- CD, DO flags aren't set on responses.
2025-10-29 15:10:25 +01:00
Štěpán Balážik
ade2e995a9 Use isctest.asyncserver in the "dnssec" test
Reimplement the custom server using isctest.asyncserver. Factor most of
the logic out of the server code to two (identical) zones and only
implement the non-standard behavior.

Behavior changes:
- RRSIG Expiration and Inception is now static and covering the whole
  timeline instead of being calculated everytime.
- NXDOMAIN is returned where suitable by standard.
- Returned SOA records have properly set zone names.
2025-10-29 14:20:02 +01:00
Mark Andrews
ba5053cddf Fix "good-viewzonelevel.conf.j2 has hard coded library extension"
Use @DYLIB@ instead of hard coded extension "so".
2025-10-28 05:40:28 +11:00
Mark Andrews
de81887c2a test-syncplugin.c:plugin_register was broken
The variables example2com, example3com, and example4com where not
being initalised on all paths leading to Coverity issues ID 637690,
ID 637691 and ID 637692 being raised.  In addition the tests to free
them were wrong as they depended on the unintialised variables. This
has been fixed.
2025-10-27 23:00:08 +11:00
Michał Kępień
5110dbacb9
Remove unused Perl scripts
The traffic-json.pl and traffic-xml.pl scripts that were used in the
"statschannel" system test in the past became dead code when commit
1202fd912a rewrote parts of that test to
Python.  Remove those scripts.
2025-10-25 07:37:48 +02:00
Michał Kępień
5872000d9e
Use xmllint in system tests inspecting XML data
Inspecting XML data using sed and grep is error-prone, overly lax in
some ways, overly strict in others, and neither accurate nor expressive.
Use xmllint and XPath expressions for inspecting XML data in the
"statistics", "statschannel", and "synthfromdnssec" system tests to
address these deficiencies.
2025-10-25 07:37:48 +02:00
Michał Kępień
85773d4d21
Detect xmllint at build time
Detect whether and where the xmllint utility is available at build time,
so that it can be used in system tests.  If the tool is not found,
specific checks employing it will be skipped.
2025-10-25 07:37:48 +02:00
Michał Kępień
b494e02761
Use jq in system tests inspecting JSON data
Inspecting JSON data using grep is error-prone, overly lax in some ways,
overly strict in others, and neither accurate nor expressive.  Use jq
for inspecting JSON data in the "statschannel" and "synthfromdnssec"
system tests to address these deficiencies.
2025-10-25 07:37:48 +02:00
Michał Kępień
273b4bbfd7
Detect jq at build time
Detect whether and where the jq utility is available at build time, so
that it can be used in system tests.  If the tool is not found, specific
checks employing it will be skipped.
2025-10-25 07:37:48 +02:00
Colin Vidal
6f4d4ddb1c test rndc showzone works for named.conf zones
Since the zone now has a reference to their respective configuration
tree, `rndc showzone` can be used for any zones (including those
defined in namedconf), without `allow-new-zones` being enabled.
Add a test for this.

The test is part of the addzone suite because showzone used to be
related to addzone, but this could be moved elsewhere in the future
if more specific tests are needed for showzone.
2025-10-23 13:01:11 -07:00
Colin Vidal
6b5246b3d2 ensure parser/cfg_obj log includes the line number
Since the `file` property of cfg_obj_t can now be null (instead of
"none"), cfg_obj_t would take a fallback flow where the line was not
logged. This fixes it.

Also, add the log line when parser_complain is called and `file` is null
(which might happend when parsing buffer only) to also include the line
number.
2025-10-23 13:01:11 -07:00
Colin Vidal
d03f6e6fd4 cfg_parse_ functions internally handle the parser
Instead of (1) allocating a parser, (2) parsing a file/buffer then (3)
freeing the parser, the parser is now internally created/destroyed from
within the `cfg_parse_*` functions. This simplifies a lot the use cases,
especially around the error cases where the parser needs to be freed in
a cleanup goto.

The only trick was the parser callback mechanism, which would previously
have been set up between steps 1 and 2.  Since it's never been used for
any purpose other than the "directory" option, the chdir call has now
been moved inside the parser and the generic callback mechanism has been
removed, replacing CFG_CLAUSEFLAG_CALLBACK with CFG_CLAUSEFLAG_CHDIR.
2025-10-23 13:01:08 -07:00
Evan Hunt
6de1d0dbc4 update cfg_obj_attach/destroy
now that cfg_obj_destroy() has been simplified, we can use the
ISC_REFCOUNT macros to declare cfg_obj_attach() and _detach().
2025-10-23 13:01:02 -07:00
Colin Vidal
7706f5acec remove parser context field from cfg_obj_t
cfg_obj_t doesn't store a pointer to its a parser context anymore,
and does not depend on the parser's lifecycle. Instead, it stores a
reference to its own memory context (and in principle, each node
could have different memory context). This also slightly simplifies
the _destroy API as there is no need to pass a context through it
anymore.
2025-10-23 12:59:58 -07:00
Štěpán Balážik
99b0cf2dd7 Use isctest.asyncserver in the "nsupdate" test
Reimplement the custom server written in Perl in Python using the
AsyncDnsServer class.
2025-10-23 11:44:20 +00:00
Štěpán Balážik
4042b805ff Enable ignoring TCP connections
Add a TCP connection handler, IgnoreAllConnections that allows
establishing TCP connection but not reading anything from it.

This re-uses the horrible hack from ConnectionReset handler and might
break at any point in the future.

See the comments and e407888507 for more
details.
2025-10-23 11:44:20 +00:00
Petr Špaček
0e770685d6 Fix typo in tools test's shell path 2025-10-22 13:50:08 +11:00
Nicki Křížek
377724c26d Use common name for post-startup server functions
Unify the names of autouse module-wide fixtures that perform
after_servers_start() setup. The consistent naming doesn't just help
readability, but also makes it simpler for the vulture exception (since
it doesn't properly deal with autouse fixtures).
2025-10-21 15:07:49 +02:00
Nicki Křížek
fb4345afd4 Use bootstrap() in pytest where applicable
Replace the autouse fixtures which were only used to change the initial
server configuration into proper bootstrap() functions. This gets rid of
an extraneous reconfigure.

In the tests_validation_many_anchors.py, split the fixture into a proper
bootstrap() and a separate test for checking the expected log lines for
the ignored keys. Previously, the test was broken - it should check for
all the messages being present in the log, and some of the keys are
actually initial-key rather than static-key. This has been fixed in the
parametrized test.
2025-10-21 15:07:49 +02:00
Nicki Křížek
7474d38295 Add module-specific python setup to system tests
During the system test execution, allow use of module-specific
bootstrap() function in addition to the setup.sh script which this
function should ultimately replace.

The purpose of bootstrap() is two-fold. First, it can execute any
commands needed to create the initial conditions for the test, such as
creating key materials, manipulating files etc. Second, it should return
any test-specific template values as a dictionary. Those will be used to
render the jinja2 templates.
2025-10-21 15:07:49 +02:00
Evan Hunt
43f53b5010 report when zone reload already in progress
if a zone reload is already in progress when 'rndc reload <zone>' is
run, currently the message returned in "zone reload queued", which
is correct, but it's identical to the message returned when a reload
was *not* in progress, so the user can't easily tell what happened.
a user could reload a zone twice and not realize that only one
reload actually took place.

this has been addressed by changing the message returned to
"zone reload was already queued".

a new result code ISC_R_LOADING has been added to signal this
condition, taking the place of ISC_R_RELOAD, which was obsolete
and has been removed.
2025-10-17 20:36:18 +00:00
Colin Vidal
2b4825dbad fix random failure on synthrecord system test
One of the synthrecord system tests uses a test function to generate an
expected name based on some randomly generated IPv6 (using Hypothesis).
Turns out the test function generating the name didn't handle the case
where the label which encodes the IPv6 could have a leading or trailing
'-' character. (The plugin needs to add a leading or trailing 0 so as
not to break IDN compatibility.)
2025-10-17 12:28:04 -07:00
Mark Andrews
3a7f8e1d12 Expect created.* and unused.* files 2025-10-16 10:22:43 +11:00
Mark Andrews
a0abef4fa3 Don't hardcode shared library extension 2025-10-15 17:51:55 +11:00
Mark Andrews
5beba4d292 'nextpart' and 'grep -q' don't work together
'nextpart file | grep -q' doesn't work as expected.  'grep -q' is not
required to read all of the input and that causes 'nextpart' to fail.
2025-10-14 17:47:25 +11:00
Evan Hunt
a373671f5e remove "bindkeys-file" option
The bindkeys-file option was only used for testing purposes, and
has now been replaced with a "-T bindkeys=<filename>" option for
named.
2025-10-12 23:37:49 -07:00
Evan Hunt
15b0ff5036 clean up bind.keys
the comments in the bind.keys file were outdated; the file now only
exists to be converted into bind.keys.h and compiled into named and
delv.

some tests also referenced it, and have been cleaned up, since
the keys in it are already built into named.
2025-10-10 17:41:07 -07:00
Nicki Křížek
2ecbe46e0d Disable keyfromlabel collision avoidance in tests
With the collision avoidance on, some of the tests would occasionally
fail. None of the tests using keyfromlabel are revoking the keys so it
should be safe to disable it.
2025-10-10 10:39:04 +02:00
Matthijs Mekking
2d7ab28ce2 Make properties direct attribute of KeyProperties
There is no real reason to keep those in a dictionary.
2025-10-08 09:56:58 +02:00
Matthijs Mekking
ade333bb64 Remove KeyProperties property expect
This property is unused, so we can just remove it.
2025-10-08 09:56:58 +02:00
Michał Kępień
73197feec7
Stop using "tkey-gssapi-credential" in tests
Since the "tkey-gssapi-credential" statement is now deprecated and is
about to be removed, migrate the only system test using it ("nsupdate")
to "tkey-gssapi-keytab".

Currently, the GSS-TSIG parts of the "nsupdate" system test require
properly setting up a combination of:

  - "tkey-gssapi-credential" statements in named.conf files,
  - the KRB5_KTNAME environment variable.

Specifically, this configuration causes named startup to include
acquiring the credential that GSS-API is allowed to match keys against
from a keytab file specified by the KRB5_KTNAME environment variable.

By contrast, the revised configuration uses the "tkey-gssapi-keytab"
statement, which makes GSS-API match keys against any credential present
in the specified keytab file.

Since both keytabs in question (ns9/dns.keytab, ns10/dns.keytab) only
contain a single credential, the two configurations are functionally
equivalent, with the revised one being significantly more readable and
simpler to prepare.
2025-10-06 13:19:50 +02:00
Michał Kępień
99d4e7a944
Reorganize imports in tests_synthrecord.py
bin/tests/system/synthrecord/tests_synthrecord.py imports hypothesis
before importing isctest.hypothesis, which causes the "synthrecord"
system test to fail on platforms on which the Hypothesis module is not
available.  Reorganize Python imports in tests_synthrecord.py to fix the
above issue and also to make it more in line with other similar test
scripts.
2025-10-02 11:13:05 +02:00
Matthijs Mekking
893f417e1e Convert kasp sub-test comments to info logs
Follow-up on the discussion on the kasp system test rewrite to pytest.
2025-10-02 07:23:05 +00:00
Colin Vidal
62002cfa9c rename ns_pluginregister_ctx_t into ns_pluginctx_t
The type `ns_pluginregister_ctx_t` was initially added to pass plugin
contextual data when the plugin is registered, but this is also now
passed into `plugin_check`. Furthermore, those various data are not
specific to the registration in particular. Rename the type into
`ns_pluginctx_t` for clarity.
2025-10-01 20:20:48 +02:00
Evan Hunt
a8f2f41013 make "origin" optional for forward zones
The "origin" parameter for synthrecord is now mandatory for reverse
zones, but when configured in a non-reverse zone, it will default to
the zone name.
2025-10-01 12:16:05 +02:00
Evan Hunt
c4b5deb750 remove "mode" parameter from synthrecord
the plugin's operating mode is now determined automatically
from the zone name: if the name ends in "ip6.arpa" or "in-addr.arpa",
then the plugin is in reverse mode, otherwise forward.
2025-10-01 12:16:05 +02:00
Colin Vidal
c201b429f4 add synthesized record system tests
Add system tests for the dynamically synthesized record plugin. This
covers the various cases the plugin should handle: generating a PTR
record only when (1) no answer is found locally and (2) the IP address
extracted from the query name is part of an allowed network. This also
covered the cases of forward synthesized records; answering a A/AAAA/ANY
query from a PTR address when this match the prefix, ACL and origin.
2025-10-01 12:16:05 +02:00
Colin Vidal
25e258fb0b provide a context structure for plugin_register()
This commit introduces a new type, ns_pluginregister_ctx_t,
which is passed to plugin_check() and plugin_register() in place of the
'source' parameter. The source value is now just part of the structure,
which also holds a pointer to the zone origin if the plugin is loaded at
a zone level.

This provides more contextual information, enabling the plugin to make
specific configuration decisions based on the name of the zone for which
it is loaded.

It's also flexible if more contextual data are needed in the future:
add a new field to ns_pluginregister_ctx_t, and new plugins can use
it without affecting compatibility with existing plugins.
2025-10-01 11:11:00 +02:00
Evan Hunt
92cefc52bc check plugin config before registering
In named_config_parsefile(), when checking the validity of
named.conf, the checking of plugin correctness was deliberately
postponed until the plugin is loaded and registered. However,
when the plugin was registered, the checking was never actually
done: the plugin_register() implementation was called, but
plugin_check() was not.

This made it necessary to duplicate the correctness checking in both
functions, so that both named-checkconf and named could catch errors.
That should not be required.

ns_plugin_register() now calls the check function before the register
function, and aborts if either one fails.  ns_plugin_check() calls only
the check function.  ns_plugin_check() is used by named-checkconf, and
ns_plugin_register() is used by named. (Note: this design has a
side effect that a call to ns_plugin_register() will result in the
plugin parameters being parsed twice at registration time.)

ns_plugin_check() now takes an additional argument for the hook
source: zone or view.
2025-09-30 15:42:26 -07:00
Colin Vidal
47dd27d87b test views are detached before leaving exclusive mode
Adds a log-based test ensuring that when a reconfiguration fails inside
the view configuration, the newly created view are always detached
before the exclusive mode is ended.
2025-09-26 14:55:01 +02:00
Matthijs Mekking
acbf110b18 Test the next key event after full sign
After a full sign we no longer have to need to take the sign delay into
account.
2025-09-26 12:49:23 +02:00
Matthijs Mekking
008d3d2a9c Test rndc sign updates the signatures
Add a check to the ZSK rollover test case that ensures the zone is
signed with the successor key only, after a 'rndc sign' is commanded.
2025-09-26 12:49:23 +02:00
Matthijs Mekking
81d3a29e4e Check disable-algorithms with non-zone names
Test that if disable-algorithms is configured on a name that is below
the zonecut, it still validates (z.secure.example).

Test that if disable-algorithms is configured on a name that is above
the zonecut, it is treated as insecure (zonecut.ent.secure.example).
2025-09-25 11:14:27 +10:00
Mark Andrews
21934102d3 Check that badalg.secure.example resolves
Previously, badalg.secure.example would return SERVFAIL because the DS
records (from the parent) could not be validated.
2025-09-25 11:14:27 +10:00
Mark Andrews
a0945f6337 Use signer name when disabling DNSSEC algorithms
When disabling algorithms, use the signer name to determine if the
algorithm is disabled or not.  This allows for algorithms to be
cleanly disabled on a zone level basis.  Previously, just using the
records owner name, "disable-algorithms" could impact resolution of
names that where not disabled.  This does now mean that
"disable-algorithms" can not be used to disable part of a zone anymore.
2025-09-25 11:14:27 +10:00
Colin Vidal
36a05c81b4 rename cfg_aclconfctx_t variables to aclctx
ACL configuration context variables are inconsistently named as `actx`,
`ac`, or `aclconfctx`, which caused confusion during code reviews. This
commit renames all `cfg_aclconfctx_t` variables to `aclctx`, which is
short, consistent, and unambiguous.
2025-09-24 20:14:49 +02:00
Matthijs Mekking
dcd49f2ead Change checkconf to include built-in dnssec-policy
The configuration should also take into account the built-in
DNSSEC policies when verifying the keys in the key-directory match the
given policy. Update the code accordingly and add some good and
failure test cases.
2025-09-24 17:03:06 +02:00
Matthijs Mekking
3918a8ca4c Test named-checkconf -k
Test named-checkconf -k option, that checks the dnssec-policy against
the configured keystores.
2025-09-24 17:03:06 +02:00
Nicki Křížek
7e118fdb06 Re-enable delv tests with TSAN
With the loopmgr rewrite in 9.20, the delv issue shoud no longer happen,
thus the delv tests can be executed under TSAN as well.
2025-09-24 13:34:16 +02:00
Colin Vidal
3fe239e5cf apply_configuration: log subroutines for tests
In order to have a (minimal) test ensuring we don't move back
`apply_configuration` subroutines which can be done before the exclusive
lock is taken, `APPLY_CONFIGURATION_SUBROUTINE_LOG` macro is added and
used for the few subroutines already extracted from the exclusive mode.
Those expected logs are added in `configloading` system test checks.
2025-09-24 10:54:50 +02:00
Colin Vidal
714693742e test that cache is preserved on reconfing failure
A named bug scrap the cache on a second reload after an initial reload
failure. Adds a test checking that the cache is preserved between server
reconfiguration/reloads even if it fails at some point (after attempting
to re-use the cache) and the server is re-loaded later.
2025-09-17 16:45:51 +02:00
Ondřej Surý
9e2d5d94bd
Remove dns_dbtree_t and its usage
As we removed the ability to count nodes in the auxiliary trees (because
there are no auxiliary trees), we can also cleanup the API and
associated enum type (dns_dbtree_t).
2025-09-17 15:58:44 +02:00
Ondřej Surý
70c8054b84
Remove CacheNSECNodes statistics counter
There is no auxiliary NSEC tree, so we can't count the NSEC nodes
separately.  Remove the CacheNSECNodes statistics counter as it would be
always zero.
2025-09-17 15:58:44 +02:00
Petr Špaček
339e5162d6 Add ability to load root zone into AsyncServer
We would prefer if explicit $ORIGIN is used only for root zone and
nothing else, solely to avoid zone files named "..db". For all other
zones the file name should match zone name.
2025-09-17 15:20:22 +02:00
Evan Hunt
b2009e1ebc remove unnecessary dns_db_nodefullname()
now that node->name is accessible as a common dbnode member,
it's no longer necessary to provide an API call for that.
2025-09-15 16:11:50 +00:00
Evan Hunt
4de396f955 merge dns_db_find/findext and dns_db_findnode/findnodeext
the dns_db_findext and _findnodeext calls are extended versions
of dns_db_find and _findnode, which take additional arguments for
client information in order to support ECS. previously, database
implementations could support either API call, with cross-compatibility
so that, for example, dns_db_findext() could call a find implementation
if findext was not implemented, and dns_db_find() could call findext
if find was not implemented.

this has now been simplified. the find and findnodeext implementations
now support client info.  all database implementations will now provide
these calls.  implementations which do not support ECS will simply
ignore the clientinfo and clientinfomethods parameters.

this only affects the underlying implementation; callers will still
use the same interface. dns_db_find() and dns_db_findnode() are now
macros which pass NULL to the clientinfo parameters, so that callers
don't have to do so explicitly. dns_db_findext() and dns_db_findnodeext()
are still available for callers that do wish to pass clientinfo pointers.
2025-09-15 16:11:50 +00:00
Evan Hunt
7e7d8bece7 remove obsolete dns_db_setloop()
no database implementation has needed an event loop
since the RBT cache was removed, so the setloop API call
is no longer needed.
2025-09-15 16:11:50 +00:00
Evan Hunt
0cdcc8a8f4 rename NS_QUERY_RESET to NS_QUERY_CLEANUP
query_reset() is called during query initialization, but the only
time the NS_QUERY_SETUP hook runs is when it's called from
query_cleanup().  it makes more sense to move the hook point to
there and rename it to NS_QUERY_CLEANUP.

this change caused a crash in the unit tests due to the view being
unnecessarily detached before ns__client_reset_cb() was called.
this has also been fixed.
2025-09-10 17:46:53 -07:00
Evan Hunt
8204843bc4 convert config sh-based hooks tests to python
The test cases that call named-checkconf have been moved from
tests.sh into the python tests, which are now renamed back
to tests_hooks.py.
2025-09-10 12:43:05 +02:00
Mark Andrews
b7e73edd12 test that rrsigs are returned for glue with +cd 2025-09-10 14:20:22 +10:00
Evan Hunt
7f69a20963 remove 'signer' files from dnssec test
when the dnssec-signzone tests were moved to the dnssectools
system test, a unused copy of the 'signer' directory was left in
the dnssec test. This has been removed.
2025-09-10 04:12:01 +00:00