Commit Graph

10732 Commits

Author SHA1 Message Date
Petr Špaček
243ae3b6a7 Remove auto-generated rst files in repo in favour of grammar pretty printer
(cherry picked from commit 0bbbdc6244)
2022-07-01 10:20:56 +02:00
Petr Špaček
214da1de67 Un-format grammar files in doc/misc
The next commit is going to add parser for ISC configuration format.
To simplify the parser the grammar files in doc/misc are no longer
line-wrapped as handling it would make the grammar parser unnecessairly
complicated.

This affects visible output in the ARM, but in the end we are going to
replace the auto-generated .rst files with grammar pretty printed, so
formatting of these files does not matter in practical terms.

(cherry picked from commit 699570cdec)
2022-07-01 10:00:20 +02:00
Artem Boldariev
69e1d3804e doth test: extend with HTTP endpoints reconfiguration check
This commit add a check which verifies that HTTP endpoints are being
picked up properly by the BIND instance on a reconfiguration.

(cherry picked from commit 7822670d0f)
2022-06-28 16:38:21 +03:00
Artem Boldariev
63a4c12227 Store HTTP quota size inside a listenlist instead of the quota
This way only quota size is passed to the interface/listener
management code instead of a quota object. Thus, we can implement
updating the quota object size instead of recreating the object.

(cherry picked from commit 3f0b310772)
2022-06-28 16:37:31 +03:00
Matthijs Mekking
feaf3950fd Fix a bug in the duration_fromtext function
The function actually did not enforce that the duration string starts
with a P (or p), just that there is a P (or p) in the string.

(cherry picked from commit 8e18fa5874)
2022-06-28 14:37:19 +02:00
Matthijs Mekking
8af88d4111 Also inherit from "default" for "insecure" policy
Remove the duplication from the defaultconf and inherit the values
not set in the "insecure" policy from the "default" policy. Therefore,
we must insist that the first read built-in policy is the default one.

(cherry picked from commit c2a7950417)
2022-06-28 14:37:10 +02:00
Matthijs Mekking
e16cfce91d When loading dnssec-policies, inherit from default
Most of the settings (durations) are already inheriting from the default
because they use the constants from lib/dns/kasp.h. We need them as
constants so we can use them in named-checkconf to verify the policy
parameters.

The NSEC(3) parameters and keys should come from the actual default
policy. Change the call to cfg_kasp_fromconfig() to include the default
kasp. We also no longer need to corner case where config is NULL we load
the built-in policy: the built-in policies are now loaded when config is
set to named_g_config.

Finally, add a debug log (it is useful to see which policies are being
loaded).

(cherry picked from commit 20acb8d3a3)
2022-06-28 14:36:45 +02:00
Matthijs Mekking
03c0c72aeb Store built-in dnssec-policies in defaultconf
Update the defaultconf with the built-in policies. These will now be
printed with "named -C".

Change the defines in kasp.h to be strings, so they can be concatenated
in the defaultconf. This means when creating a kasp structure, we no
longer initialize the defaults (this is fine because only kaspconf.c
uses dns_kasp_create() and it inherits from the default policy).

In kaspconf.c, the default values now need to be parsed from string.

Introduce some variables so we don't need to do get_duration multiple
times on the same configuration option.

Finally, clang-format-14 decided to do some random formatting changes.

(cherry picked from commit 5ff414e986)
2022-06-28 14:36:38 +02:00
Michał Kępień
a649bd2148 Also test DNS-over-TLS code using sslyze
Since sslyze can test any TLS-enabled server, also use it for exercising
DNS-over-TLS code rather than just DNS-over-HTTPS code.

(cherry picked from commit 4f12892740)
2022-06-27 23:10:00 +02:00
Michał Kępień
4cda066de2 Add regression test for CVE-2022-1183
If sslyze is available in PATH, run it in a loop as part of the "doth"
system test.

(cherry picked from commit e97b4697cf)
2022-06-27 23:10:00 +02:00
Mark Andrews
7901261121 Replace expr's with $((expression)) shell constucts
Also make indenting consistent.

(cherry picked from commit 669c42cd95)
2022-06-23 17:27:13 +10:00
Mark Andrews
f7d5957f95 Add missing update of status variable in rrsetorder system test
(cherry picked from commit da63e63c41)
2022-06-23 17:27:13 +10:00
Michał Kępień
35840d2d03 Check IPs in a dnstap capture of resolver traffic
Add a system test that checks whether IP addresses are present in a
dnstap capture of resolver traffic if "query-source" is explicitly set.

(cherry picked from commit 1f5c2ea8e5)
2022-06-22 21:14:40 +02:00
Mark Andrews
5b56aa68af Check that the UDP destination port is logged via dnstap
(cherry picked from commit 8d8396c3a7)
2022-06-22 13:46:42 +02:00
Matthijs Mekking
de5b25b386 System tests pass through virtualenv and perlmods
Have system tests use required Python (dnspython) and PERL modules
(Digest::HMAC and Net::DNS) from user directories, avoid using
privileges.

Note: The pythonenv must be setup to use the same version of python as
the test uses, for example /usr/bin/python.

Thanks to Stacey Marshall.

(cherry picked from commit 53eb127be1)
2022-06-22 10:24:03 +02:00
Matthijs Mekking
ea50826dca Add comment on DNSSEC signing zone configuration
I was slightly confused here, so IMO it can use a comment.

(cherry picked from commit c80531758c)
2022-06-20 15:29:05 +02:00
Michal Nowak
d3eb307e3c Update clang to version 14
(cherry picked from commit 1c45a9885a)
2022-06-16 18:09:33 +02:00
Michal Nowak
8b77533ac3 Fix implicit string concatenation in tests-checkds.py
pylint 2.14.2 reports the following warnings:

    bin/tests/system/checkds/tests-checkds.py:265:0: W1404: Implicit string concatenation found in call (implicit-str-concat)
    bin/tests/system/checkds/tests-checkds.py:273:0: W1404: Implicit string concatenation found in call (implicit-str-concat)

(cherry picked from commit 831ac8add1)
2022-06-16 13:41:06 +02:00
Tom Krizek
1d847def2a Report reasons for skipped/xfailed system pytests
If skip/xfail is used in pytest, it can have a reason string associated
with it. When evaluating these tests, it can be useful to be able to
differentiate the reason why the test was skipped/xfailed/xpassed,
because there might be multiple possible reasons for that.

The extra options passed to pytest ensure that the string with the
reason appears in the test summary and thus we're able to find the
string with the reason in the log output.

See https://docs.pytest.org/en/7.1.x/how-to/skipping.html for more info

(cherry picked from commit f6d368167a)
2022-06-16 09:19:50 +02:00
Petr Špaček
bd1ad27ff4 Update NSEC3 guidance to match draft-ietf-dnsop-nsec3-guidance-10
https://datatracker.ietf.org/doc/html/draft-ietf-dnsop-nsec3-guidance-10
is on it's way to become RFC, so let's update our recommendations in the
docs to be in line with it.

(cherry picked from commit 2ee3f4e6c8)
2022-06-15 17:57:40 +02:00
Artem Boldariev
a954eacbac CID 352849: refactor get_create_tls_context() within dighost.c
This commit removes dead code from cleanup handling part of the
get_create_tls_context().

In particular, currently:

* there is no way 'found_ctx' might equal 'ctx';
* there is no way 'session_cache' might equal a non-NULL value while
cleaning up after a TLS initialisation error.

(cherry picked from commit 095b608412)
2022-06-15 17:02:45 +03:00
Artem Boldariev
7bd5f4972f Dig: Do not call isc_nm_cancelread() for HTTP sockets
This commit ensures that isc_nm_cancelread() is not called from within
dig code for HTTP sockets, as these lack its implementation.

It does not have much sense to have it due to transactional nature of
HTTP.

Every HTTP request-response pair is represented by a virtual socket,
where read callback is called only when full DNS message is received
or when an error code is being passed there. That is, there is nothing
to cancel at the time of the call.

(cherry picked from commit 90c52ca12b)
2022-06-15 17:02:45 +03:00
Artem Boldariev
e02284354a DoT: implement TLS client session resumption
This commit extends DoT code with TLS client session resumption
support implemented on top of the TLS client session cache.

(cherry picked from commit 86465c1dac)
2022-06-15 17:02:45 +03:00
Artem Boldariev
0a4a76ff7a TLS stream/DoH: implement TLS client session resumption
This commit extends TLS stream code and DoH code with TLS client
session resumption support implemented on top of the TLS client
session cache.

(cherry picked from commit 90bc13a5d5)
2022-06-15 17:02:45 +03:00
Artem Boldariev
6ec48f1e78 Extend TLS context cache with TLS client session cache
This commit extends TLS context cache with TLS client session cache so
that an associated session cache can be stored alongside the TLS
context within the context cache.

(cherry picked from commit 987892d113)
2022-06-15 17:02:45 +03:00
Aram Sargsyan
7917e1866a Fix a crash in dig NS search mode
In special NS search mode, after the initial lookup, dig starts the
followup lookup with discovered NS servers in the queries list. If one
of those queries then fail, dig, as usual, tries to start the next query
in the list, which results in a crash, because the NS search mode is
special in a way that the queries are running in parallel, so the next
query is usually already started.

Apply some special logic in `recv_done()` function to deal with the
described situation when handling the query result for the NS search
mode. Particularly, print a warning message for the failed query,
and do not try to start the next query in the list. Also, set a non-zero
exit code if all the queries in the followup lookup fail.

(cherry picked from commit 1290863c22)
2022-06-14 13:21:47 +00:00
Michal Nowak
152343e221 Fix statistics system test on Oracle Linux 7
The statistics system test fails on Oracle Linux 7 when libxml2, Curl,
and xsltproc are present:

    I:statistics:checking bind9.xsl vs xml (17)
    diff: curl.out.17.xsl: No such file or directory
    tests.sh: line 183: curl.out.17.xml: No such file or directory
    cp: cannot stat 'curl.out.17.xml': No such file or directory
    grep: xsltproc.out.17: No such file or directory

This is because the Oracle Linux 7 Curl does not know about the
--http1.1 option and silently fails with:

    + /usr/bin/curl --http1.1 http://10.53.0.3:7252
    curl: option --http1.1: is unknown
    curl: try 'curl --help' or 'curl --manual' for more information

The following test "checking bind9.xml socket statistics" then needs to
check for existence of stats.xml.out file which is artifact of the
previous test.

(cherry picked from commit 49cb896929)
2022-06-14 09:42:02 +02:00
Petr Špaček
47c214644b Set default number of additional NSEC3 iterations to 0 in dnssec-signzone
We forgot to update dnssec-signzone while updating KASP defaults.

Closes: #3395
Related: #2956
(cherry picked from commit d029d6374d)
2022-06-14 09:08:07 +02:00
Petr Špaček
4630d50f83 Clarify dnssec-keyfromlabel -a in man page
(cherry picked from commit 5f53003dae)
2022-06-10 07:55:12 +02:00
Aram Sargsyan
56cc6545dc Add forward zone checks in the catz system test
Add a new test to check that a catalog zone member zone does not
get processed when there is a pre-existing forward zone with that
same name.

(cherry picked from commit b27969ee0b)
2022-06-09 10:50:48 +00:00
Aram Sargsyan
1626f61815 Convert some catz error messages from ISC_LOG_INFO to ISC_LOG_WARNING
There is no reason for these two messages to be `ISC_LOG_INFO` while all
the other similar messages in `catz_addmodzone_taskaction()` and
`catz_delzone_taskaction()` functions are logged as `ISC_LOG_WARNING`.

(cherry picked from commit 8156c46bd2)
2022-06-09 10:50:41 +00:00
Aram Sargsyan
475e790e03 Check that catz member zone is not a configured forward zone
When processing a catalog zone member zone make sure that there is no
configured pre-existing forward zone with that name.

Refactor the `dns_fwdtable_find()` function to not alter the
`DNS_R_PARTIALMATCH` result (coming from `dns_rbt_findname()`) into
`DNS_R_SUCCESS`, so that now the caller can differentiate partial
and exact matches. Patch the calling sites to expect and process
the new return value.

(cherry picked from commit 2aff264fb1)
2022-06-09 10:50:32 +00:00
Tom Krizek
e4bb3c3637 Auto-format Python files with black
This patch is strictly the result of:
$ black $(git ls-files '*.py')

There have been no manual changes.

(cherry picked from commit c9cb8ae9eb)
2022-06-08 13:18:27 +02:00
Matthijs Mekking
2174c566ff Retry quiet to deal with kasp test timing issue
In the cases where we test SOA serial updates and TTL updates, we check
if for "all zones loaded" to ensure the new zone content is loaded. But
this is the unsigned zone, the signed zone still needs to be produced.

There is thus a timing issue where the dig request comes in before
the signing process has finished.

Add a retry quiet to mitigate against it.

(cherry picked from commit 827bba05a0)
2022-06-07 09:35:40 +02:00
Mark Andrews
23c46338ef Make modifications to keyless.example deterministic
The perl modifation code for keyless.example was not deterministic
(/NXT/ matched part of signature) resulting in different error
strings being returned.  Replaced /NXT/ with /A RRSIG NSEC/ and
updated expected error string,

(cherry picked from commit 69d5e22e58)
2022-06-01 10:42:44 +10:00
Matthijs Mekking
3cfbe31176 Error if key lifetime is too short
The key lifetime should not be shorter than the time it costs to
introduce the successor key, otherwise keys will be created faster than
they are removed, resulting in a large key set.

The time it takes to replace a key is determined by the publication
interval (Ipub) of the successor key and the retire interval of the
predecessor key (Iret).

For the ZSK, Ipub is the sum of the DNSKEY TTL and zone propagation
delay (and publish safety). Iret is the sum of Dsgn, the maximum zone
TTL and zone propagation delay (and retire safety). The sign delay is
the signature validity period minus the refresh interval: The time to
ensure that all existing RRsets have been re-signed with the new key.
The ZSK lifetime should be larger than both values.

For the KSK, Ipub is the sum of the DNSKEY TTL and zone propagation
delay (and publish safety). Iret is the sum of the DS TTL and parent
zone propagation delay (and retire safety). The KSK lifetime should be
larger than both values.

(cherry picked from commit 8134d46cdb)
2022-05-31 17:16:53 +02:00
Matthijs Mekking
46636b8563 Error if signatures-refresh is too high
The signatures-refresh should not near the signatures-validity value,
to prevent operational instability. Same is true when checking against
signatures-validity-dnskey.

(cherry picked from commit 82fd89107f)
2022-05-31 17:16:40 +02:00
Matthijs Mekking
b32a39dd27 Warn if key lifetime is short
Log a warning if the key lifetime is less than 30 days.

(cherry picked from commit e7322e8f78)
2022-05-31 17:16:35 +02:00
Matthijs Mekking
58690ec11c Warn if multiple keys have same role
If a dnssec-policy has multiple keys configured with the
same algorithm and role.

(cherry picked from commit f54dad005e)
2022-05-31 17:16:29 +02:00
Matthijs Mekking
659804eab0 Tweak timings in serve-stale system test
Give a little bit more time if we wait on a time out from the
authoritative (aka resolver failure), and give up after one try
(because the second attempt will likely result in a different EDE).

(cherry picked from commit f764cee136)
2022-05-31 13:51:51 +00:00
Tony Finch
84113b237a Teach dnssec-settime to read unset times that it writes
When there is no time in a key file, `dnssec-settime` will print
"UNSET", but to unset a time the user must specify "none" or "never".
This change allows "unset" or "UNSET" as well as "none" or "never".
The "UNSET" output remains the same to avoid compatibility problems
with wrapper scripts.

I have also re-synchronized the "Timing Options" sections of the man
pages.

(cherry picked from commit 4c96efac5c)
2022-05-23 15:15:10 +02:00
Tony Finch
f84cd02b0c Teach dnssec-settime to read times that it writes
The dnssec-settime -p and -up options print times in asctime() and
UNIX time_t formats, respectively. The asctime() format can also be
found inside K*.key public key files. Key files also contain times in
the YYYYMMDDHHMMSS format that can be used in timing parameter
options.

The dnssec-settime -p and -up time formats are now acceptable in
timing parameter options to dnssec-settime and dnssec-keygen, so it is
no longer necessary to parse key files to retrieve times that are
acceptable in timing parameter options.

(cherry picked from commit c38a323082)
2022-05-23 13:44:50 +02:00
Evan Hunt
dfe196844c specify time format in the documentation for 'rdnc dnssec -checkds'
also clarified the writing in the surrounding paragraph.

(cherry picked from commit 83f9466d61)
2022-05-18 15:30:18 -07:00
Michal Nowak
9c8fdec57b Fix typo in ednscompliance test
Caused by ba0313e649, an incomplete fix of
spelling errors.

(cherry picked from commit 9de2c06a21)
2022-05-18 19:16:43 +02:00
Matthijs Mekking
646e00fbb2 Replace stat with PERL stat in kasp system test
7249bad7 introduced the -c option to stat(1) command, but BSD systems
do not know about it. Replace the stat(1) command with a PERL script
that achieves the same.

Why PERL? For consistency purposes, there are more places in the
system test where we use the same method.

(cherry picked from commit fe601c5915)
2022-05-16 18:02:38 +02:00
Matthijs Mekking
90ceb24b1c Add kasp test for #3302
Add a test case that triggers a keymgr run that will not trigger any
metadata changes. Ensure that the last status change of the key files
is unmodified.

(cherry picked from commit 7249bad706)
2022-05-16 10:37:23 +02:00
Evan Hunt
37bd035d39 Add lower bound checks to fetchlimit test
Check that the recursing client count is above a reasonable
minimum, as well as below a maximum, so that we can detect
bugs that cause recursion to fail too early or too often.

(cherry picked from commit 8834c44683)
2022-05-14 00:59:12 -07:00
Evan Hunt
fa8b33ce56 Disable EDNS for the fetchlimit test server
The fetchlimit test depends on a resolver continuing to try UDP
and timing out while the client waits for resolution to succeed.
but since commit bb990030 (flag day 2020), a fetch will always
switch to TCP after two timeouts, unless EDNS was disabled for
the query.

This commit adds "edns no;" to server statements in the fetchlimit
resolver, to restore the behavior expected by the test.

(cherry picked from commit 81deb24deb)
2022-05-14 00:43:17 -07:00
Mark Andrews
de5814ba8a Add test cases using static and static-stub zones
RPZ NSIP and NSDNAME checks were failing with "unrecognized NS
rpz_rrset_find() failed: glue" when static or static-stub zones
where used to resolve the query name.

Add tests using stub and static-stub zones that are expected to
be filtered and not-filtered against NSIP and NSDNAME rules.

stub and static-stub queries are expected to be filtered

stub-nomatch and static-stub-nomatch queries are expected to be passed

(cherry picked from commit 30cb70c826)
2022-05-04 23:52:29 +10:00
Ondřej Surý
79b045d03d Add missing void in named_config_getdefault() definition
The named_config_getdefault() was missing void in the function
definition.  This broke clang-15 that didn't match the declaration that
had the void in the argument with the definition that hadn't.
2022-05-04 13:03:21 +02:00