Blame SOURCES/pki-core-rhel-7-9-rhcs-9-7-bu-7.patch

b9388a
From f5549f8c760035bc15d88109dfd947e91c5bf1e9 Mon Sep 17 00:00:00 2001
b9388a
From: Christina Fu <cfu@redhat.com>
b9388a
Date: Mon, 7 Jun 2021 11:23:03 -0700
b9388a
Subject: [PATCH] Bug1905374 restrict EE profile list and enrollment submission
b9388a
 per LDAP group without immediate issuance
b9388a
b9388a
It's always been the case by design that if authentication (auth.instance_id=X) is specified in a profile, then as long as a request passes both authentication and authorization (authz.Y) then the issuance would be granted.
b9388a
In this patch, an option per profile is added to override such design and would require explicit agent approval even when both auth and authz passed.
b9388a
b9388a
This new option is auth.explicitApprovalRequired and the value is true
b9388a
or false,with false being the default if not set.
b9388a
b9388a
An example configuration in a directory-based authentication profile
b9388a
would have something like the following:
b9388a
b9388a
         auth.instance_id=UserDirEnrollment
b9388a
         auth.explicitApprovalRequired=true
b9388a
         authz.acl=group=requestors
b9388a
b9388a
addressed https://bugzilla.redhat.com/show_bug.cgi?id=1905374
b9388a
b9388a
(cherry picked from commit 8e78a2b912e7c3bd015e4da1f1630d0f35145104)
b9388a
---
b9388a
 .../src/com/netscape/certsrv/profile/IProfile.java  |  2 ++
b9388a
 .../netscape/cms/profile/common/EnrollProfile.java  | 21 +++++++++++++++++++--
b9388a
 .../netscape/cms/servlet/cert/CertProcessor.java    |  6 +++++-
b9388a
 3 files changed, 26 insertions(+), 3 deletions(-)
b9388a
b9388a
diff --git a/base/common/src/com/netscape/certsrv/profile/IProfile.java b/base/common/src/com/netscape/certsrv/profile/IProfile.java
b9388a
index b4605cf..e076232 100644
b9388a
--- a/base/common/src/com/netscape/certsrv/profile/IProfile.java
b9388a
+++ b/base/common/src/com/netscape/certsrv/profile/IProfile.java
b9388a
@@ -424,6 +424,8 @@ public interface IProfile {
b9388a
      */
b9388a
     public void submit(IAuthToken token, IRequest request)
b9388a
             throws EDeferException, EProfileException;
b9388a
+    public void submit(IAuthToken token, IRequest request, boolean explicitApprovalRequired)
b9388a
+            throws EDeferException, EProfileException;
b9388a
 
b9388a
     public void setRenewal(boolean renewal);
b9388a
 
b9388a
diff --git a/base/server/cms/src/com/netscape/cms/profile/common/EnrollProfile.java b/base/server/cms/src/com/netscape/cms/profile/common/EnrollProfile.java
b9388a
index b7fdb9e..afcfa0d 100644
b9388a
--- a/base/server/cms/src/com/netscape/cms/profile/common/EnrollProfile.java
b9388a
+++ b/base/server/cms/src/com/netscape/cms/profile/common/EnrollProfile.java
b9388a
@@ -518,6 +518,10 @@ public abstract class EnrollProfile extends BasicProfile
b9388a
      */
b9388a
     public void submit(IAuthToken token, IRequest request)
b9388a
             throws EDeferException, EProfileException {
b9388a
+        submit(token, request, false);
b9388a
+    }
b9388a
+    public void submit(IAuthToken token, IRequest request, boolean explicitApprovalRequired)
b9388a
+            throws EDeferException, EProfileException {
b9388a
         // Request Submission Logic:
b9388a
         //
b9388a
         // if (Authentication Failed) {
b9388a
@@ -549,8 +553,21 @@ public abstract class EnrollProfile extends BasicProfile
b9388a
             CMS.debug(e);
b9388a
         }
b9388a
 
b9388a
-        if (token == null){
b9388a
-            CMS.debug(method + " auth token is null; agent manual approval required;");
b9388a
+        /*
b9388a
+         * this is where we decide whether to let agent do manual approval
b9388a
+         *  or not
b9388a
+         * If auth.instance_id is not set, then request automatically goes
b9388a
+         * into queue for agent approval.
b9388a
+         * If auth.explicitApprovalRequired is true, then the request goes into
b9388a
+         * queue for agent approval even though auth and authz succeed.
b9388a
+         */
b9388a
+         if ((token == null) || (explicitApprovalRequired == true)){
b9388a
+
b9388a
+            if (token ==  null)
b9388a
+                CMS.debug(method + " auth token is null; agent manual approval required;");
b9388a
+            else
b9388a
+                CMS.debug(method + "explicitApprovalRequired is true; agent manual approval required");
b9388a
+
b9388a
             CMS.debug(method + " validating request");
b9388a
             validate(request);
b9388a
             try {
b9388a
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java b/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java
b9388a
index 6252e6e..b9eda7c 100644
b9388a
--- a/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java
b9388a
+++ b/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java
b9388a
@@ -31,6 +31,7 @@ import com.netscape.certsrv.authentication.ExternalAuthToken;
b9388a
 import com.netscape.certsrv.authentication.IAuthToken;
b9388a
 import com.netscape.certsrv.base.EBaseException;
b9388a
 import com.netscape.certsrv.base.EPropertyNotFound;
b9388a
+import com.netscape.certsrv.base.IConfigStore;
b9388a
 import com.netscape.certsrv.cert.CertEnrollmentRequest;
b9388a
 import com.netscape.certsrv.logging.ILogger;
b9388a
 import com.netscape.certsrv.logging.event.CertRequestProcessedEvent;
b9388a
@@ -224,6 +225,9 @@ public class CertProcessor extends CAProcessor {
b9388a
 
b9388a
         for (IRequest req : reqs) {
b9388a
             try {
b9388a
+                IConfigStore profileConf = profile.getConfigStore().getSubStore("auth");
b9388a
+                boolean explicitApprovalRequired = profileConf.getBoolean("explicitApprovalRequired", false);
b9388a
+
b9388a
                 // reset the "auditRequesterID"
b9388a
                 auditRequesterID = auditRequesterID(req);
b9388a
 
b9388a
@@ -242,7 +246,7 @@ public class CertProcessor extends CAProcessor {
b9388a
                 */
b9388a
 
b9388a
                 CMS.debug("CertProcessor.submitRequest: calling profile submit");
b9388a
-                profile.submit(authToken, req);
b9388a
+                profile.submit(authToken, req, explicitApprovalRequired);
b9388a
                 req.setRequestStatus(RequestStatus.COMPLETE);
b9388a
 
b9388a
                 X509CertImpl x509cert = req.getExtDataInCert(IEnrollProfile.REQUEST_ISSUED_CERT);
b9388a
-- 
b9388a
1.8.3.1
b9388a