Bug 2039684

Summary: AES SHA-1 HMAC encryption types failing in FIPS mode
Product: Red Hat Enterprise Linux 9 Reporter: Filip Dvorak <fdvorak>
Component: krb5Assignee: Julien Rische <jrische>
Status: CLOSED ERRATA QA Contact: Filip Dvorak <fdvorak>
Severity: medium Docs Contact: Filip Hanzelka <fhanzelk>
Priority: unspecified    
Version: 9.0CC: abokovoy, dbelyavs, dkarpele, dpal, fdvorak, fhanzelk, ftrivino, gfialova, jrische, ksiddiqu, lmiksik, mpolovka, myusuf, pasik, pvlasin, ssorce
Target Milestone: rcKeywords: TestBlocker, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: krb5-1.19.1-14.el9_0 Doc Type: Bug Fix
Doc Text:
.FIPS mode now supports the `aes128-cts-hmac-sha1-96` and `aes256-cts-hmac-sha1-96` encryption types Previously, Kerberos could not use the `aes128-cts-hmac-sha1-96` and `aes256-cts-hmac-sha1-96` encryption types in FIPS mode on RHEL 9 because the SHA-1 hash algorithm is deprecated in RHEL 9. With this release, the KRB5KDF key derivation function has been modified and the `FIPS:AD-SUPPORT` crypto subpolicy has been changed to enable `aes128-cts-hmac-sha1-96` and `aes256-cts-hmac-sha1-96` in FIPS mode. As a result, with the `FIPS:AD-SUPPORT` crypto-policy enabled, the Kerberos Key Distribution Center (KDC) can use the two encryption types to achieve the following: * Create a KDC database. * Create keys for Kerberos principals. * Use the keys for the communication between the client and the KDC. Enabling the `FIPS:AD-SUPPORT` crypto-policy is required if your systems are integrated into Active Directory. Note that `FIPS:AD-SUPPORT` does not support the `arcfour-hmac-md5` cipher. If this cipher is needed, enable it with the `FIPS:AD-SUPPORT-LEGACY` support policy.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 15:54:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2027125, 2050138, 2057471, 2067971, 2124308, 2124310    

Description Filip Dvorak 2022-01-12 08:56:57 UTC
Description of problem:
It is not possible to create a KDC db with the help of "kdb5_util" when the default master_key_type (aes256-cts-hmac-sha1-96) is used.

Version-Release number of selected component (if applicable):
krb5-server-1.19.1-13.el9.x86_64
openssl-3.0.0-6.el9.x86_64
RHEL-9.0.0-20220110.3

How reproducible:


Steps to Reproduce:
1. hostnamectl set-hostname kerberos.example.com
2. sed -i "1i 127.0.0.1 kerberos.example.com" /etc/hosts
3. echo -ne '[realms]\nEXAMPLE.COM = {\n    kdc = kerberos.example.com\n    admin_server = kerberos.example.com\n}\n\n[domain_realm]\n.example.com = EXAMPLE.COM\nexample.com = example.com\n' > /etc/krb5.conf.d/example_com
4. sed -i "s/^# default_realm/ default_realm/" /etc/krb5.conf
5. modify /var/kerberos/krb5kdc/kdc.conf 
...
     supported_enctypes = aes256-sha2:normal
...

Actual results:
#kdb5_util create -r EXAMPLE.COM -P password -k aes256-cts-hmac-sha1-96
Loading random data
Initializing database '/var/kerberos/krb5kdc/principal' for realm 'EXAMPLE.COM',
master key name 'K/M'
kdb5_util: Cryptosystem internal error while transforming master key from password

Expected results:
The KDC db should be created because "hmac-sha1-96" will be supported in FIPS mode.

Additional info:
- Works with aes256-cts-hmac-sha384-192:

# kdb5_util create -r EXAMPLE.COM -P password -k aes256-cts-hmac-sha384-192
Loading random data
Initializing database '/var/kerberos/krb5kdc/principal' for realm 'EXAMPLE.COM',
master key name 'K/M'

Comment 4 Simo Sorce 2022-01-13 17:21:13 UTC
Not really no.
Unfortunately the Krb5 KDF is not an approved KDF, so the krb5 code needs to either explictly opt out of FIPS mode, or simply accept this limitation in FIPS mode.

Comment 5 Alexander Bokovoy 2022-01-13 17:54:51 UTC
From Simo on IRC: 

"pass the -fips property when instantiating the KDF for now, until we can find a way to have it in the fips provider"

This is to explicitly get out of FIPS policy use for krb5kdc.

Comment 6 Julien Rische 2022-02-03 13:24:11 UTC
I confirm that passing the "-fips" property when retrieving the default KRB5 KDF does the trick. But if we take this decision, the KDC will not be FIPS-compliant.

Comment 7 Julien Rische 2022-02-03 14:17:24 UTC
*** Bug 2050138 has been marked as a duplicate of this bug. ***

Comment 14 Julien Rische 2022-02-09 13:31:28 UTC
We discovered another issue with RC4 encryption types. MD4/MB5[1] which are necessary for password hashing, are not provided when FIPS mode is on. The "legacy" provider[2] is required to get these algorithms.

@simo confirmed this use of MD4/5 in krb5 is not a violation of FIPS. As he advised me, I will import the legacy provider in a local context for this specific case.

[1] https://www.openssl.org/docs/man1.1.1/man3/EVP_MD_type.html
[2] https://www.openssl.org/docs/manmaster/man7/OSSL_PROVIDER-legacy.html

Comment 15 Julien Rische 2022-02-10 15:43:35 UTC
The RC4 enctypes issue is a distinct one, I opened a dedicated bug 2053135.

Comment 27 Michal Polovka 2022-03-18 17:58:33 UTC
Pre-verified tested using automation krb5-tests/tests/Sanity/sanity-test-of-cipher-suites in FIPS mode run in gating pipeline for krb5-1.19.1-15.el9_0.x86_64 on link http://idm-artifacts.usersys.redhat.com/krb5/Gating-krb5/RHEL9.0/43922298/gating-tests/bash-gating/2/gating-restraint.01/index.html.gz


krb5-tests/tests/Sanity/sanity-test-of-cipher-suites	2022-03-18T15:26:14+0000

2022-03-18T15:27:39+0000 00:01:25 Completed	PASS

Therefore marking as pre-verified: tested.

Comment 32 Julien Rische 2022-04-21 08:42:42 UTC
*** Bug 1998991 has been marked as a duplicate of this bug. ***

Comment 35 errata-xmlrpc 2022-05-17 15:54:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: krb5), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:3951