2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00
Commit Graph

41946 Commits

Author SHA1 Message Date
Matthijs Mekking
2e5a2f4e81 Allow empty CDNSKEY/CDS RRset in ksr system test
When the zone is initially signed, the CDNSKEY/CDS RRset is not
immediately published. The DNSKEY and signatures must propagate first.
Adjust the test to allow for this case.

(cherry picked from commit 708927e03d)
2024-11-04 01:10:34 +00:00
Matthijs Mekking
a92fb659d3 dnssec-ksr keygen -o to create KSKs
Add an option to dnssec-ksr keygen, -o, to create KSKs instead of ZSKs.
This way, we can create a set of KSKS for a given period too.

For KSKs we also need to set timing metadata, including "SyncPublish"
and "SyncDelete". This functionality already exists in keymgr.c so
let's make the function accessible.

Replace dnssec-keygen calls with dnssec-ksr keygen for KSK in the
ksr system test and check keys for created KSKs as well. This requires
a slight modification of the check_keys function to take into account
KSK timings and metadata.

(cherry picked from commit 680aedb595)
2024-11-04 01:10:34 +00:00
Matthijs Mekking
1adcb2945e Add -f option to dnssec-ksr documentation
This was previously left out by error.

(cherry picked from commit 01169b7ffc)
2024-11-04 01:10:34 +00:00
Mark Andrews
2d4d8382c8 [9.20] fix: nil: TLS notify checks fail on OL 8 FIPS
Add missing checks for `$FEATURETEST --have-fips-dh` in notify system test to match those in setup.sh.

Closes #5015

Backport of MR !9707

Merge branch 'backport-5015-tls-notify-checks-fail-on-ol-8-fips-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9712
2024-11-02 06:36:41 +00:00
Mark Andrews
f793b28de4 Add missing $FEATURETEST --have-fips-dh
Notify over TLS only works if FIPS DH is supported.  Skip the system
tests parts that depend on it.

(cherry picked from commit 4f7e3e29a7)
2024-11-02 06:02:51 +00:00
Matthijs Mekking
ba2e8fe5f9 [9.20] chg: test: Match algorithms when checking signatures
In the ksr system test, the 'test_ksr_twotone' case may fail if there are two keys with the same keytag (but different algorithms), because one key is expected to be signing and the other is not.

Switch to regular expression matching and include the algorithm in the search string.

Closes #5017

Backport of MR !9701

Merge branch 'backport-5017-unexpected-match-ksr-twotone-again-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9710
2024-11-01 14:51:01 +00:00
Matthijs Mekking
9621369524 Match algorithms when checking signatures
In the ksr system test, the test_ksr_twotone case may fail if there
are two keys with the same keytag (but different algorithms), because
one key is expected to be signing and the other is not.

Switch to regular expression matching and include the algorithm in the
search string.

(cherry picked from commit 795fcc9f80)
2024-11-01 14:16:38 +00:00
Michal Nowak
b02f039d3a [9.20] chg: test: Rewrite rsabigexponent system test to pytest
Backport of MR !9157

Merge branch 'backport-mnowak/pytest_rewrite_rsabigexponent-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9705
2024-10-31 18:57:28 +00:00
Michal Nowak
ba1d4cc4db Rewrite rsabigexponent system test to pytest
(cherry picked from commit cacff68e78)
2024-10-31 18:15:14 +00:00
Michal Nowak
4f4a39e910 [9.20] fix: doc: Remove the CHANGES file
With the introduction of the generated changelog, the CHANGES file
became a symlink to doc/arm/changelog.rst. After the changes made in
!9549, the changelog file transitioned from being a wholly generated
file to one that includes versioned changelog files, which are
themselves generated. However, while implementing !9549, we overlooked
that the CHANGES file is copied to a release directory on an FTP server
and contains just "include" directives, not the changelog itself.
Therefore, in the same fashion as the "RELEASE-NOTES*.html" file, create
a "CHANGELOG*.html" file that redirects to the Changelog appendix of the
ARM.

Closes #5000

Backport of MR !9690

Merge branch 'backport-5000-provide-correct-changelog-on-ftp-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9703
2024-10-31 18:11:43 +00:00
Michal Nowak
daab2defe6 Fix changelog history header
(cherry picked from commit 9750f22e3a)
2024-10-31 16:46:58 +00:00
Michal Nowak
3ed3ace466 Remove the CHANGES file
With the introduction of the generated changelog, the CHANGES file
became a symlink to doc/arm/changelog.rst. After the changes made in
!9549, the changelog file transitioned from being a wholly generated
file to one that includes versioned changelog files, which are
themselves generated. However, while implementing !9549, we overlooked
that the CHANGES file is copied to a release directory on an FTP server
and contains just "include" directives, not the changelog itself.
Therefore, in the same fashion as the "RELEASE-NOTES*.html" file, create
a "CHANGELOG*.html" file that redirects to the Changelog appendix of the
ARM.

(cherry picked from commit e40bd273e4)
2024-10-31 16:46:57 +00:00
Nicki Křížek
4a9380835f [9.20] new: dev: Support jinja2 templates in pytest runner
Configuration files in system tests which require some variables (e.g.
port numbers) filled in during test setup, can now use jinja2 templates
when `jinja2` python package is available.

Any `*.j2` file found within the system test directory will be
automatically rendered with the environment variables into a file
without the `.j2` extension by the pytest runner. E.g.
`ns1/named.conf.j2` will become `ns1/named.conf` during test setup. To
avoid automatic rendering, use `.j2.manual` extension and render the
files manually at test time.

New `templates` pytest fixture has been added. Its `render()` function
can be used to render a template with custom test variables. This can be
useful to fill in different config options during the test. With
advanced jinja2 template syntax, it can also be used to include/omit
entire sections of the config file rather than using `named1.conf.in`,
`named2.conf.in` etc.

Closes #4938

Backport of MR !9587

Merge branch 'backport-4938-use-jinja2-templates-in-system-tests-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9699
2024-10-31 12:13:09 +00:00
Nicki Křížek
668544ec74 Support jinja2 templates in pytest runner
Configuration files in system tests which require some variables (e.g.
port numbers) filled in during test setup, can now use jinja2 templates
when `jinja2` python package is available.

Any `*.j2` file found within the system test directory will be
automatically rendered with the environment variables into a file
without the `.j2` extension by the pytest runner. E.g.
`ns1/named.conf.j2` will become `ns1/named.conf` during test setup. To
avoid automatic rendering, use `.j2.manual` extension and render the
files manually at test time.

New `templates` pytest fixture has been added. Its `render()` function
can be used to render a template with custom test variables. This can be
useful to fill in different config options during the test. With
advanced jinja2 template syntax, it can also be used to include/omit
entire sections of the config file rather than using `named1.conf.in`,
`named2.conf.in` etc.

(cherry picked from commit 60e118c4fb)
2024-10-31 09:40:46 +00:00
Matthijs Mekking
efc790c715 chg: doc: Make inline-signing default value change more clear in documentation
Emphasize more that the `inline-signing` default value has changed in 9.20.0.

Merge branch 'matthijs-improve-release-notes-wrt-inline-signing-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9647
2024-10-30 16:11:01 +00:00
Matthijs Mekking
77d54c03dd Make inline-signing default value change more clear
Emphasize more that the inline-signing default value has changed in
9.20.0.
2024-10-30 15:57:36 +01:00
Nicki Křížek
b4c79bdcdf [9.20] chg: ci: Make changelog audience mandatory
Backport of MR !9628

Merge branch 'backport-nicki/harazd-enforce-mr-title-audience-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9696
2024-10-29 16:12:35 +00:00
Nicki Křížek
babdac49c8 Make changelog audience mandatory
Use a stricter hazard check which ensures the audience tag is present in
the MR title and is one of the known values. This prevents siuations
where incorrect audience is accidentally used, resulting in a missing
changelog entry or a release note.

(cherry picked from commit cdb93bcbd4)
2024-10-29 16:03:31 +00:00
Matthijs Mekking
7995ebf009 [9.20] fix: test: Fix CID 510858: Null ptr derefs in check_keys
Coverity Scan reported a new issue for the ksr system test. There is allegedly a null pointer dereference (FORWARD_NULL) in check_keys().

This popped up because previously we set 'retired' to 0 in case of unlimited lifetime, but we changed it to None.

It is actually a false positive, because if lifetime is unlimited there will be only one key in 'keys'.

However, the code would be better if we always initialized 'active' and if it is not the first key and retired is set, set the successor key's active time to the retire time of the predecessor key.

Closes #5004

Backport of MR !9687

Merge branch 'backport-5004-cid-510858-ksr-check-keys-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9693
2024-10-25 14:08:04 +00:00
Matthijs Mekking
5c724d4c25 Fix CID 510858: Null ptr derefs in check_keys
Coverity Scan reported a new issue for the ksr system test. There
is allegedly a null pointer dereference (FORWARD_NULL) in check_keys().

This popped up because previously we set 'retired' to 0 in case of
unlimited lifetime, but we changed it to None.

It is actually a false positive, because if lifetime is unlimited
there will be only one key in 'keys'.

However, the code would be better if we always initialized 'active'
and if it is not the first key and retired is set, set the successor
key's active time to the retire time of the predecessor key.

(cherry picked from commit e777efb576)
2024-10-25 11:22:26 +00:00
Matthijs Mekking
c905bf1c71 [9.20] fix: test: Fix intermittent ksr test failure
A test may fail if the key id is shorter than 5 digits. Add a leading space to the expected strings which start with the key tag to avoid the issue.

Closes #5002

Backport of MR !9688

Merge branch 'backport-5002-unexpected-match-ksr-twotwone-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9692
2024-10-25 09:25:27 +00:00
Matthijs Mekking
8a598cb3bf Fix intermittent ksr test failure
The test_ksr_twotwone may fail if the key id is shorter than 5 digits.
Add a leading space to the expected strings which start with the key
tag to avoid the issue.

(cherry picked from commit d5f32f6990)
2024-10-25 07:47:01 +00:00
Nicki Křížek
401964d188 [9.20] fix: test: Make system tests compatible with pytest 8.0.0+
Make system tests symlinks and logged test names consistent across pytest versions.

Backport of MR !9071

Merge branch 'backport-nicki/pytest-v8-compat-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9685
2024-10-24 12:28:25 +00:00
Nicki Křížek
93356d6b3a Add legacy.run.sh to .gitignore
While this file is no longer created / used in the main branch, it may
linger around when switching from maintenance branches.

(cherry picked from commit 6262d002bf)
2024-10-24 11:55:18 +00:00
Nicki Křížek
04200e4025 Make system tests compatible with pytest 8.0.0+
The pytest collection mechanism has been overhauled in pytest 8.0.0,
resulting in a different node tree when collecting the tests. Ensure the
paths / names we're using that are derived from the node tree are
consistent across different pytest versions.

Particularly, this has affected the convenience symlink name (which is
supposed to be in the form of e.g. dns64_sh_dns64 for the dns64 module
and tests_sh_dns64.py module) and the test name that's logged at the
start of the test, which is supposed to include the system test
directory relative to the root system test directory as well as the
module name (e.g. dns64/tests_sh_dns64.py).

Related https://github.com/pytest-dev/pytest/issues/7777

(cherry picked from commit 7118cbed98)
2024-10-24 11:55:18 +00:00
Mark Andrews
c1b82c1fb8 [9.20] fix: usr: Use TLS for notifies if configured to do so
Notifies configured to use TLS will now be sent over TLS, instead of plaintext UDP or TCP.
Also, failing to load the TLS configuration for notify now also results in an error.

Closes #4821

Backport of MR !9407

Merge branch 'backport-4821-notify-over-tls-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9684
2024-10-24 06:01:40 +00:00
Timo Eisenmann
a9faeb86aa Use correct certificates for TLS notify tests
Use tls-forward-secrecy instead of tls-expired for tls-x2 and regenerate
the expired certificate for tls-x6 to reflect the swap of ns2 and ns3.

(cherry picked from commit bbdc6b26aa)
2024-10-24 03:11:50 +00:00
Mark Andrews
08f12c70e6 swap ns2 and ns3 rolls in tls notify tests
Still need to regenerate the expired certificate as it has
the wrong IP address

(cherry picked from commit 87e287c984)
2024-10-24 03:11:50 +00:00
Timo Eisenmann
1b59467e82 Add system tests for notify over TLS
We use ns2 as the primary, and ns3 as the secondary server.

(cherry picked from commit e00beca8c5)
2024-10-24 03:11:50 +00:00
Timo Eisenmann
7a5b3c39fc Use TLS for notifies if configured to do so
(cherry picked from commit e9d54d798f)
2024-10-24 03:11:50 +00:00
Mark Andrews
09fb8e354a [9.20] fix: dev: Transport needs to be a selector when looking for an existing dispatch
This allows for dispatch to use existing TCP/HTTPS/TLS etc. streams without accidentally using an unexpected transport.

Closes #4989

Backport of MR !9633

Merge branch 'backport-4989-fix-transport-use-with-dispatch-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9682
2024-10-24 01:57:28 +00:00
Mark Andrews
d5da28d1ca Fix TCP dispatches and transport
Dispatch needs to know the transport that is being used over the
TCP connection to correctly allow for it to be reused.  Add a
transport parameter to dns_dispatch_createtcp and dns_dispatch_gettcp
and use it when selecting a TCP socket for reuse.

(cherry picked from commit baab8a5d75)
2024-10-24 01:21:37 +00:00
Nicki Křížek
36cac5d27d [9.20] fix: test: Use UTC timezone when handling keys in kasp test library
When working with key timestamps, ensure we correctly set the UTC
timezone in order for the tests to work consistently regardless of the
local time setting.

Closes #4999

Backport of MR !9673

Merge branch 'backport-4999-pytest-kasp-use-utc-timezone-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9679
2024-10-22 11:23:03 +00:00
Nicki Křížek
dd73617549 Set TZ to Australia/Sydney for bookworm CI job
Use a different timezone via the TZ variable in at least one of the
system test jobs in order to detect possible issues with timezone
handling in python.

(cherry picked from commit 46810be809)
2024-10-22 10:51:53 +02:00
Nicki Křížek
2cdb8c90d1 Use UTC timezone when handling keys in kasp test library
When working with key timestamps, ensure we correctly set the UTC
timezone in order for the tests to work consistently regardless of the
local time setting.

(cherry picked from commit f840deba33)
2024-10-22 10:51:53 +02:00
Nicki Křížek
7974626482 [9.20] chg: test: Disable too-many/too-few pylint checks
Backport of MR !9626

Merge branch 'backport-nicki/pylint-disable-too-few-too-many-checks-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9656
2024-10-22 08:45:52 +00:00
Nicki Křížek
fb9a87e8c5 Disable too-many/too-few pylint checks
Enforcing pylint standards and default for our test code seems
counter-productive. Since most of the newly added code are tests or is
test-related, encountering these checks rarely make us refactor the code
in other ways and we just disable these checks individually. Code that
is too complex or convoluted will be pointed out in reviews anyways.

(cherry picked from commit 7639c58c48)
2024-10-22 09:14:06 +02:00
Matthijs Mekking
b9afbd1055 [9.20] chg: test: Rewrite ksr system test to pytest
Backport of MR !9445

Merge branch 'backport-matthijs-pytest-rewrite-ksr-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9648
2024-10-22 07:00:12 +00:00
Matthijs Mekking
b46ddad5df Retry dnssec-verify in kasp test code
It is possible that the zone is not yet fully signed because it is
signed in batches. Retry the AXFR and verify command a couple of times.

(cherry picked from commit b8b3df0676)
2024-10-22 06:24:42 +00:00
Nicki Křížek
f1fc2e1db4 Address pylint issues
(cherry picked from commit 3c6124a093)
2024-10-22 06:24:42 +00:00
Nicki Křížek
fafb75ff8e Use difflib rather than diff cmd
(cherry picked from commit b7207fa3e7)
2024-10-22 06:24:42 +00:00
Nicki Křížek
36ab7489f7 Move algorithm defaults to check_keys()
(cherry picked from commit c9ecd2a618)
2024-10-22 06:24:42 +00:00
Nicki Křížek
ba2fe0a830 Use f-strings
(cherry picked from commit 55ec9f94bc)
2024-10-22 06:24:42 +00:00
Nicki Křížek
3cffc34551 Simplify command invocation
(cherry picked from commit 732a959d9a)
2024-10-22 06:24:42 +00:00
Nicki Křížek
00ec96e6e6 Remove unused isctest/kasp code
(cherry picked from commit b5633462bf)
2024-10-22 06:24:42 +00:00
Nicki Křížek
e806d8c6f5 Rename kasp function to check_*
If a function is expected to assert / raise on failure (rather than
return boolean), its name should start with "check_".

(cherry picked from commit 67957d1f54)
2024-10-22 06:24:42 +00:00
Nicki Křížek
f5adeb6800 Use convenience wrappers for kasp key operations
(cherry picked from commit 2b0a8fcfb5)
2024-10-22 06:24:42 +00:00
Matthijs Mekking
288dce213a Convert ksr system test to pytest
Move all test cases from tests.sh to tests_ksr.py. The only test that
is not moved is the check that key id's match expected keys. The
shell-based system test checks two earlier set environment variables
against each other that has become redundant in the pytest variant,
because we now check the signed key response against a list of keys
and for each key we take into account the timing metadata. So we
already ensure that each published key is in the correct key bundle.

(cherry picked from commit a15bf6704b)
2024-10-22 06:24:42 +00:00
Matthijs Mekking
5d0144d006 Introduce pytest kasp library
Write initial pytest kasp library. This contains everything that is
required for testing Offline KSK functionality with pytest.

This includes:
- addtime: adding a value to a timing metadata
- get_timing_metdata: retrieve timing metadata from keyfile
- get_metadata/get_keystate: retrieve metadata from statefile
- get_keytag: retrieve keytag from base keyfile string
- get_keyrole: get key role from statefile
- dnskey_equals: compare DNSKEY record from file against a string
- cds_equals: compare CDS derived from file against a string
- zone_is_signed: wait until a zone is completely signed
- dnssec_verify: verify a DNSSEC signed zone with dnssec-verify
- check_dnssecstatus: check rndc dnssec -status output
- check_signatures: check that signatures for a given RRset are correct
- check_dnskeys: check that the published DNSKEY RRset is correct
- check_cds: check that the published CDS RRset is correct
- check_apex: check SOA, DNSKEY, CDNSKEY, and CDS RRset
- check_subdomain: check an RRset below the apex

(cherry picked from commit a3829990fd)
2024-10-22 06:24:42 +00:00
Matthijs Mekking
761758b0b1 Change dnssec-ksr key sorting
Sort keys on algorithm, then keytag. This is more convenient for
testing.

(cherry picked from commit ea1fc5c47b)
2024-10-22 06:24:42 +00:00