dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0084-p11_child-make-sure-OCSP-checks-are-done.patch

9f2ebf
From 62275e72ff0b9849c899f0fecea90731fff9da0a Mon Sep 17 00:00:00 2001
9f2ebf
From: Sumit Bose <sbose@redhat.com>
9f2ebf
Date: Thu, 7 Dec 2017 17:08:33 +0100
9f2ebf
Subject: [PATCH 84/86] p11_child: make sure OCSP checks are done
9f2ebf
MIME-Version: 1.0
9f2ebf
Content-Type: text/plain; charset=UTF-8
9f2ebf
Content-Transfer-Encoding: 8bit
9f2ebf
9f2ebf
If CERT_VerifyCertificateNow() is used with
9f2ebf
'certificateUsageCheckAllUsages' OCSP checks are skipped even if OCSP
9f2ebf
was enabled.
9f2ebf
9f2ebf
This patch calls CERT_CheckOCSPStatus() explicitly if OCSP checks are
9f2ebf
enabled.
9f2ebf
9f2ebf
Related to https://pagure.io/SSSD/sssd/issue/3560
9f2ebf
9f2ebf
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
9f2ebf
(cherry picked from commit 2297cc7d6cd5c38a7d64027165e4e82ca497f418)
9f2ebf
---
9f2ebf
 src/p11_child/p11_child_nss.c | 17 +++++++++++++++++
9f2ebf
 1 file changed, 17 insertions(+)
9f2ebf
9f2ebf
diff --git a/src/p11_child/p11_child_nss.c b/src/p11_child/p11_child_nss.c
9f2ebf
index 21c508eb1b1b68b3606d0a5eed36573b01f27a19..bf533f3efe4d680f4c6dbd10a0d2c5a5da371c67 100644
9f2ebf
--- a/src/p11_child/p11_child_nss.c
9f2ebf
+++ b/src/p11_child/p11_child_nss.c
9f2ebf
@@ -338,6 +338,23 @@ int do_work(TALLOC_CTX *mem_ctx, const char *nss_db,
9f2ebf
                       PR_GetError(), PORT_ErrorToString(PR_GetError()));
9f2ebf
                 continue;
9f2ebf
             }
9f2ebf
+
9f2ebf
+            /* with 'certificateUsageCheckAllUsages' set
9f2ebf
+             * CERT_VerifyCertificateNow() does not do OCSP so it must be done
9f2ebf
+             * explicitly */
9f2ebf
+            if (cert_verify_opts->do_ocsp) {
9f2ebf
+                rv = CERT_CheckOCSPStatus(handle, cert_list_node->cert,
9f2ebf
+                                          PR_Now(), NULL);
9f2ebf
+                if (rv != SECSuccess) {
9f2ebf
+                    DEBUG(SSSDBG_OP_FAILURE,
9f2ebf
+                          "Certificate [%s][%s] failed OCSP check [%d][%s], "
9f2ebf
+                          "skipping.\n",
9f2ebf
+                          cert_list_node->cert->nickname,
9f2ebf
+                          cert_list_node->cert->subjectName,
9f2ebf
+                          PR_GetError(), PORT_ErrorToString(PR_GetError()));
9f2ebf
+                    continue;
9f2ebf
+                }
9f2ebf
+            }
9f2ebf
         }
9f2ebf
 
9f2ebf
         if (key_id_in != NULL) {
9f2ebf
-- 
9f2ebf
2.14.3
9f2ebf