c58629
From 8f35c1c705a7584cdcc9ad5c6fb15ba940ec3f4a Mon Sep 17 00:00:00 2001
c58629
From: Florence Blanc-Renaud <flo@redhat.com>
c58629
Date: Thu, 23 Nov 2017 18:06:56 +0100
c58629
Subject: [PATCH] Fix ca less IPA install on fips mode
c58629
c58629
When ipa-server-install is run in fips mode and ca-less, the installer
c58629
fails when the keys are provided with --{http|dirsrv|pkinit}-cert-file
c58629
in a separate key file.
c58629
c58629
The installer transforms the key into PKCS#8 format using
c58629
openssl pkcs8 -topk8
c58629
but this command fails on a fips-enabled server, unless the options
c58629
-v2 aes256 -v2prf hmacWithSHA256
c58629
are also provided.
c58629
c58629
Fixes:
c58629
https://pagure.io/freeipa/issue/7280
c58629
c58629
Reviewed-By: Christian Heimes <cheimes@redhat.com>
c58629
Reviewed-By: Christian Heimes <cheimes@redhat.com>
c58629
---
c58629
 ipapython/certdb.py | 4 ++++
c58629
 1 file changed, 4 insertions(+)
c58629
c58629
diff --git a/ipapython/certdb.py b/ipapython/certdb.py
c58629
index 114c58340253141706afa461ecaf87797562ca1d..f198811e0fd02c8925f0dcfa8764535b35ed29ed 100644
c58629
--- a/ipapython/certdb.py
c58629
+++ b/ipapython/certdb.py
c58629
@@ -499,9 +499,13 @@ class NSSDatabase(object):
c58629
                                 "Can't load private key from both %s and %s" %
c58629
                                 (key_file, filename))
c58629
 
c58629
+                        # the args -v2 aes256 -v2prf hmacWithSHA256 are needed
c58629
+                        # on OpenSSL 1.0.2 (fips mode). As soon as FreeIPA
c58629
+                        # requires OpenSSL 1.1.0 we'll be able to drop them
c58629
                         args = [
c58629
                             OPENSSL, 'pkcs8',
c58629
                             '-topk8',
c58629
+                            '-v2', 'aes256', '-v2prf', 'hmacWithSHA256',
c58629
                             '-passout', 'file:' + self.pwd_file,
c58629
                         ]
c58629
                         if ((label != 'PRIVATE KEY' and key_password) or
c58629
-- 
c58629
2.13.6
c58629