Commit graph

11313 commits

Author SHA1 Message Date
Mark Andrews
8c5539e905 Remove 'inst != NULL' from cleanup check in plugin_register
'inst' is guarenteed to be non NULL at this point.

    358        *instp = inst;
    359
    360cleanup:

    CID 281450 (#2 of 2): Dereference before null check (REVERSE_INULL)
    check_after_deref: Null-checking inst suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    361        if (result != ISC_R_SUCCESS && inst != NULL) {
    362                plugin_destroy((void **)&inst);
    363        }
    364
    365        return (result);
2023-04-04 23:51:22 +00:00
Ondřej Surý
54a3f09c8f
Bump the requirement in the shutdown test to dnspython 2.0.0
The dnspython.Resolve.resolve() requires at least dnspython >= 2.0.0,
this wasn't enforced in the shutdown system test leading to infinite
loop waiting for the server start due to failing resolve() call.
2023-04-04 21:31:58 +02:00
Ondřej Surý
e123b76b0e Bump the requirement in dnstap test to dnspython 2.0.0
The dnspython.Resolve.resolve() requires at least dnspython >= 2.0.0,
this wasn't enforced in the dnstap system test.
2023-04-04 17:21:07 +02:00
Ondřej Surý
1734d4a33e
Squash both rpzextra tests into tests_rpzextra.py
We don't need a separate module/file for every test. Both the rpz tests
could live in the same file.

The setup/teardown of servers if performed separately for each module --
unless there is a need to do that, it's better to avoid it.
2023-04-04 16:23:13 +02:00
Tom Krizek
2ed26609b8
Use more concise syntax to check responses in rpzextra tests
All the answers are expected to have exactly one resource record. Check
it directly instead of iterating over all (possible) records.
2023-04-04 16:22:26 +02:00
Ondřej Surý
1649c768e9
Add test for RPZ in multiple views
This adds rudimentary test for response-policy zones in multiple
views.  Different combinations are tested:

- two views with response-policy inherited from options {};
- two views view explicit response-policy using same RPZ zone name
- two views view explicit response-policy using secondary RPZ zone
2023-04-04 16:22:26 +02:00
Ondřej Surý
3b1756d450
Replace dnspython resolver.query() with resolver.resolve()
The resolver.query() has been deprecated in favor of resolver.resolve();
used that.
2023-04-04 16:22:26 +02:00
Aram Sargsyan
98c8135692 nsupdate: set network manager default timeout values
The default values are currently set to 30 seconds, use nsupdate
default (or overriden using the -t option) timeout value instead.
2023-04-03 15:21:43 +00:00
Aram Sargsyan
3ef2a30c75 nsupdate: use the configurable timeout and retry values for all queries
The 'nsupdate' tool, when sending SOA queries, uses a hard-coded value
3 UDP retries and of 5 seconds of timeout for UDP queries, and 100
seconds of timeout for TCP queries.

Use the timeout and retry values which can be configured using the
-t, -u, -r command line options, and which are already used for
sending the update query.
2023-04-03 15:21:43 +00:00
Aram Sargsyan
a00540ac24 Update nsupdate -t option's documentation
Add some clarifications about the -t option's behavior differences
in TCP and UDP modes.
2023-04-03 15:21:43 +00:00
Aram Sargsyan
0ef11c0ccb nsupdate: when set to 0, UDP timeout should be calculated by dns_request
The manual page of nsupdate's '-u udptimeout' option states that, quote:

> If zero, the interval is computed from the timeout interval and number
> of UDP retries.

However, nsupdate sets the UDP timeout value to UINT_MAX when it is 0,
thus, not behaving as documented.

Let dns_request_create() calculate the UDP timeout, if it was set to 0.
2023-04-03 15:21:43 +00:00
Aram Sargsyan
5ce2ed0688 Add nsupdate timeout tests
* nsupdate should take 12 seconds (one try and three retries with
  3 second timeout for each), UDP mode
* nsupdate -u 4 -r 1 should take 8 seconds (one try and one retry with
  4 second timeout for each), UDP mode
* nsupdate -u 0 -t 8 -r 1 should also take 8 seconds, UDP mode
* nsupdate -u 4 -t 30 -r 1 should also take 8 seconds, as -u takes
  precedence over -t, UDP mode
* nsupdate -t 8 -v should also take 8 seconds, TCP mode
2023-04-03 15:21:43 +00:00
Petr Menšík
0627214568 Make it obvious -roll number is optional
Manual page were updated to indicate it, but rndc -h still displays it
as required parameter. Make it look like optional.
2023-04-03 14:42:56 +00:00
Matthijs Mekking
3551afe361 Make checkds system test more resilient
The checkds system test could fail if some parent secondary servers did
not yet loaded all the zones before ns9 started sending DS queries. This
leads to SERVFAIL responses, while the test case expects good DS
responses. In order to mitigate against this issue, call 'rndc loadkeys'
to quickly restart the checkds procedure again.

Also refactor the checkds system test, to get rid of the many zone
name duplications. Update the functions 'zone_check' and
'keystate_check' to make the zone name an FQDN so we can just pass
the 'zone' variable into the function.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
03f9e40d1b Determine checkds default from config
If the 'checkds' option is not explicitly set, check if there are
'parental-agents' for the zone configured. If so, default to "explicit",
otherwise default to "yes".
2023-04-03 14:01:22 +00:00
Matthijs Mekking
92577eaf7e Make checkds yes the default
This seems to be the more common case.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
47f7cb0a36 Add two checkds test servers
Add two new checkds test servers, that are hidden secondaries (hidden
as in not published in the NS RRset), that can be used specifically
for testing explicitly configured parental-agents.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
a921cabb8c Remove obsoleted checkds test name servers
These resolver based parental-agents have been replaced by ns3.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
e72b0df50b Implement auto parental-agents (checkds yes)
Implement the new feature, automatic parental-agents. This is enabled
with 'checkds yes'.

When set to 'yes', instead of querying the explicit configured
parental agents, look up the parental agents by resolving the parent
NS records. The found parent NS RRset is considered to be the list
of parental agents that should be queried during a KSK rollover,
looking up the DS RRset corresponding to the key signing keys.

For each NS record, look up the addresses in the ADB. These addresses
will be used to send the DS requests. Count the number of servers and
keep track of how many good DS responses were seen.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
dc651cbf3f Add test case with no empty non-terminals
The previous test cases already test the more complex case where there
are empty non-terminals between the child apex and the parent domain.

Add a test case where this is not the case, to execute the other code
path.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
a2735810d9 Add test cases for 'checkds no'
Add test cases for when checkds is disabled. Copy the test cases that
would have resulted in a DSPublish or DSRemoved and make sure that
with 'checkds no' the metadata is not set.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
6bb862d10f Add test cases for 'checkds yes'
Add the test cases for automatic parental-agents, i.e. when 'checkds'
is set to 'yes'. Split out the special cases that use a reference
or a resolver as parental-agent so that the common use cases can be
tested with the same function.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
226b6e385e Update checkds system test
Make the checkds system test more structured with the many more test
cases to come. Add a README for clarity.

Update the 'has_signed_apex_nsec' helper function so it can take any
domain name regardless of the number of labels.

Change the DNS tree structure such that we have different TLD names
for the various test scenarios, because we need servers that respond
differently to DS queries. Note that this isn't applicable to the
existing "checkds explicit" test cases, but is preparation work for
testing "checkds yes" (automatic parental agents).

Add a trust-anchor to the server that will be querying for parent
NS records.
2023-04-03 14:01:22 +00:00
Matthijs Mekking
06cd8b52db Add new 'checkds' configuration option
Add a new configuration option to set how the checkds method should
work. Acceptable values are 'yes', 'no', and 'explicit'.

When set to 'yes', the checkds method is to lookup the parental agents
by querying the NS records of the parent zone.

When set to 'no', no checkds method is enabled. Users should run
the 'rndc checkds' command to signal that DS records are published and
withdrawn.

When set to 'explicit', the parental agents are explicitly configured
with the 'parental-agents' configuration option.
2023-04-03 14:01:22 +00:00
Mark Andrews
da999a7a1b Define and use DLOPEN_LIBS 2023-04-03 13:31:56 +00:00
Mark Andrews
30b9ebfa2c Handle old <arpa/nameser.h> with old API
Define the types and classes we use from the new API.
2023-04-03 13:31:56 +00:00
Tony Finch
0d353704fb Use isc_histo for the message size statistics
This should have no functional effects.

The message size stats are specified by RSSAC002 so it's best not
to mess around with how they appear in the statschannel. But it's
worth changing the implementation to use general-purpose histograms,
to reduce code size and benefit from sharded counters.
2023-04-03 12:08:05 +01:00
Ondřej Surý
3a6a0fa867 Replace DE_CONST(k, v) with v = UNCONST(k) macro
Replace the complicated DE_CONST macro that required union with much
simple reference-dereference trick in the UNCONST() macro.
2023-04-03 10:25:56 +00:00
Ondřej Surý
4ec9c4a1db Cleanup the last Windows / MSC ifdefs and comments
Cleanup the remnants of MS Compiler bits from <isc/refcount.h>, printing
the information in named/main.c, and cleanup some comments about Windows
that no longer apply.

The bits in picohttpparser.{h,c} were left out, because it's not our
code.
2023-04-03 09:06:20 +00:00
Mark Andrews
f138a1447a forward: Check if TLS is working in FIPS mode
Skip test that depend on TLS working in FIPS mode
2023-04-03 12:44:27 +10:00
Mark Andrews
ffebd217f5 make feature-test --md5 --with-fips aware 2023-04-03 12:44:27 +10:00
Mark Andrews
4c5de4f15c Cleanup on error paths
Rather that call 'exit' cleanup on error paths as that allows OpenSSL
to cleanup properly in its exit handlers.
2023-04-03 12:44:27 +10:00
Mark Andrews
e029803704 Handle fatal and FIPS provider interactions
When fatal is called we may be holding memory allocated by OpenSSL.
This may result in the reference count for the FIPS provider not
going to zero and the shared library not being unloaded during
OPENSSL_cleanup.  When the shared library is ultimately unloaded,
when all remaining dynamically loaded libraries are freed, we have
already destroyed the memory context we where using to track memory
leaks / late frees resulting in INSIST being called.

Disable triggering the INSIST when fatal has being called.
2023-04-03 12:44:27 +10:00
Mark Andrews
4e7dadd205 get_algorithms.py: use FIPS compatible bit size
The minimum RSA key size that can be used in FIPS mode is 2048 bits.
2023-04-03 12:44:27 +10:00
Mark Andrews
c80ccf5a25 nsupdate: tls does not work in FIPS mode prior to OpenSSL 3.0.0 2023-04-03 12:44:27 +10:00
Mark Andrews
b82811d0b5 check that 'dnssec-signzone -F' fails for rsasha1 2023-04-03 12:44:27 +10:00
Mark Andrews
826e2563b3 wildcard: Require hypothesis 4.41.2 or greater for FIPS compliance
hypothesis prior to 4.41.2 uses hashlib.md5 which is not FIPS
compliant causing the wildcard system test to fail.  Check if
we are running if FIPS mode and if so make the minimum version
of hypothesis we will accept to be 4.41.2.
2023-04-03 12:44:27 +10:00
Mark Andrews
5da1fb25b1 upforwd: use FIPS compatible key size
Don't override the default key size.
2023-04-03 12:44:27 +10:00
Mark Andrews
56d2bf1141 tsiggss: regenerate kerberos credentials
The existing set of kerberos credential used deprecated algorithms
which are not supported by some implementations in FIPS mode.
Regenerate the saved credentials using more modern algorithms.

Added tsiggss/krb/setup.sh which sets up a test KDC with the required
principals for the system test to work.  The tsiggss system test
needs to be run once with this active and KRB5_CONFIG appropriately.
set.  See tsiggss/tests.sh for an example of how to do this.
2023-04-03 12:44:27 +10:00
Mark Andrews
c3ba38f89f tsiggss: skip test in FIPS mode when DH is broken
'tsiggss' depends on a working DH implementation.  This is not
properly supported in all FIPS implementations.
2023-04-03 12:44:27 +10:00
Mark Andrews
e8177ac605 tsig: only use FIPS compatible HMAC in FIPS mode
HMACMD5 is not permitted in FIPS mode.  Only test HMACMD5 when not
in FIPS mode.
2023-04-03 12:44:27 +10:00
Mark Andrews
175d0c6d85 tkey: skip TKEY system test in FIPS mode
TKEY uses MD5 which is incompatible with FIPS.
2023-04-03 12:44:27 +10:00
Mark Andrews
0ed16a561e rndc: don't test hmac-md5 in FIPS mode
HMACMD5 is not permitted in FIPS mode.  Only test HMACMD5 when not
in FIPS mode.
2023-04-03 12:44:27 +10:00
Mark Andrews
ff7e73db6a nsupdate: use FIPS compatible algorithms
HMACMD5 is not permitted in FIPS mode, use HMACSHA256 instead.
2023-04-03 12:44:27 +10:00
Mark Andrews
bcb3846603 nsec3: use fips configuration if rsasha1 is not supported 2023-04-03 12:44:27 +10:00
Mark Andrews
1362360e8f nsec3: skip tests that depend on RSASHA1 in FIPS mode 2023-04-03 12:44:27 +10:00
Mark Andrews
2e997e2248 doth: skip 'doth' test if FIPS mode when DH is broken
'doth' depends on a working DH implementation.
2023-04-03 12:44:27 +10:00
Mark Andrews
530142b2a1 dnssec: check that dnssec-signzone -F work with allowed algorithm 2023-04-03 12:44:27 +10:00
Mark Andrews
78764f99ca dnssec: test dnssec-keygen -F switches to FIPS mode 2023-04-03 12:44:27 +10:00
Mark Andrews
ba6ee5af50 dnssec: check if RSASHA1 is supported by the OS
If not skip RSASHA1 based system tests which are supposed to succeed
even in FIPS mode.
2023-04-03 12:44:27 +10:00