2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00
Commit Graph

38958 Commits

Author SHA1 Message Date
Mark Andrews
2abd6c7ab4 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.
2023-04-03 12:44:27 +10: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
a3172c8f9c 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.
2023-04-03 12:44:27 +10:00
Mark Andrews
97627c554b 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.
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
Mark Andrews
333693ddf5 dnssec: Check validation with short RSA key size FIPS mode
use a pregenerated zone signed with RSASHA1 keys at 1024 bits.
2023-04-03 12:44:27 +10:00
Mark Andrews
ed7750be56 dnssec: Check that RSASHA1 still validates in FIPS mode
Add a pregenerated RSASHA1 signed zone and verify that
answers still validate.
2023-04-03 12:44:27 +10:00
Mark Andrews
ae1109f321 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).
2023-04-03 12:44:27 +10:00
Mark Andrews
701ffb2daa 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.
2023-04-03 12:44:27 +10:00
Mark Andrews
a830adff1c 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.
2023-04-03 12:15:57 +10:00
Mark Andrews
1eaff9a670 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.
2023-04-03 12:07:44 +10:00
Mark Andrews
439f24fc80 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.
2023-04-03 12:06:04 +10:00
Mark Andrews
d42b636d5a 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.
2023-04-03 12:06:04 +10:00
Mark Andrews
d7cc90c032 Add --fips-provider to feature-test
Check that an FIPS provider is available.  This only works with
OpenSSL 3
2023-04-03 12:06:04 +10:00
Mark Andrews
d6d85a6a2d Add --rsasha1 to feature-test 2023-04-03 12:06:04 +10:00
Mark Andrews
6be00b3042 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.
2023-04-03 12:06:04 +10:00
Michal Nowak
fe8b41286f Add FIPS-detecting option to feature-test helper
The '--have-fips' option of feature-test detects FIPS mode.
2023-04-03 12:06:04 +10:00
Mark Andrews
c51a39e97a Probe if ED448 and ED25519 are supported
ED448 and ED25519 may or may not be supported in FIPS mode depending
upon the implementation.
2023-04-03 12:06:04 +10:00
Mark Andrews
ba34255648 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.
2023-04-03 12:06:04 +10:00
Mark Andrews
2baa58c59f Report when loading of dhparam-file fails
prior to this loading of the configuration could fail without
an informative error message being logged.
2023-04-03 12:06:04 +10:00
Mark Andrews
1246fd3b5f Report when dnssec-policy has an unsupported algorithn 2023-04-03 12:06:04 +10:00
Mark Andrews
805da5bf8f 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
2023-04-03 12:06:04 +10:00
Mark Andrews
07a3b5b02f 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.
2023-04-03 12:06:03 +10:00
Mark Andrews
0a8f44a8f7 Make dnssec-keygen FIPS mode aware
- Reject SHA1 based key generation
- Increase the minimum RSA key size to 2048 bits
2023-04-03 12:05:29 +10:00
Mark Andrews
e7aa100e9b Use isc_fips_mode() and isc_fips_set_mode() in
bin/named/server.c and lib/dns/openssl_link.c
2023-04-03 12:05:29 +10:00
Michal Nowak
4d094f6b51 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.
2023-04-03 12:05:29 +10:00
Mark Andrews
6e8de4bcdc 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.
2023-04-03 12:05:29 +10:00
Mark Andrews
5a2e82557e 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
2023-04-03 12:05:28 +10:00
Mark Andrews
6e64ec2af4 Detect if FIPS mode is configured at the OS level
Always look for FIPS_mode and EVP_default_properties_enable_fips
rather than just when requested by --enable-fips.
2023-04-03 12:04:58 +10:00
Mark Andrews
7aa9b80f83 Probe for EVP_default_properties_enable_fips
FIPS_mode is not available in OpenSSL 3.0.0
2023-04-03 12:04:58 +10:00
Evan Hunt
c774aed465 add --enable-fips-mode to configure summary
Report when FIPS mode is enabled or disabled in the configure
summary output.
2023-04-03 12:04:58 +10:00