]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agonsupdate: use the configurable timeout and retry values for all queries
Aram Sargsyan [Wed, 28 Dec 2022 10:20:37 +0000 (10:20 +0000)] 
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.

3 years agoUpdate nsupdate -t option's documentation
Aram Sargsyan [Wed, 28 Dec 2022 10:12:12 +0000 (10:12 +0000)] 
Update nsupdate -t option's documentation

Add some clarifications about the -t option's behavior differences
in TCP and UDP modes.

3 years agoDo not resend TCP requests
Aram Sargsyan [Mon, 12 Dec 2022 12:12:13 +0000 (12:12 +0000)] 
Do not resend TCP requests

The req_response() function is using 'udpcount' variable to resend
the request 'udpcount' times on timeout even for TCP requests,
which does not make sense, as it would use the same connection.

Add a condition to use the resend logic only for UDP requests.

3 years agoPerform request validation in req_response() before using the pointer
Aram Sargsyan [Mon, 12 Dec 2022 12:08:16 +0000 (12:08 +0000)] 
Perform request validation in req_response() before using the pointer

The 'request' pointer is used before it is checked. Perform the check
before using the pointer.

3 years agoSynchronize dns_request_createraw() and dns_request_create() UDP timeout
Aram Sargsyan [Mon, 12 Dec 2022 11:55:09 +0000 (11:55 +0000)] 
Synchronize dns_request_createraw() and dns_request_create() UDP timeout

The dns_request_createraw() function, unlike dns_request_create(), when
calculating the UDP timeout value, doesn't check that 'udpretries' is
not zero, and that is the more logical behavior, because the calculation
formula uses division to 'udpretries + 1', where '1' is the first try.

Change the dns_request_create() function to remove the 'udpretries != 0'
condition.

Add a 'REQUIRE(udpretries != UINT_MAX)' check to protect from a division
by zero.

Make the 'request->udpcount' field to represent the number of tries,
instead of the number of retries.

3 years agonsupdate: when set to 0, UDP timeout should be calculated by dns_request
Aram Sargsyan [Mon, 12 Dec 2022 11:36:42 +0000 (11:36 +0000)] 
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.

3 years agoAdd nsupdate timeout tests
Aram Sargsyan [Wed, 28 Dec 2022 15:55:43 +0000 (15:55 +0000)] 
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

3 years agoMerge branch '3910-coverity-qp-tests' into 'main'
Tony Finch [Mon, 3 Apr 2023 15:11:03 +0000 (15:11 +0000)] 
Merge branch '3910-coverity-qp-tests' into 'main'

Fix Coverity complaints in the qp-trie tests

Closes #3910

See merge request isc-projects/bind9!7630

3 years agoMore dns_qpkey_t safety checks
Tony Finch [Mon, 3 Apr 2023 13:20:20 +0000 (14:20 +0100)] 
More dns_qpkey_t safety checks

My original idea had been that the core qp-trie code would be mostly
independent of the storage for keys, so I did not make it check at run
time that key lengths are sensible. However, the qp-trie search
routines need to get keys out of leaf objects, for which they provide
storage on the stack, which is particularly dangerous for unchecked
buffer overflows. So this change checks that key lengths are in bounds
at the API boundary between the qp-trie code and the rest of BIND, and
there is no more pretence that keys might be longer.

3 years agoFix Coverity complaints in the qp-trie tests
Tony Finch [Wed, 1 Mar 2023 09:53:35 +0000 (09:53 +0000)] 
Fix Coverity complaints in the qp-trie tests

The main problem was `qp_test_keytoname()` not using `qpkey_bit()`
to do bounds checking.

3 years agoMerge branch 'bug/main/rndc-dnstap-roll' into 'main'
Petr Špaček [Mon, 3 Apr 2023 14:43:55 +0000 (14:43 +0000)] 
Merge branch 'bug/main/rndc-dnstap-roll' into 'main'

Document that rndc dnstap -roll number is optional

See merge request isc-projects/bind9!7755

3 years agoMake it obvious -roll number is optional
Petr Menšík [Thu, 30 Mar 2023 16:30:50 +0000 (18:30 +0200)] 
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.

3 years agoMerge branch '3901-parental-agents-auto' into 'main'
Matthijs Mekking [Mon, 3 Apr 2023 14:01:35 +0000 (14:01 +0000)] 
Merge branch '3901-parental-agents-auto' into 'main'

Automatic parental-agents (checkds yes)

Closes #3901

See merge request isc-projects/bind9!7742

3 years agoMake checkds system test more resilient
Matthijs Mekking [Wed, 29 Mar 2023 09:26:22 +0000 (11:26 +0200)] 
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.

3 years agoDetermine checkds default from config
Matthijs Mekking [Tue, 28 Mar 2023 14:57:58 +0000 (16:57 +0200)] 
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".

3 years agoMake checkds yes the default
Matthijs Mekking [Tue, 28 Mar 2023 14:54:47 +0000 (16:54 +0200)] 
Make checkds yes the default

This seems to be the more common case.

3 years agoAdd two checkds test servers
Matthijs Mekking [Tue, 28 Mar 2023 14:47:16 +0000 (16:47 +0200)] 
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.

3 years agoRemove obsoleted checkds test name servers
Matthijs Mekking [Tue, 28 Mar 2023 14:10:51 +0000 (16:10 +0200)] 
Remove obsoleted checkds test name servers

These resolver based parental-agents have been replaced by ns3.

3 years agoAdd CHANGES and release notes for #3901
Matthijs Mekking [Tue, 28 Mar 2023 14:05:20 +0000 (16:05 +0200)] 
Add CHANGES and release notes for #3901

This is a new feature that deserves attention.

3 years agoImplement auto parental-agents (checkds yes)
Matthijs Mekking [Tue, 28 Mar 2023 13:55:51 +0000 (15:55 +0200)] 
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.

3 years agoAdd test case with no empty non-terminals
Matthijs Mekking [Tue, 28 Mar 2023 13:17:52 +0000 (15:17 +0200)] 
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.

3 years agoAdd test cases for 'checkds no'
Matthijs Mekking [Tue, 28 Mar 2023 12:35:57 +0000 (14:35 +0200)] 
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.

3 years agoAdd test cases for 'checkds yes'
Matthijs Mekking [Tue, 28 Mar 2023 10:00:56 +0000 (12:00 +0200)] 
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.

3 years agoUpdate checkds system test
Matthijs Mekking [Fri, 24 Mar 2023 16:22:24 +0000 (17:22 +0100)] 
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.

3 years agoUpdate documenation for 'checkds' option
Matthijs Mekking [Wed, 8 Mar 2023 14:14:11 +0000 (15:14 +0100)] 
Update documenation for 'checkds' option

Add text about the 'checkds' option in the ARM reference and
DNSSEC guide.

3 years agoAdd new 'checkds' configuration option
Matthijs Mekking [Wed, 8 Mar 2023 13:56:08 +0000 (14:56 +0100)] 
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.

3 years agoMerge branch '3930-gcc-12-static-analyzer-warning-dereference-of-null-in-in-siphash...
Ondřej Surý [Mon, 3 Apr 2023 13:32:53 +0000 (13:32 +0000)] 
Merge branch '3930-gcc-12-static-analyzer-warning-dereference-of-null-in-in-siphash-c' into 'main'

Resolve "GCC 12 static analyzer: warning: dereference of NULL 'in' in siphash.c"

Closes #3930

See merge request isc-projects/bind9!7656

3 years agoSilence NULL pointer dereferene false positive
Mark Andrews [Wed, 8 Mar 2023 05:05:03 +0000 (16:05 +1100)] 
Silence NULL pointer dereferene false positive

Only attempt to digest 'in' if it is non NULL.  This will prevent
false positives about NULL pointer dereferences against 'in' and
should also speed up the processing.

3 years agoMerge branch '3974-rpz-testlib-test-data-c-compilation-fails-on-openbsd' into 'main'
Ondřej Surý [Mon, 3 Apr 2023 13:32:32 +0000 (13:32 +0000)] 
Merge branch '3974-rpz-testlib-test-data-c-compilation-fails-on-openbsd' into 'main'

Resolve "rpz/testlib/test-data.c compilation fails on OpenBSD"

Closes #3974

See merge request isc-projects/bind9!7748

3 years agoDefine and use DLOPEN_LIBS
Mark Andrews [Mon, 3 Apr 2023 06:12:08 +0000 (16:12 +1000)] 
Define and use DLOPEN_LIBS

3 years agoHandle old <arpa/nameser.h> with old API
Mark Andrews [Wed, 29 Mar 2023 23:49:13 +0000 (10:49 +1100)] 
Handle old <arpa/nameser.h> with old API

Define the types and classes we use from the new API.

3 years agoMerge branch 'artem-streamdns-avoid-copying-on-reading' into 'main'
Ondřej Surý [Mon, 3 Apr 2023 13:31:51 +0000 (13:31 +0000)] 
Merge branch 'artem-streamdns-avoid-copying-on-reading' into 'main'

Stream DNS: try to handle incoming data directly - avoid memory copying/buffer resizing when reading data

See merge request isc-projects/bind9!7280

3 years agoStream DNS: avoid memory copying/buffer resizing when reading data
Artem Boldariev [Mon, 26 Dec 2022 15:42:49 +0000 (17:42 +0200)] 
Stream DNS: avoid memory copying/buffer resizing when reading data

This commit optimises isc_dnsstream_assembler_t in such a way that
memory copying and reallocation are avoided when receiving one or more
complete DNS messages at once. We try to handle the data from the
messages directly, without storing them in an intermediate memory
buffer.

3 years agoMerge branch '3990-remove-dead-code-from-dst_api' into 'main'
Ondřej Surý [Mon, 3 Apr 2023 13:29:52 +0000 (13:29 +0000)] 
Merge branch '3990-remove-dead-code-from-dst_api' into 'main'

Eliminate the dead code in dst_api.c

Closes #3990

See merge request isc-projects/bind9!7773

3 years agoEliminate the dead code in dst_api.c
Ondřej Surý [Mon, 3 Apr 2023 12:09:13 +0000 (14:09 +0200)] 
Eliminate the dead code in dst_api.c

In write_public_key() and write_key_state(), there were left-over checks
for result, that were effectively dead code after the last refactoring.
Remove those.

3 years agoMerge branch 'fanf-histo' into 'main'
Tony Finch [Mon, 3 Apr 2023 11:41:25 +0000 (11:41 +0000)] 
Merge branch 'fanf-histo' into 'main'

Add isc_histo histograms, and use it for message size statistics

Closes #3464

See merge request isc-projects/bind9!7696

3 years agoCHANGES note for [GL !7696]
Tony Finch [Fri, 17 Mar 2023 12:05:59 +0000 (12:05 +0000)] 
CHANGES note for [GL !7696]

[func] Add isc_histo_t general-purpose log-linear histograms,
and use them for message size statistics.

3 years agoUse isc_histo for the message size statistics
Tony Finch [Thu, 16 Mar 2023 14:31:46 +0000 (14:31 +0000)] 
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.

3 years agoRemove obsolete code from dns_stats
Tony Finch [Thu, 16 Mar 2023 10:51:22 +0000 (10:51 +0000)] 
Remove obsolete code from dns_stats

It became obsolete in 2008

3 years agoSimplify histogram quantiles
Tony Finch [Mon, 20 Mar 2023 15:05:36 +0000 (15:05 +0000)] 
Simplify histogram quantiles

The `isc_histosummary_t` functions were written in the early days of
`hg64` and carried over when I brought `hg64` into BIND. They were
intended to be useful for graphing cumulative frequency distributions
and the like, but in practice whatever draws charts is better off with
a raw histogram export. Especially because of the poor performance of
the old functions.

The replacement `isc_histo_quantiles()` function is intended for
providing a few quantile values in BIND's stats channel, when the user
does not want the full histogram. Unlike the old functions, the caller
provides all the query fractions up-front, so that the values can be
found in a single scan instead of a scan per value. The scan is from
larger values to smaller, since larger quantiles are usually more
interesting, so the scan can bail out early.

3 years agoAdd per-thread sharded histograms for heavy loads
Tony Finch [Thu, 16 Mar 2023 09:46:15 +0000 (09:46 +0000)] 
Add per-thread sharded histograms for heavy loads

Although an `isc_histo_t` is thread-safe, it can suffer
from cache contention under heavy load. To avoid this,
an `isc_histomulti_t` contains a histogram per thread,
so updates are local and low-contention.

3 years agoAdd isc_histo for histogram statistics
Tony Finch [Wed, 8 Mar 2023 09:55:42 +0000 (09:55 +0000)] 
Add isc_histo for histogram statistics

This is an adaptation of my `hg64` experiments for use in BIND.

As well as renaming everything according to ISC style, I have
written some more extensive tests that ensure the edge cases are
correct and the fenceposts are in the right places.

I have added utility functions for working with precision in terms of
decimal significant figures as well as this code's native binary.

3 years agoMerge branch '3710-properly-document-DF-flag-on-outbound-UDP' into 'main'
Ondřej Surý [Mon, 3 Apr 2023 10:28:47 +0000 (10:28 +0000)] 
Merge branch '3710-properly-document-DF-flag-on-outbound-UDP' into 'main'

Clarify the documentation about DF-flag

Closes #3710

See merge request isc-projects/bind9!7770

3 years agoAdd CHANGES note for [GL #3710]
Ondřej Surý [Mon, 3 Apr 2023 09:42:52 +0000 (11:42 +0200)] 
Add CHANGES note for [GL #3710]

3 years agoClarify the documentation about DF-flag
Ondřej Surý [Mon, 3 Apr 2023 09:40:34 +0000 (11:40 +0200)] 
Clarify the documentation about DF-flag

Remove the reference to setting the DF-flag as we don't do that right
now.  Rephrase the paragraph that the default value should not be
causing fragmentation.

3 years agoMerge branch 'ondrej/replace-DE_CONST-with-simpler-UNCONST' into 'main'
Ondřej Surý [Mon, 3 Apr 2023 10:26:02 +0000 (10:26 +0000)] 
Merge branch 'ondrej/replace-DE_CONST-with-simpler-UNCONST' into 'main'

Replace DE_CONST(k, v) with v = UNCONST(k) macro

See merge request isc-projects/bind9!7760

3 years agoReplace DE_CONST(k, v) with v = UNCONST(k) macro
Ondřej Surý [Thu, 30 Mar 2023 20:34:12 +0000 (22:34 +0200)] 
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.

3 years agoMerge branch 'ondrej/cleanup-windows-bits' into 'main'
Ondřej Surý [Mon, 3 Apr 2023 09:06:27 +0000 (09:06 +0000)] 
Merge branch 'ondrej/cleanup-windows-bits' into 'main'

Cleanup the last Windows / MSC ifdefs and comments

See merge request isc-projects/bind9!7754

3 years agoCleanup the last Windows / MSC ifdefs and comments
Ondřej Surý [Thu, 30 Mar 2023 15:35:00 +0000 (17:35 +0200)] 
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.

3 years agoMerge branch '3915-check-dig-output-for-errors' into 'main'
Tom Krizek [Mon, 3 Apr 2023 08:50:01 +0000 (08:50 +0000)] 
Merge branch '3915-check-dig-output-for-errors' into 'main'

Find errors in dig output in system tests

Closes #3915

See merge request isc-projects/bind9!7679

3 years agoFind errors in dig output in system tests
Tom Krizek [Mon, 13 Mar 2023 12:36:24 +0000 (13:36 +0100)] 
Find errors in dig output in system tests

Facilitate faster system test failure identification and debugging by
checking any dig outputs for errors, which are typically indicative of
CI runner network / load issues.

3 years agoMerge branch 'mnowak/fix-fips-in-tests' into 'main'
Mark Andrews [Mon, 3 Apr 2023 04:30:43 +0000 (04:30 +0000)] 
Merge branch 'mnowak/fix-fips-in-tests' into 'main'

FIPS fixes and enhancements

See merge request isc-projects/bind9!4281

3 years agoDisable leak detection in FIPS mode
Mark Andrews [Wed, 22 Mar 2023 01:43:49 +0000 (12:43 +1100)] 
Disable leak detection in FIPS mode

3 years agoHandle MD5 not being supported by lib crypto
Mark Andrews [Wed, 22 Mar 2023 00:14:11 +0000 (11:14 +1100)] 
Handle MD5 not being supported by lib crypto

When initialising the message digests in lib/isc/md.c no
longer assume that the initialisation cannot fail.

3 years agoforward: Check if TLS is working in FIPS mode
Mark Andrews [Wed, 22 Mar 2023 00:02:02 +0000 (11:02 +1100)] 
forward: Check if TLS is working in FIPS mode

Skip test that depend on TLS working in FIPS mode

3 years agoDon't check for OPENSSL_cleanup failures by default
Mark Andrews [Tue, 21 Mar 2023 03:29:46 +0000 (14:29 +1100)] 
Don't check for OPENSSL_cleanup failures by default

OPENSSL_cleanup is supposed to free all remaining memory in use
provided the application has cleaned up properly.  This is not the
case on some operating systems.  Silently ignore memory that is
freed after OPENSSL_cleanup has been called.

3 years agoTest whether the crypto library supports the HMAC algorithm
Mark Andrews [Fri, 24 Feb 2023 01:59:18 +0000 (12:59 +1100)] 
Test whether the crypto library supports the HMAC algorithm

When initialising HMAC support check that the crypto library
supports the algorithm rather than just assuming it is supported.

3 years agomake feature-test --md5 --with-fips aware
Mark Andrews [Fri, 24 Feb 2023 01:21:04 +0000 (12:21 +1100)] 
make feature-test --md5 --with-fips aware

3 years agoCleanup on error paths
Mark Andrews [Mon, 30 Jan 2023 01:55:59 +0000 (12:55 +1100)] 
Cleanup on error paths

Rather that call 'exit' cleanup on error paths as that allows OpenSSL
to cleanup properly in its exit handlers.

3 years agoHandle fatal and FIPS provider interactions
Mark Andrews [Fri, 27 Jan 2023 05:52:59 +0000 (16:52 +1100)] 
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.

3 years agoget_algorithms.py: use FIPS compatible bit size
Mark Andrews [Thu, 12 Jan 2023 22:48:53 +0000 (09:48 +1100)] 
get_algorithms.py: use FIPS compatible bit size

The minimum RSA key size that can be used in FIPS mode is 2048 bits.

3 years agonsupdate: tls does not work in FIPS mode prior to OpenSSL 3.0.0
Mark Andrews [Tue, 27 Sep 2022 07:34:41 +0000 (17:34 +1000)] 
nsupdate: tls does not work in FIPS mode prior to OpenSSL 3.0.0

3 years agocheck that 'dnssec-signzone -F' fails for rsasha1
Mark Andrews [Sat, 3 Sep 2022 05:31:40 +0000 (15:31 +1000)] 
check that 'dnssec-signzone -F' fails for rsasha1

3 years agowildcard: Require hypothesis 4.41.2 or greater for FIPS compliance
Mark Andrews [Tue, 21 Dec 2021 22:01:54 +0000 (09:01 +1100)] 
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.

3 years agoupforwd: use FIPS compatible key size
Mark Andrews [Mon, 20 Dec 2021 07:50:21 +0000 (18:50 +1100)] 
upforwd: use FIPS compatible key size

Don't override the default key size.

3 years agotsiggss: regenerate kerberos credentials
Mark Andrews [Wed, 17 Aug 2022 01:13:41 +0000 (11:13 +1000)] 
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.

3 years agotsiggss: skip test in FIPS mode when DH is broken
Mark Andrews [Thu, 23 Dec 2021 05:12:28 +0000 (16:12 +1100)] 
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.

3 years agotsig: only use FIPS compatible HMAC in FIPS mode
Mark Andrews [Mon, 20 Dec 2021 06:12:53 +0000 (17:12 +1100)] 
tsig: only use FIPS compatible HMAC in FIPS mode

HMACMD5 is not permitted in FIPS mode.  Only test HMACMD5 when not
in FIPS mode.

3 years agotkey: skip TKEY system test in FIPS mode
Mark Andrews [Tue, 21 Dec 2021 02:34:39 +0000 (13:34 +1100)] 
tkey: skip TKEY system test in FIPS mode

TKEY uses MD5 which is incompatible with FIPS.

3 years agorndc: don't test hmac-md5 in FIPS mode
Mark Andrews [Tue, 21 Dec 2021 00:04:04 +0000 (11:04 +1100)] 
rndc: don't test hmac-md5 in FIPS mode

HMACMD5 is not permitted in FIPS mode.  Only test HMACMD5 when not
in FIPS mode.

3 years agonsupdate: use FIPS compatible algorithms
Mark Andrews [Mon, 20 Dec 2021 08:28:36 +0000 (19:28 +1100)] 
nsupdate: use FIPS compatible algorithms

HMACMD5 is not permitted in FIPS mode, use HMACSHA256 instead.

3 years agonsec3: use fips configuration if rsasha1 is not supported
Mark Andrews [Thu, 25 Aug 2022 04:14:42 +0000 (14:14 +1000)] 
nsec3: use fips configuration if rsasha1 is not supported

3 years agonsec3: skip tests that depend on RSASHA1 in FIPS mode
Mark Andrews [Thu, 25 Aug 2022 01:05:40 +0000 (11:05 +1000)] 
nsec3: skip tests that depend on RSASHA1 in FIPS mode

3 years agodoth: skip 'doth' test if FIPS mode when DH is broken
Mark Andrews [Tue, 4 Jan 2022 02:12:49 +0000 (13:12 +1100)] 
doth: skip 'doth' test if FIPS mode when DH is broken

'doth' depends on a working DH implementation.

3 years agodnssec: check that dnssec-signzone -F work with allowed algorithm
Mark Andrews [Fri, 26 Aug 2022 09:39:51 +0000 (19:39 +1000)] 
dnssec: check that dnssec-signzone -F work with allowed algorithm

3 years agodnssec: test dnssec-keygen -F switches to FIPS mode
Mark Andrews [Fri, 26 Aug 2022 02:24:30 +0000 (12:24 +1000)] 
dnssec: test dnssec-keygen -F switches to FIPS mode

3 years agodnssec: check if RSASHA1 is supported by the OS
Mark Andrews [Wed, 20 Jul 2022 05:42:30 +0000 (15:42 +1000)] 
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.

3 years agodnssec: Check validation with short RSA key size FIPS mode
Mark Andrews [Tue, 11 Jan 2022 07:44:23 +0000 (18:44 +1100)] 
dnssec: Check validation with short RSA key size FIPS mode

use a pregenerated zone signed with RSASHA1 keys at 1024 bits.

3 years agodnssec: Check that RSASHA1 still validates in FIPS mode
Mark Andrews [Tue, 4 Jan 2022 07:28:38 +0000 (18:28 +1100)] 
dnssec: Check that RSASHA1 still validates in FIPS mode

Add a pregenerated RSASHA1 signed zone and verify that
answers still validate.

3 years agodnssec: use FIPS compatible algorithms and key sizes
Mark Andrews [Tue, 21 Dec 2021 07:33:02 +0000 (18:33 +1100)] 
dnssec: use FIPS compatible algorithms and key sizes

RSASHA1 is verify only in FIPS mode.  Use RSASHA256 instead with
key of at least 2048 bits (minimum RSA FIPS size).

3 years agoOnly pass OPENSSL_CONF in the environment if it set
Mark Andrews [Thu, 10 Feb 2022 22:11:08 +0000 (09:11 +1100)] 
Only pass OPENSSL_CONF in the environment if it set

OPENSSL_CONF="" is treated differently to no OPENSSL_CONF in
the environment by OpenSSL.  OPENSSL_CONF="" lead to crypto
failure being reported in FIPS mode.

3 years agoAllow named-checkconf to selectively check dnssec-policy algorithms
Mark Andrews [Thu, 25 Aug 2022 06:47:34 +0000 (16:47 +1000)] 
Allow named-checkconf to selectively check dnssec-policy algorithms

There are times where you want named-checkconf to check whether the
dnssec-policies should be constrained by the cryptographic algorithms
supported by the operation system or to just accept all possible
algorithms.  This provides a mechanism to make that selection.

3 years agodnssec-signzone can now enable FIPS mode from the commandline
Mark Andrews [Thu, 25 Aug 2022 08:44:41 +0000 (18:44 +1000)] 
dnssec-signzone can now enable FIPS mode from the commandline

'dnssec-signzone -F' will now enable FIPS mode if supported
by the crypto provider and not already enabled.

3 years agodnssec-keygen: enable FIPS from the command line
Mark Andrews [Thu, 25 Aug 2022 08:33:29 +0000 (18:33 +1000)] 
dnssec-keygen: enable FIPS from the command line

'dnssec-keygen -F' will now turn on FIPS mode if supported by
the crypto provider and is not already enabled.

3 years agonamed-checkconf needs to know if named will be running in FIPS mode
Mark Andrews [Mon, 11 Jul 2022 23:09:57 +0000 (09:09 +1000)] 
named-checkconf needs to know if named will be running in FIPS mode

Call dst_lib_init to set FIPS mode if it was turned on at configure
time.

Check that named-checkconf report that dnssec policies that wont
work in FIPS mode are reported if named would be running in FIPS
mode.

3 years agoAdd --fips-provider to feature-test
Mark Andrews [Fri, 26 Aug 2022 01:52:57 +0000 (11:52 +1000)] 
Add --fips-provider to feature-test

Check that an FIPS provider is available.  This only works with
OpenSSL 3

3 years agoAdd --rsasha1 to feature-test
Mark Andrews [Wed, 20 Jul 2022 05:42:30 +0000 (15:42 +1000)] 
Add --rsasha1 to feature-test

3 years agoAdd --have-fips-dh to feature-test
Mark Andrews [Thu, 23 Dec 2021 03:55:50 +0000 (14:55 +1100)] 
Add --have-fips-dh to feature-test

Diffie-Hellman key echange doesn't appear to work in FIPS mode for
OpenSSL 1.x.x.  Add feature test (--have-fips-dh) to identify builds
where DH key exchanges work (non FIPS builds and OpenSSL 3.0.0+) and
exclude test that would otherwise fail.

3 years agoAdd FIPS-detecting option to feature-test helper
Michal Nowak [Tue, 20 Oct 2020 10:12:00 +0000 (12:12 +0200)] 
Add FIPS-detecting option to feature-test helper

The '--have-fips' option of feature-test detects FIPS mode.

3 years agoProbe if ED448 and ED25519 are supported
Mark Andrews [Mon, 15 Aug 2022 05:36:03 +0000 (15:36 +1000)] 
Probe if ED448 and ED25519 are supported

ED448 and ED25519 may or may not be supported in FIPS mode depending
upon the implementation.

3 years agoReport file and line when converting OpenSSL errors
Mark Andrews [Sun, 7 Aug 2022 11:41:18 +0000 (21:41 +1000)] 
Report file and line when converting OpenSSL errors

This provides more detail about which instance of specific OpenSSL
calls that have failed by reporting the file name and line numbers
involved when dst__openssl_toresult2 and dst__openssl_toresult3 are
called.

3 years agoReport when loading of dhparam-file fails
Mark Andrews [Tue, 4 Jan 2022 01:28:08 +0000 (12:28 +1100)] 
Report when loading of dhparam-file fails

prior to this loading of the configuration could fail without
an informative error message being logged.

3 years agoReport when dnssec-policy has an unsupported algorithn
Mark Andrews [Thu, 25 Aug 2022 03:35:27 +0000 (13:35 +1000)] 
Report when dnssec-policy has an unsupported algorithn

3 years agomake cfg_kaspkey_fromconfig FIPS aware
Mark Andrews [Thu, 23 Dec 2021 03:09:36 +0000 (14:09 +1100)] 
make cfg_kaspkey_fromconfig FIPS aware

- RSASHA1 (5) and NSEC3RSASHA1 (7) are not accepted in FIPS mode
- minimum RSA key size is set to 2048 bit

adjust kasp and checkconf system tests to ensure non FIPS
compliant configurations are not used in FIPS mode

3 years agoDon't register FIPS incompatible algorithms in FIPS mode
Mark Andrews [Fri, 17 Dec 2021 06:55:51 +0000 (17:55 +1100)] 
Don't register FIPS incompatible algorithms in FIPS mode

HMACMD5 is not permitted in FIPS mode.

Note that RSASHA1 is only permitted for verification of signatures.

3 years agoMake dnssec-keygen FIPS mode aware
Mark Andrews [Fri, 17 Dec 2021 06:43:58 +0000 (17:43 +1100)] 
Make dnssec-keygen FIPS mode aware

- Reject SHA1 based key generation
- Increase the minimum RSA key size to 2048 bits

3 years agoUse isc_fips_mode() and isc_fips_set_mode() in
Mark Andrews [Thu, 16 Dec 2021 08:20:40 +0000 (19:20 +1100)] 
Use isc_fips_mode() and isc_fips_set_mode() in

bin/named/server.c and lib/dns/openssl_link.c

3 years agoDisable failing MD5 unit tests in FIPS mode
Michal Nowak [Tue, 20 Oct 2020 10:15:23 +0000 (12:15 +0200)] 
Disable failing MD5 unit tests in FIPS mode

With FIPS mode enabled 'isc_hmac_init_test' and 'isc_hmac_md5_test'
tests of hmac_test and 'isc_md_init_test' and 'isc_md_md5_test' test
of md_test fail.

This is due to leveraging MD5, which is disabled in FIPS mode.

3 years agoAllow FIPS mode to be enabled at run time in named
Mark Andrews [Wed, 29 Jun 2022 04:10:06 +0000 (14:10 +1000)] 
Allow FIPS mode to be enabled at run time in named

If FIPS mode is supported by the OS 'named -F' will turn on FIPS
mode.

3 years agoDefine isc_fips_mode() and isc_fips_set_mode()
Mark Andrews [Wed, 20 Jul 2022 01:26:06 +0000 (11:26 +1000)] 
Define isc_fips_mode() and isc_fips_set_mode()

isc_fips_mode() determines if the process is running in FIPS mode

isc_fips_set_mode() sets the process into FIPS mode