Bug 2132404 - ipa server installation fails in FIPS mode in rawhide
Summary: ipa server installation fails in FIPS mode in rawhide
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: freeipa
Version: 38
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: IPA Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-10-05 14:31 UTC by Florence Blanc-Renaud
Modified: 2023-10-26 08:59 UTC (History)
21 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-10-26 08:59:55 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FREEIPA-8958 0 None None None 2022-10-24 13:01:17 UTC

Description Florence Blanc-Renaud 2022-10-05 14:31:21 UTC
Description of problem:

I'm trying to install IPA server in FIPS mode in rawhide and the installation fails in a step trying to install the agent cert in an NSSDB from /root/ca-agent.p12

Version-Release number of selected component (if applicable):

# rpm -qa freeipa-server dogtag-pki-server  nss-tools openssl
openssl-3.0.5-5.fc38.x86_64
nss-tools-3.83.0-1.fc38.x86_64
dogtag-pki-server-11.2.0-2.fc37.noarch
freeipa-server-4.10.0-6.fc38.x86_64


How reproducible:

Always.

Steps to Reproduce:
1. Enable FIPS mode: fips-mode-setup --enable; reboot
2. Update and install ipa pkgs: dnf update -y; dnf install -y freeipa-server
3. Install the IPA server: ipa-server-install --domain ipa.test --realm IPA.TEST -a Secret123 -p Secret123 -U

Actual results:

The server installation fails with the following error message:
...
  [17/30]: requesting RA certificate from CA
  [error] CalledProcessError: CalledProcessError(Command ['/usr/bin/openssl', 'pkcs12', '-nokeys', '-clcerts', '-in', '/root/ca-agent.p12', '-out', '/var/lib/ipa/tmp54zz8qf5', '-passin', 'file:/tmp/tmpt0ypm_2t'] returned non-zero exit status 1: 'Error verifying PKCS12 MAC; no PKCS12KDF support.\nUse -nomacver if MAC verification is not required.\n')
CalledProcessError(Command ['/usr/bin/openssl', 'pkcs12', '-nokeys', '-clcerts', '-in', '/root/ca-agent.p12', '-out', '/var/lib/ipa/tmp54zz8qf5', '-passin', 'file:/tmp/tmpt0ypm_2t'] returned non-zero exit status 1: 'Error verifying PKCS12 MAC; no PKCS12KDF support.\nUse -nomacver if MAC verification is not required.\n')
The ipa-server-install command failed. See /var/log/ipaserver-install.log for more information

Expected results:

Installation should succeed

Additional info:

The installation fails when ipa installer tries to install a cert from a pkcs12 file (/root/ca-agent.p12) into an NSSDB:
/usr/bin/openssl pkcs12 -nokeys -clcerts -in /root/ca-agent.p12 -out /var/lib/ipa/tmp54zz8qf5 -passin file:/tmp/tmpt0ypm_2t
Error verifying PKCS12 MAC; no PKCS12KDF support.
Use -nomacver if MAC verification is not required.

The pkcs12 file is created by pkispawn command using the following command:
pk12util -d /root/.dogtag/pki-tomcat/ca/alias -o /root/ca-agent.p12 -n ipa-ca-agent -w /root/.dogtag/pki-tomcat/ca/pkcs12_password.conf -k /root/.dogtag/pki-tomcat/ca/password.conf -c AES-128-CBC -C NONE

IPA could use the -nomacver option in the openssl command as recommended by the error message, but I don't understand why this is required in fedora rawhide but works without the option in RHEL 9.1.
There are probably some differences between RHEL 9.1 and rawhide that explain the issue, I am not sure if they are related to PKI, openssl version (used to extract the cert) or pk12util version (used to create the p12file).

According to openssl-pkcs12 man page, it is possible to create a p12 file with no MAC integrity:
       -nomac
           Do not attempt to provide the MAC integrity. This can be useful
           with the FIPS provider as the PKCS12 MAC requires PKCS12KDF which
           is not an approved FIPS algorithm and cannot be supported by the
           FIPS provider.

Maybe it is possible to do the same when creating a p12 file with pk12util?

Comment 4 Dmitry Belyavskiy 2022-10-11 09:32:32 UTC
There is a known problem with PKCS12 format in FIPS mode. The current MAC protection is totally FIPS uncompliant. So you have to use -nomac/-nomacver to avoid it.

Comment 5 Petr Čech 2022-10-24 12:46:52 UTC
As we discussed on the sync meeting with FreeIPA team, this is going back to their team.
PO, CS/PKI team

Comment 6 Ben Cotton 2023-02-07 14:56:58 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 7 Fedora Update System 2023-06-13 13:41:08 UTC
FEDORA-2023-5cd7789569 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-5cd7789569

Comment 8 Fedora Update System 2023-06-13 13:55:18 UTC
FEDORA-2023-5cd7789569 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Florence Blanc-Renaud 2023-10-26 08:59:55 UTC
freeipa-server-4.10.2-1.fc38.x86_64 fixes the issue:

# rpm -qa freeipa-server
freeipa-server-4.10.2-1.fc38.x86_64
# fips-mode-setup --check
FIPS mode is enabled.
Initramfs fips module is enabled.
The current crypto policy (FIPS) is based on the FIPS policy.
# ipa-server-install --domain ipa.test --realm IPA.TEST -a Secret123 -p Secret123 -U
[...]
==============================================================================
Setup complete

Next steps:
	1. You must make sure these network ports are open:
		TCP Ports:
		  * 80, 443: HTTP/HTTPS
		  * 389, 636: LDAP/LDAPS
		  * 88, 464: kerberos
		UDP Ports:
		  * 88, 464: kerberos
		  * 123: ntp

	2. You can now obtain a kerberos ticket using the command: 'kinit admin'
	   This ticket will allow you to use the IPA tools (e.g., ipa user-add)
	   and the web user interface.

Be sure to back up the CA certificates stored in /root/cacert.p12
These files are required to create replicas. The password for these
files is the Directory Manager password
The ipa-server-install command was successful
#


Note You need to log in before you can comment on or make changes to this bug.